2019-10-17 05:38:09 -07:00
|
|
|
import './globals';
|
|
|
|
import React from 'react';
|
|
|
|
import ReactDOM from 'react-dom';
|
|
|
|
import App from './App';
|
|
|
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
2020-02-08 02:00:48 -08:00
|
|
|
import { isPresent } from './utils';
|
2019-10-17 05:38:09 -07:00
|
|
|
|
2019-11-04 00:17:50 -08:00
|
|
|
// Declared/defined in public/index.html, value replaced by Prometheus when serving bundle.
|
2020-02-08 02:00:48 -08:00
|
|
|
declare const GLOBAL_PATH_PREFIX: string;
|
|
|
|
declare const GLOBAL_CONSOLES_LINK: string;
|
2019-11-04 00:17:50 -08:00
|
|
|
|
2020-02-08 02:00:48 -08:00
|
|
|
let prefix = GLOBAL_PATH_PREFIX;
|
2020-02-09 04:39:44 -08:00
|
|
|
let consolesLink: string | null = GLOBAL_CONSOLES_LINK;
|
|
|
|
|
2020-02-08 02:00:48 -08:00
|
|
|
if (GLOBAL_PATH_PREFIX === 'PATH_PREFIX_PLACEHOLDER' || GLOBAL_PATH_PREFIX === '/' || !isPresent(GLOBAL_PATH_PREFIX)) {
|
2019-11-04 00:17:50 -08:00
|
|
|
// Either we are running the app outside of Prometheus, so the placeholder value in
|
|
|
|
// the index.html didn't get replaced, or we have a '/' prefix, which we also need to
|
|
|
|
// normalize to '' to make concatenations work (prefixes like '/foo/bar/' already get
|
|
|
|
// their trailing slash stripped by Prometheus).
|
|
|
|
prefix = '';
|
|
|
|
}
|
|
|
|
|
2020-02-08 02:00:48 -08:00
|
|
|
if (
|
|
|
|
GLOBAL_CONSOLES_LINK === 'CONSOLES_LINK_PLACEHOLDER' ||
|
|
|
|
GLOBAL_CONSOLES_LINK === '' ||
|
|
|
|
!isPresent(GLOBAL_CONSOLES_LINK)
|
|
|
|
) {
|
2020-02-09 04:39:44 -08:00
|
|
|
consolesLink = null;
|
2020-02-08 02:00:48 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<App pathPrefix={prefix} consolesLink={consolesLink} />, document.getElementById('root'));
|