Commit 3ba310dff0b15ef5fde824f7a7fd82ed51014801
Committed by
Igor Kulikov
1 parent
168f0d64
Fix didn't disable timewindow button (#2312)
* Add support import label * Fix didn't disable timewindow button
Showing
1 changed file
with
8 additions
and
2 deletions
@@ -212,7 +212,7 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM | @@ -212,7 +212,7 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM | ||
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | - scope.isTimewindowDisabled = function () { | 215 | + function isTimewindowDisabled () { |
216 | return scope.disabled || (!scope.isEdit && scope.model.hideInterval && scope.model.hideAggregation && scope.model.hideAggInterval); | 216 | return scope.disabled || (!scope.isEdit && scope.model.hideInterval && scope.model.hideAggregation && scope.model.hideAggInterval); |
217 | } | 217 | } |
218 | 218 | ||
@@ -247,10 +247,16 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM | @@ -247,10 +247,16 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM | ||
247 | model.hideAggregation = value.hideAggregation; | 247 | model.hideAggregation = value.hideAggregation; |
248 | model.hideAggInterval = value.hideAggInterval; | 248 | model.hideAggInterval = value.hideAggInterval; |
249 | } | 249 | } |
250 | - scope.timewindowDisabled = scope.isTimewindowDisabled(); | 250 | + scope.timewindowDisabled = isTimewindowDisabled(); |
251 | scope.updateDisplayValue(); | 251 | scope.updateDisplayValue(); |
252 | }; | 252 | }; |
253 | 253 | ||
254 | + scope.$watchGroup(['disabled', 'isEdit'], function(newValue, oldValue) { | ||
255 | + if (!angular.equals(newValue, oldValue)) { | ||
256 | + scope.timewindowDisabled = isTimewindowDisabled(); | ||
257 | + } | ||
258 | + }); | ||
259 | + | ||
254 | $compile(element.contents())(scope); | 260 | $compile(element.contents())(scope); |
255 | } | 261 | } |
256 | 262 |