From c3b674515f7d7e77789b232420178ae66a1ad5e3 Mon Sep 17 00:00:00 2001 From: Evgeny Smyshlyaev Date: Wed, 5 Feb 2020 01:04:53 +0300 Subject: [PATCH] Do not disable Apply button when unit is in LEARNING state #401 (#402) --- src/panel/graph_panel/graph_ctrl.ts | 17 +++++++++++- .../partials/analytic_units_5.x.html | 2 +- .../partials/analytic_units_6.x.html | 2 +- .../partials/relearning_confirmation.html | 27 +++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/panel/graph_panel/partials/relearning_confirmation.html diff --git a/src/panel/graph_panel/graph_ctrl.ts b/src/panel/graph_panel/graph_ctrl.ts index bf2dce5..84680fb 100644 --- a/src/panel/graph_panel/graph_ctrl.ts +++ b/src/panel/graph_panel/graph_ctrl.ts @@ -629,7 +629,22 @@ class GraphCtrl extends MetricsPanelCtrl { this.analyticsController.redetectAll(from, to); } - async runDetectInCurrentRange(analyticUnit: AnalyticUnit) { + async runDetectInCurrentRange(analyticUnit: AnalyticUnit): Promise { + if(analyticUnit.status === 'LEARNING') { + let modalScope = this.$scope.$new(true); + modalScope.confirm = async () => { + await this._runDetectInCurrentRange(analyticUnit); + }; + appEvents.emit('show-modal', { + src: `${this.partialsPath}/relearning_confirmation.html`, + scope: modalScope + }); + } else { + await this._runDetectInCurrentRange(analyticUnit); + } + } + + async _runDetectInCurrentRange(analyticUnit: AnalyticUnit): Promise { const { from, to } = this.rangeTimestamp; if(analyticUnit.changed) { diff --git a/src/panel/graph_panel/partials/analytic_units_5.x.html b/src/panel/graph_panel/partials/analytic_units_5.x.html index 54187ad..0034579 100644 --- a/src/panel/graph_panel/partials/analytic_units_5.x.html +++ b/src/panel/graph_panel/partials/analytic_units_5.x.html @@ -126,7 +126,7 @@