ONOS-2074, ONOS-2075 - GUI -- App View Control Button state and icon bug fixes.
Change-Id: Icdaf5ca57963c6e4f30618cb6468c980ac3a786d
Showing
3 changed files
with
18 additions
and
21 deletions
... | @@ -72,8 +72,11 @@ | ... | @@ -72,8 +72,11 @@ |
72 | iconSize: '@' | 72 | iconSize: '@' |
73 | }, | 73 | }, |
74 | link: function (scope, element, attrs) { | 74 | link: function (scope, element, attrs) { |
75 | - is.loadEmbeddedIcon(d3.select(element[0]), | 75 | + attrs.$observe('iconId', function () { |
76 | - scope.iconId, scope.iconSize); | 76 | + var div = d3.select(element[0]); |
77 | + div.selectAll('*').remove(); | ||
78 | + is.loadEmbeddedIcon(div, scope.iconId, scope.iconSize); | ||
79 | + }); | ||
77 | } | 80 | } |
78 | }; | 81 | }; |
79 | }]) | 82 | }]) | ... | ... |
... | @@ -56,7 +56,7 @@ | ... | @@ -56,7 +56,7 @@ |
56 | </td> | 56 | </td> |
57 | </tr> | 57 | </tr> |
58 | 58 | ||
59 | - <tr ng-repeat="app in tableData track by app.id" | 59 | + <tr ng-repeat="app in tableData" |
60 | ng-click="selectCallback($event, app)" | 60 | ng-click="selectCallback($event, app)" |
61 | ng-class="{selected: app.id === selId}" | 61 | ng-class="{selected: app.id === selId}" |
62 | ng-repeat-done> | 62 | ng-repeat-done> | ... | ... |
... | @@ -33,7 +33,6 @@ | ... | @@ -33,7 +33,6 @@ |
33 | 'FnService', 'TableBuilderService', 'WebSocketService', 'UrlFnService', | 33 | 'FnService', 'TableBuilderService', 'WebSocketService', 'UrlFnService', |
34 | 34 | ||
35 | function ($log, $scope, $http, fs, tbs, wss, ufs) { | 35 | function ($log, $scope, $http, fs, tbs, wss, ufs) { |
36 | - var refreshCtrls; | ||
37 | $scope.ctrlBtnState = {}; | 36 | $scope.ctrlBtnState = {}; |
38 | 37 | ||
39 | function selCb($event, row) { | 38 | function selCb($event, row) { |
... | @@ -41,28 +40,28 @@ | ... | @@ -41,28 +40,28 @@ |
41 | $scope.ctrlBtnState.selection = !!$scope.selId; | 40 | $scope.ctrlBtnState.selection = !!$scope.selId; |
42 | $log.debug('Got a click on:', row); | 41 | $log.debug('Got a click on:', row); |
43 | 42 | ||
44 | - refreshCtrls = function () { | 43 | + refreshCtrls(); |
44 | + } | ||
45 | + | ||
46 | + function refreshCtrls() { | ||
47 | + var row, rowIdx; | ||
45 | if ($scope.ctrlBtnState.selection) { | 48 | if ($scope.ctrlBtnState.selection) { |
46 | - $scope.ctrlBtnState.installed = row.state === INSTALLED; | 49 | + rowIdx = fs.find($scope.selId, $scope.tableData); |
47 | - $scope.ctrlBtnState.active = row.state === ACTIVE; | 50 | + row = rowIdx >= 0 ? $scope.tableData[rowIdx] : null; |
51 | + | ||
52 | + $scope.ctrlBtnState.installed = row && row.state === INSTALLED; | ||
53 | + $scope.ctrlBtnState.active = row && row.state === ACTIVE; | ||
48 | } else { | 54 | } else { |
49 | $scope.ctrlBtnState.installed = false; | 55 | $scope.ctrlBtnState.installed = false; |
50 | $scope.ctrlBtnState.active = false; | 56 | $scope.ctrlBtnState.active = false; |
51 | } | 57 | } |
52 | - }; | ||
53 | - | ||
54 | - refreshCtrls(); | ||
55 | - } | ||
56 | - | ||
57 | - function respCb() { | ||
58 | - refreshCtrls && refreshCtrls(); | ||
59 | } | 58 | } |
60 | 59 | ||
61 | tbs.buildTable({ | 60 | tbs.buildTable({ |
62 | scope: $scope, | 61 | scope: $scope, |
63 | tag: 'app', | 62 | tag: 'app', |
64 | selCb: selCb, | 63 | selCb: selCb, |
65 | - respCb: respCb | 64 | + respCb: refreshCtrls |
66 | }); | 65 | }); |
67 | 66 | ||
68 | $scope.appAction = function (action) { | 67 | $scope.appAction = function (action) { |
... | @@ -85,14 +84,9 @@ | ... | @@ -85,14 +84,9 @@ |
85 | 'Content-Type': undefined | 84 | 'Content-Type': undefined |
86 | } | 85 | } |
87 | }) | 86 | }) |
88 | - // TODO: look for finally function to combine lines | 87 | + .finally(function () { |
89 | - // TODO: reexamine reset input value | ||
90 | - .success(function () { | ||
91 | $scope.sortCallback($scope.sortParams); | 88 | $scope.sortCallback($scope.sortParams); |
92 | document.getElementById('inputFileForm').reset(); | 89 | document.getElementById('inputFileForm').reset(); |
93 | - }) | ||
94 | - .error(function () { | ||
95 | - $scope.sortCallback($scope.sortParams); | ||
96 | }); | 90 | }); |
97 | } | 91 | } |
98 | }); | 92 | }); | ... | ... |
-
Please register or login to post a comment