From 6afef792f453cb494b37336797d7929002e210be Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Mon, 9 Sep 2019 11:57:39 +0300 Subject: [PATCH] Fix data key to alarm widget (#1978) --- ui/src/app/components/datasource-entity.directive.js | 3 ++- ui/src/app/components/datasource-func.directive.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/app/components/datasource-entity.directive.js b/ui/src/app/components/datasource-entity.directive.js index 3b1dd19844..afde04e2d2 100644 --- a/ui/src/app/components/datasource-entity.directive.js +++ b/ui/src/app/components/datasource-entity.directive.js @@ -215,10 +215,11 @@ function DatasourceEntity($compile, $templateCache, $q, $mdDialog, $window, $doc w.triggerHandler('resize'); } }).then(function (newDataKey) { - let index = scope.dataKeys.indexOf(dataKey); if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) { + let index = scope.dataKeys.indexOf(dataKey); scope.dataKeys[index] = newDataKey; } else if (newDataKey.type === types.dataKeyType.alarm) { + let index = scope.alarmDataKeys.indexOf(dataKey); scope.alarmDataKeys[index] = newDataKey; } ngModelCtrl.$setDirty(); diff --git a/ui/src/app/components/datasource-func.directive.js b/ui/src/app/components/datasource-func.directive.js index b305eeedcc..91d43f5bb6 100644 --- a/ui/src/app/components/datasource-func.directive.js +++ b/ui/src/app/components/datasource-func.directive.js @@ -183,10 +183,11 @@ function DatasourceFunc($compile, $templateCache, $mdDialog, $window, $document, w.triggerHandler('resize'); } }).then(function (newDataKey) { - let index = scope.funcDataKeys.indexOf(dataKey); - if (newDataKey.type === types.dataKeyType.function) { - scope.funcDataKeys[index] = newDataKey; + if ((newDataKey.type === types.dataKeyType.timeseries) || (newDataKey.type === types.dataKeyType.attribute)) { + let index = scope.dataKeys.indexOf(dataKey); + scope.dataKeys[index] = newDataKey; } else if (newDataKey.type === types.dataKeyType.alarm) { + let index = scope.alarmDataKeys.indexOf(dataKey); scope.alarmDataKeys[index] = newDataKey; } ngModelCtrl.$setDirty();