From 655bfeed443afe82318267fe880256cfdb8fbb2e Mon Sep 17 00:00:00 2001 From: rozetko Date: Tue, 26 Feb 2019 21:14:41 +0300 Subject: [PATCH] labeled / deleted segments -> positive / negative #196 (#197) - rename labeled / deleted segments to positive / negative - fix to show Grafana version in Hastic Info tab - minor UI fixes --- .../controllers/analytic_controller.ts | 13 ++++++--- src/panel/graph_panel/graph_ctrl.ts | 6 +++- .../graph_panel/partials/help_section.html | 3 +- .../graph_panel/partials/tab_analytics.html | 28 +++++++++++-------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/panel/graph_panel/controllers/analytic_controller.ts b/src/panel/graph_panel/controllers/analytic_controller.ts index 3f60b65..285f1f8 100644 --- a/src/panel/graph_panel/controllers/analytic_controller.ts +++ b/src/panel/graph_panel/controllers/analytic_controller.ts @@ -140,6 +140,7 @@ export class AnalyticController { await this.disableLabeling(); this._selectedAnalyticUnitId = id; this.labelingUnit.selected = true; + this.toggleLabelingMode(LabelingMode.LABELING); this.toggleVisibility(id, true); } @@ -189,6 +190,10 @@ export class AnalyticController { return this.labelingUnit.labelingMode; } + set labelingMode(labelingMode: LabelingMode) { + this.labelingUnit.labelingMode = labelingMode; + } + addLabelSegment(segment: Segment, deleted = false) { const asegment = this.labelingUnit.addLabeledSegment(segment, deleted); this._labelingDataAddedSegments.addSegment(asegment); @@ -337,14 +342,14 @@ export class AnalyticController { this._labelingDataAddedSegments.removeInRange(from, to); } - toggleLabelingMode(mode: LabelingMode) { + toggleLabelingMode(labelingMode: LabelingMode) { if(!this.inLabelingMode) { - throw new Error(`Can't enter ${mode} mode when labeling mode is disabled`); + throw new Error(`Can't enter ${labelingMode} mode when labeling mode is disabled`); } - if(this.labelingUnit.labelingMode === mode) { + if(this.labelingUnit.labelingMode === labelingMode) { this.labelingUnit.labelingMode = LabelingMode.LABELING; } else { - this.labelingUnit.labelingMode = mode; + this.labelingUnit.labelingMode = labelingMode; } } diff --git a/src/panel/graph_panel/graph_ctrl.ts b/src/panel/graph_panel/graph_ctrl.ts index 6ad9072..719487f 100644 --- a/src/panel/graph_panel/graph_ctrl.ts +++ b/src/panel/graph_panel/graph_ctrl.ts @@ -659,8 +659,12 @@ class GraphCtrl extends MetricsPanelCtrl { const datasource = await this._getDatasourceByName(this.panel.datasource); const backendUrl = await this.getBackendURL(); + let grafanaVersion = 'unknown'; + if(_.has(window, 'grafanaBootData.settings.buildInfo.version')) { + grafanaVersion = window.grafanaBootData.settings.buildInfo.version; + } this._panelInfo = { - grafanaVersion: this.contextSrv.version, + grafanaVersion, grafanaUrl: window.location.host, datasourceType: datasource.type, hasticServerUrl: backendUrl diff --git a/src/panel/graph_panel/partials/help_section.html b/src/panel/graph_panel/partials/help_section.html index 4b1dd26..64dc52e 100644 --- a/src/panel/graph_panel/partials/help_section.html +++ b/src/panel/graph_panel/partials/help_section.html @@ -1,6 +1,5 @@
-  For usage instructions:
-  Visit our Wiki page.
+  For usage instructions: Visit our Wiki page.
   
   If you encounter any problems:
   Look for solution or create a new Issue here.
diff --git a/src/panel/graph_panel/partials/tab_analytics.html b/src/panel/graph_panel/partials/tab_analytics.html
index 5846c38..b52dbd2 100644
--- a/src/panel/graph_panel/partials/tab_analytics.html
+++ b/src/panel/graph_panel/partials/tab_analytics.html
@@ -23,7 +23,7 @@
 
       
       
- + Type
-