From 8497c854f644f8b7251b5e791283f4e39e87d94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 12 Dec 2018 08:54:12 +0100 Subject: [PATCH] Adding mixed query --- .../app/features/dashboard/dashgrid/QueriesTab.tsx | 13 ++++++++----- public/app/features/dashboard/panel_model.ts | 5 +++-- .../prometheus/partials/query.editor.html | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/public/app/features/dashboard/dashgrid/QueriesTab.tsx b/public/app/features/dashboard/dashgrid/QueriesTab.tsx index a01914327ef..31480403743 100644 --- a/public/app/features/dashboard/dashgrid/QueriesTab.tsx +++ b/public/app/features/dashboard/dashgrid/QueriesTab.tsx @@ -236,14 +236,14 @@ export class QueriesTab extends PureComponent { return isLoadingHelp ? : helpContent; }; - onAddQuery = (query?: DataQuery) => { + onAddQuery = (query?: Partial) => { this.props.panel.addQuery(query); this.forceUpdate(); }; onAddQueryClick = () => { if (this.state.currentDS.meta.mixed) { - this.setState({ isAddingMixed: true }) + this.setState({ isAddingMixed: true }); return; } @@ -284,8 +284,6 @@ export class QueriesTab extends PureComponent { }; renderMixedPicker = () => { - const { currentDS } = this.state; - return ( { onAddMixedQuery = datasource => { this.onAddQuery({ datasource: datasource.name }); + this.component.digest(); this.setState({ isAddingMixed: false }); }; @@ -348,7 +347,11 @@ export class QueriesTab extends PureComponent { {panel.getNextQueryLetter()} - {!isAddingMixed && } + {!isAddingMixed && ( + + )} {isAddingMixed && this.renderMixedPicker()} diff --git a/public/app/features/dashboard/panel_model.ts b/public/app/features/dashboard/panel_model.ts index e0a3e6707cb..2d5a70b47dd 100644 --- a/public/app/features/dashboard/panel_model.ts +++ b/public/app/features/dashboard/panel_model.ts @@ -238,9 +238,10 @@ export class PanelModel { this.restorePanelOptions(pluginId); } - addQuery(query?: DataQuery) { + addQuery(query?: Partial) { query = query || { refId: 'A' }; - (query.refId = this.getNextQueryLetter()), (query.isNew = true); + query.refId = this.getNextQueryLetter(); + query.isNew = true; this.targets.push(query); } diff --git a/public/app/plugins/datasource/prometheus/partials/query.editor.html b/public/app/plugins/datasource/prometheus/partials/query.editor.html index 11a857f37e7..0f0a4b09014 100644 --- a/public/app/plugins/datasource/prometheus/partials/query.editor.html +++ b/public/app/plugins/datasource/prometheus/partials/query.editor.html @@ -8,7 +8,7 @@
-
+
@@ -58,4 +58,4 @@
- \ No newline at end of file +