prometheus/web/ui/react-app/src/index.tsx
Julien Pivotto c78fcd29ba
Adapt UI for Prometheus Agent (#9851)
* Adapt UI for Prometheus Agent

UI is not my strongest skill, but I'd like to have something minimal for
the initial release of the agent.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Address review comments

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Add tests

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Add tests, serve only current mode paths

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>

* Update js style, add agent test

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2021-11-30 11:21:07 +01:00

27 lines
829 B
TypeScript
Executable file

import './globals';
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './themes/app.scss';
import './themes/light.scss';
import './themes/dark.scss';
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;
declare const GLOBAL_AGENT_MODE: string;
let consolesLink: string | null = GLOBAL_CONSOLES_LINK;
const agentMode: string | null = GLOBAL_AGENT_MODE;
if (
GLOBAL_CONSOLES_LINK === 'CONSOLES_LINK_PLACEHOLDER' ||
GLOBAL_CONSOLES_LINK === '' ||
!isPresent(GLOBAL_CONSOLES_LINK)
) {
consolesLink = null;
}
ReactDOM.render(<App consolesLink={consolesLink} agentMode={agentMode === 'true'} />, document.getElementById('root'));