Commit 6afef792f453cb494b37336797d7929002e210be
Committed by
Igor Kulikov
1 parent
36a14702
Fix data key to alarm widget (#1978)
Showing
2 changed files
with
6 additions
and
4 deletions
@@ -215,10 +215,11 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc | @@ -215,10 +215,11 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc | ||
215 | w.triggerHandler('resize'); | 215 | w.triggerHandler('resize'); |
216 | } | 216 | } |
217 | }).then(function (newDataKey) { | 217 | }).then(function (newDataKey) { |
218 | - let index = scope.dataKeys.indexOf(dataKey); | ||
219 | if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) { | 218 | if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) { |
219 | + let index = scope.dataKeys.indexOf(dataKey); | ||
220 | scope.dataKeys[index] = newDataKey; | 220 | scope.dataKeys[index] = newDataKey; |
221 | } else if (newDataKey.type === types.dataKeyType.alarm) { | 221 | } else if (newDataKey.type === types.dataKeyType.alarm) { |
222 | + let index = scope.alarmDataKeys.indexOf(dataKey); | ||
222 | scope.alarmDataKeys[index] = newDataKey; | 223 | scope.alarmDataKeys[index] = newDataKey; |
223 | } | 224 | } |
224 | ngModelCtrl.$setDirty(); | 225 | ngModelCtrl.$setDirty(); |
@@ -183,10 +183,11 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document, | @@ -183,10 +183,11 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document, | ||
183 | w.triggerHandler('resize'); | 183 | w.triggerHandler('resize'); |
184 | } | 184 | } |
185 | }).then(function (newDataKey) { | 185 | }).then(function (newDataKey) { |
186 | - let index = scope.funcDataKeys.indexOf(dataKey); | ||
187 | - if (newDataKey.type === types.dataKeyType.function) { | ||
188 | - scope.funcDataKeys[index] = newDataKey; | 186 | + if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) { |
187 | + let index = scope.dataKeys.indexOf(dataKey); | ||
188 | + scope.dataKeys[index] = newDataKey; | ||
189 | } else if (newDataKey.type === types.dataKeyType.alarm) { | 189 | } else if (newDataKey.type === types.dataKeyType.alarm) { |
190 | + let index = scope.alarmDataKeys.indexOf(dataKey); | ||
190 | scope.alarmDataKeys[index] = newDataKey; | 191 | scope.alarmDataKeys[index] = newDataKey; |
191 | } | 192 | } |
192 | ngModelCtrl.$setDirty(); | 193 | ngModelCtrl.$setDirty(); |