mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
add initial panel on did mount
Signed-off-by: blalov <boyko.lalov@tick42.com>
This commit is contained in:
parent
ebe5380433
commit
77da5e7ab4
|
@ -20,29 +20,21 @@ interface PanelListState {
|
|||
timeDriftError: string | null;
|
||||
}
|
||||
|
||||
const initialPanel = {
|
||||
id: generateID(),
|
||||
key: '0',
|
||||
options: PanelDefaultOptions,
|
||||
};
|
||||
|
||||
class PanelList extends Component<RouteComponentProps & PathPrefixProps, PanelListState> {
|
||||
constructor(props: PathPrefixProps) {
|
||||
super(props);
|
||||
|
||||
const urlPanels = decodePanelOptionsFromQueryString(window.location.search);
|
||||
|
||||
this.state = {
|
||||
panels: urlPanels.length ? urlPanels : [initialPanel],
|
||||
panels: decodePanelOptionsFromQueryString(window.location.search),
|
||||
pastQueries: [],
|
||||
metricNames: [],
|
||||
fetchMetricsError: null,
|
||||
timeDriftError: null,
|
||||
};
|
||||
!urlPanels.length && this.updateURL();
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
!this.state.panels.length && this.addPanel()
|
||||
fetch(`${this.props.pathPrefix}/api/v1/label/__name__/values`, { cache: 'no-store' })
|
||||
.then(resp => {
|
||||
if (resp.ok) {
|
||||
|
|
Loading…
Reference in a new issue