prometheus/web/ui/react-app/src/index.tsx
Julius Volz faacb619c0
Add new codemirror-promql-based expression editor (#8634)
* Add new codemirror-promql-based expression editor

This adds advanced autocompletion, syntax highlighting, and linting
for PromQL.

Fixes https://github.com/prometheus/prometheus/issues/6160
Fixes https://github.com/prometheus/prometheus/issues/5421

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Group new editor options and float them left

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Improve history autocompletion handling

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Only show info tooltips for unabbreviated completion items

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Rename "new editor" to "experimental editor"

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Add path prefix support

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Revert accidental check-in of go.sum changes

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Remove spurious console.log

Signed-off-by: Julius Volz <julius.volz@gmail.com>

* Fix completion item type icon styling

Signed-off-by: Julius Volz <julius.volz@gmail.com>
2021-03-23 23:55:52 +01:00

23 lines
663 B
TypeScript
Executable file

import './globals';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import 'bootstrap/dist/css/bootstrap.min.css';
import './fonts/codicon.ttf';
import { isPresent } from './utils';
// Declared/defined in public/index.html, value replaced by Prometheus when serving bundle.
declare const GLOBAL_CONSOLES_LINK: string;
let consolesLink: string | null = GLOBAL_CONSOLES_LINK;
if (
GLOBAL_CONSOLES_LINK === 'CONSOLES_LINK_PLACEHOLDER' ||
GLOBAL_CONSOLES_LINK === '' ||
!isPresent(GLOBAL_CONSOLES_LINK)
) {
consolesLink = null;
}
ReactDOM.render(<App consolesLink={consolesLink} />, document.getElementById('root'));