From 317f329e56c1ccbcd28e4ffdb29424a8cbbd3ebf Mon Sep 17 00:00:00 2001 From: Viswanath KSP Date: Sun, 4 Sep 2016 14:13:22 +0530 Subject: [PATCH] [onos-5204] This commit contains fix for bug onos-5204 Addressed review comments Addressed review comments - take2 Change-Id: I9eb1e19f70deffd33d57cdab6bb0346bd2ebbd98 --- .../main/webapp/app/view/intent/intent.html | 4 ++-- .../src/main/webapp/app/view/intent/intent.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/web/gui/src/main/webapp/app/view/intent/intent.html b/web/gui/src/main/webapp/app/view/intent/intent.html index a32f8f455b..9c025f66ca 100644 --- a/web/gui/src/main/webapp/app/view/intent/intent.html +++ b/web/gui/src/main/webapp/app/view/intent/intent.html @@ -32,10 +32,10 @@ tooltip tt-msg="topoTip" ng-click="showIntent()"> -
+ ng-click="(!!selId && isIntentInstalled()) ? deactivateIntent():''"> diff --git a/web/gui/src/main/webapp/app/view/intent/intent.js b/web/gui/src/main/webapp/app/view/intent/intent.js index b033dd3df9..f241c83025 100644 --- a/web/gui/src/main/webapp/app/view/intent/intent.js +++ b/web/gui/src/main/webapp/app/view/intent/intent.js @@ -35,6 +35,8 @@ $scope.briefTip = 'Switch to brief view'; $scope.detailTip = 'Switch to detailed view'; $scope.brief = true; + $scope.intentState = 'NA'; + $scope.fired = false; function selCb($event, row) { $log.debug('Got a click on:', row); @@ -47,12 +49,24 @@ appName: name, key: row.key } : null; + + $scope.intentState = row.state; + } + + function respCb() { + if ($scope.fired) { + if ($scope.changedData) { + $scope.intentState = $scope.changedData.state; + } + $scope.fired = false; + } } tbs.buildTable({ scope: $scope, tag: 'intent', selCb: selCb, + respCb: respCb, idKey: 'key' }); @@ -64,6 +78,10 @@ d && ns.navTo('topo', d); }; + $scope.isIntentInstalled = function () { + return $scope.intentState === 'Installed'; + }; + $scope.deactivateIntent = function () { var content = ds.createDiv(); @@ -73,6 +91,7 @@ function dOk() { var d = $scope.intentData; d && tts.removeIntent(d); + $scope.fired = true; } function dCancel() {