Repository: eagle Updated Branches: refs/heads/master a260c9efe -> 2398c7b7e
[EAGLE-1039] recheck when policy init and keep origin setting https://issues.apache.org/jira/browse/EAGLE-1039 If a user wants to edit an existing policy, alert de-duplication info should be loaded from the database when he/she enters to that page. Author: zombieJ <[email protected]> Closes #949 from zombieJ/EAGLE-1039. Project: http://git-wip-us.apache.org/repos/asf/eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/2398c7b7 Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/2398c7b7 Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/2398c7b7 Branch: refs/heads/master Commit: 2398c7b7e6159f48468bacd468c02a51f6c13a6b Parents: a260c9e Author: zombieJ <[email protected]> Authored: Wed Jun 14 16:25:08 2017 +0800 Committer: zombieJ <[email protected]> Committed: Wed Jun 14 16:25:08 2017 +0800 ---------------------------------------------------------------------- .../app/dev/public/js/ctrls/alertEditCtrl.js | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/eagle/blob/2398c7b7/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js ---------------------------------------------------------------------- diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js index 0a64a42..9308554 100644 --- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js +++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertEditCtrl.js @@ -177,7 +177,7 @@ var checkPromise; $scope.definition = {}; $scope.definitionMessage = ""; - $scope.checkDefinition = function () { + $scope.checkDefinition = function (keepDefinition) { $timeout.cancel(checkPromise); checkPromise = $timeout(function () { Entity.post("metadata/policies/parse", $scope.policy.definition.value)._then(function (res) { @@ -201,9 +201,11 @@ }); // Partition - $scope.policy.partitionSpec = $.grep(data.policyExecutionPlan.streamPartitions, function (partition) { - return $.inArray(partition.streamId, outputStreams) === -1; - }); + if (keepDefinition !== true) { + $scope.policy.partitionSpec = $.grep(data.policyExecutionPlan.streamPartitions, function (partition) { + return $.inArray(partition.streamId, outputStreams) === -1; + }); + } var tempStreams = $.grep(inputStreams, function (i) { return $.inArray(i, outputStreams) > -1; @@ -214,13 +216,17 @@ outputStreams = common.array.remove(tempStream, outputStreams); }); - $scope.policy.outputStreams = outputStreams.concat(); - $scope.policy.inputStreams = inputStreams; + if (keepDefinition !== true) { + $scope.policy.outputStreams = outputStreams.concat(); + $scope.policy.inputStreams = inputStreams; + } $scope.outputStreams = outputStreams; autoDescription(); // Dedup fields - $scope.refreshOutputSteamFields(); + if (keepDefinition !== true) { + $scope.refreshOutputSteamFields(); + } } } else { $scope.definition = {}; @@ -230,6 +236,8 @@ }, 350); }; + $scope.checkDefinition(true); + // ============================================================== // = Output Stream = // ==============================================================
