From a93c8e25bac71379dd345547a48daf8ec99a4dee Mon Sep 17 00:00:00 2001 From: Chantsova Ekaterina Date: Mon, 23 Dec 2019 17:35:49 +0200 Subject: [PATCH] Hide timewindow when all options are hidden (#2287) * Hide timewindow when all options are hidden * Disable timewindow button when all options hidden --- ui/src/app/components/timewindow-button.tpl.html | 2 +- ui/src/app/components/timewindow.directive.js | 7 ++++++- ui/src/app/components/timewindow.tpl.html | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/src/app/components/timewindow-button.tpl.html b/ui/src/app/components/timewindow-button.tpl.html index 6edf9c76a0..5549fd35e6 100644 --- a/ui/src/app/components/timewindow-button.tpl.html +++ b/ui/src/app/components/timewindow-button.tpl.html @@ -15,7 +15,7 @@ limitations under the License. --> - + {{model.displayValue}} \ No newline at end of file diff --git a/ui/src/app/components/timewindow.directive.js b/ui/src/app/components/timewindow.directive.js index 0d06de8679..991a3838ff 100644 --- a/ui/src/app/components/timewindow.directive.js +++ b/ui/src/app/components/timewindow.directive.js @@ -97,7 +97,7 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM element.html(template); scope.openEditMode = function (event) { - if (scope.disabled) { + if (scope.timewindowDisabled) { return; } var position; @@ -212,6 +212,10 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM } } + scope.isTimewindowDisabled = function () { + return scope.disabled || (!scope.isEdit && scope.model.hideInterval && scope.model.hideAggregation && scope.model.hideAggInterval); + } + ngModelCtrl.$render = function () { scope.model = timeService.defaultTimewindow(); if (ngModelCtrl.$viewValue) { @@ -243,6 +247,7 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM model.hideAggregation = value.hideAggregation; model.hideAggInterval = value.hideAggInterval; } + scope.timewindowDisabled = scope.isTimewindowDisabled(); scope.updateDisplayValue(); }; diff --git a/ui/src/app/components/timewindow.tpl.html b/ui/src/app/components/timewindow.tpl.html index 0e0475b9cd..2889addd5a 100644 --- a/ui/src/app/components/timewindow.tpl.html +++ b/ui/src/app/components/timewindow.tpl.html @@ -16,7 +16,7 @@ -->
- + {{ 'timewindow.edit' | translate }} @@ -28,7 +28,7 @@ {{model.displayValue}} - + {{ 'timewindow.edit' | translate }}