Committed by
Gerrit Code Review
[onos-5204] This commit contains fix for bug onos-5204
Addressed review comments Addressed review comments - take2 Change-Id: I9eb1e19f70deffd33d57cdab6bb0346bd2ebbd98
Showing
2 changed files
with
21 additions
and
2 deletions
... | @@ -32,10 +32,10 @@ | ... | @@ -32,10 +32,10 @@ |
32 | tooltip tt-msg="topoTip" | 32 | tooltip tt-msg="topoTip" |
33 | ng-click="showIntent()"></div> | 33 | ng-click="showIntent()"></div> |
34 | 34 | ||
35 | - <div ng-class="{'active': !!selId}" | 35 | + <div ng-class="{'active': !!selId && isIntentInstalled()}" |
36 | icon icon-id="stop" icon-size="42" | 36 | icon icon-id="stop" icon-size="42" |
37 | tooltip tt-msg="deactivateTip" | 37 | tooltip tt-msg="deactivateTip" |
38 | - ng-click="deactivateIntent()"></div> | 38 | + ng-click="(!!selId && isIntentInstalled()) ? deactivateIntent():''"></div> |
39 | 39 | ||
40 | 40 | ||
41 | </div> | 41 | </div> | ... | ... |
... | @@ -35,6 +35,8 @@ | ... | @@ -35,6 +35,8 @@ |
35 | $scope.briefTip = 'Switch to brief view'; | 35 | $scope.briefTip = 'Switch to brief view'; |
36 | $scope.detailTip = 'Switch to detailed view'; | 36 | $scope.detailTip = 'Switch to detailed view'; |
37 | $scope.brief = true; | 37 | $scope.brief = true; |
38 | + $scope.intentState = 'NA'; | ||
39 | + $scope.fired = false; | ||
38 | 40 | ||
39 | function selCb($event, row) { | 41 | function selCb($event, row) { |
40 | $log.debug('Got a click on:', row); | 42 | $log.debug('Got a click on:', row); |
... | @@ -47,12 +49,24 @@ | ... | @@ -47,12 +49,24 @@ |
47 | appName: name, | 49 | appName: name, |
48 | key: row.key | 50 | key: row.key |
49 | } : null; | 51 | } : null; |
52 | + | ||
53 | + $scope.intentState = row.state; | ||
54 | + } | ||
55 | + | ||
56 | + function respCb() { | ||
57 | + if ($scope.fired) { | ||
58 | + if ($scope.changedData) { | ||
59 | + $scope.intentState = $scope.changedData.state; | ||
60 | + } | ||
61 | + $scope.fired = false; | ||
62 | + } | ||
50 | } | 63 | } |
51 | 64 | ||
52 | tbs.buildTable({ | 65 | tbs.buildTable({ |
53 | scope: $scope, | 66 | scope: $scope, |
54 | tag: 'intent', | 67 | tag: 'intent', |
55 | selCb: selCb, | 68 | selCb: selCb, |
69 | + respCb: respCb, | ||
56 | idKey: 'key' | 70 | idKey: 'key' |
57 | }); | 71 | }); |
58 | 72 | ||
... | @@ -64,6 +78,10 @@ | ... | @@ -64,6 +78,10 @@ |
64 | d && ns.navTo('topo', d); | 78 | d && ns.navTo('topo', d); |
65 | }; | 79 | }; |
66 | 80 | ||
81 | + $scope.isIntentInstalled = function () { | ||
82 | + return $scope.intentState === 'Installed'; | ||
83 | + }; | ||
84 | + | ||
67 | $scope.deactivateIntent = function () { | 85 | $scope.deactivateIntent = function () { |
68 | var content = ds.createDiv(); | 86 | var content = ds.createDiv(); |
69 | 87 | ||
... | @@ -73,6 +91,7 @@ | ... | @@ -73,6 +91,7 @@ |
73 | function dOk() { | 91 | function dOk() { |
74 | var d = $scope.intentData; | 92 | var d = $scope.intentData; |
75 | d && tts.removeIntent(d); | 93 | d && tts.removeIntent(d); |
94 | + $scope.fired = true; | ||
76 | } | 95 | } |
77 | 96 | ||
78 | function dCancel() { | 97 | function dCancel() { | ... | ... |
-
Please register or login to post a comment