GUI -- Refresh button has been moved to TableBuilderService to be part of every …
…tabular view automatically. Change-Id: I2de0ae9161573a2c44320dcd07111938a89ba5e2
Showing
10 changed files
with
31 additions
and
82 deletions
| ... | @@ -21,7 +21,7 @@ | ... | @@ -21,7 +21,7 @@ |
| 21 | 'use strict'; | 21 | 'use strict'; |
| 22 | 22 | ||
| 23 | // injected refs | 23 | // injected refs |
| 24 | - var $log, fs, wss; | 24 | + var $log, fs, wss, ts; |
| 25 | 25 | ||
| 26 | // example params to buildTable: | 26 | // example params to buildTable: |
| 27 | // { | 27 | // { |
| ... | @@ -61,6 +61,12 @@ | ... | @@ -61,6 +61,12 @@ |
| 61 | } | 61 | } |
| 62 | o.scope.selectCallback = selCb; | 62 | o.scope.selectCallback = selCb; |
| 63 | 63 | ||
| 64 | + function refresh() { | ||
| 65 | + $log.debug('Refreshing ' + root + ' page'); | ||
| 66 | + ts.resetSortIcons(); | ||
| 67 | + sortCb(); | ||
| 68 | + } | ||
| 69 | + o.scope.refresh = refresh; | ||
| 64 | 70 | ||
| 65 | handlers[resp] = respCb; | 71 | handlers[resp] = respCb; |
| 66 | wss.bindHandlers(handlers); | 72 | wss.bindHandlers(handlers); |
| ... | @@ -75,12 +81,13 @@ | ... | @@ -75,12 +81,13 @@ |
| 75 | 81 | ||
| 76 | angular.module('onosWidget') | 82 | angular.module('onosWidget') |
| 77 | .factory('TableBuilderService', | 83 | .factory('TableBuilderService', |
| 78 | - ['$log', 'FnService', 'WebSocketService', | 84 | + ['$log', 'FnService', 'WebSocketService', 'TableService', |
| 79 | 85 | ||
| 80 | - function (_$log_, _fs_, _wss_) { | 86 | + function (_$log_, _fs_, _wss_, _ts_) { |
| 81 | $log = _$log_; | 87 | $log = _$log_; |
| 82 | fs = _fs_; | 88 | fs = _fs_; |
| 83 | wss = _wss_; | 89 | wss = _wss_; |
| 90 | + ts = _ts_; | ||
| 84 | 91 | ||
| 85 | return { | 92 | return { |
| 86 | buildTable: buildTable | 93 | buildTable: buildTable | ... | ... |
| ... | @@ -25,9 +25,9 @@ | ... | @@ -25,9 +25,9 @@ |
| 25 | 25 | ||
| 26 | angular.module('ovApp', []) | 26 | angular.module('ovApp', []) |
| 27 | .controller('OvAppCtrl', | 27 | .controller('OvAppCtrl', |
| 28 | - ['$log', '$scope', 'TableService', 'TableBuilderService', 'WebSocketService', | 28 | + ['$log', '$scope', 'TableBuilderService', 'WebSocketService', |
| 29 | 29 | ||
| 30 | - function ($log, $scope, ts, tbs, wss) { | 30 | + function ($log, $scope, tbs, wss) { |
| 31 | function selCb($event, row) { | 31 | function selCb($event, row) { |
| 32 | selRow = angular.element($event.currentTarget); | 32 | selRow = angular.element($event.currentTarget); |
| 33 | selection = row; | 33 | selection = row; |
| ... | @@ -45,12 +45,6 @@ | ... | @@ -45,12 +45,6 @@ |
| 45 | document.getElementById('file').dispatchEvent(evt); | 45 | document.getElementById('file').dispatchEvent(evt); |
| 46 | }); | 46 | }); |
| 47 | 47 | ||
| 48 | - $scope.refresh = function () { | ||
| 49 | - $log.debug('Refreshing application page'); | ||
| 50 | - ts.resetSortIcons(); | ||
| 51 | - $scope.sortCallback(); | ||
| 52 | - }; | ||
| 53 | - | ||
| 54 | document.getElementById('app-form-response').onload = function () { | 48 | document.getElementById('app-form-response').onload = function () { |
| 55 | document.getElementById('app-form').reset(); | 49 | document.getElementById('app-form').reset(); |
| 56 | $scope.refresh(); | 50 | $scope.refresh(); | ... | ... |
| ... | @@ -23,20 +23,14 @@ | ... | @@ -23,20 +23,14 @@ |
| 23 | 23 | ||
| 24 | angular.module('ovCluster', []) | 24 | angular.module('ovCluster', []) |
| 25 | .controller('OvClusterCtrl', | 25 | .controller('OvClusterCtrl', |
| 26 | - ['$log', '$scope', 'TableService', 'TableBuilderService', | 26 | + ['$log', '$scope', 'TableBuilderService', |
| 27 | 27 | ||
| 28 | - function ($log, $scope, ts, tbs) { | 28 | + function ($log, $scope, tbs) { |
| 29 | tbs.buildTable({ | 29 | tbs.buildTable({ |
| 30 | scope: $scope, | 30 | scope: $scope, |
| 31 | tag: 'cluster' | 31 | tag: 'cluster' |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | - $scope.refresh = function () { | ||
| 35 | - $log.debug('Refreshing cluster nodes page'); | ||
| 36 | - ts.resetSortIcons(); | ||
| 37 | - $scope.sortCallback(); | ||
| 38 | - }; | ||
| 39 | - | ||
| 40 | $log.log('OvClusterCtrl has been created'); | 34 | $log.log('OvClusterCtrl has been created'); |
| 41 | }]); | 35 | }]); |
| 42 | }()); | 36 | }()); | ... | ... |
| ... | @@ -222,12 +222,12 @@ | ... | @@ -222,12 +222,12 @@ |
| 222 | 222 | ||
| 223 | angular.module('ovDevice', []) | 223 | angular.module('ovDevice', []) |
| 224 | .controller('OvDeviceCtrl', | 224 | .controller('OvDeviceCtrl', |
| 225 | - ['$log', '$scope', 'TableService', 'TableBuilderService', 'FnService', | 225 | + ['$log', '$scope', 'TableBuilderService', 'FnService', |
| 226 | 'MastService', 'PanelService', 'WebSocketService', 'IconService', | 226 | 'MastService', 'PanelService', 'WebSocketService', 'IconService', |
| 227 | 'ButtonService', 'NavService', 'TooltipService', | 227 | 'ButtonService', 'NavService', 'TooltipService', |
| 228 | 228 | ||
| 229 | function (_$log_, _$scope_, | 229 | function (_$log_, _$scope_, |
| 230 | - ts, tbs, _fs_, _mast_, _ps_, _wss_, _is_, _bns_, _ns_, _ttip_) { | 230 | + tbs, _fs_, _mast_, _ps_, _wss_, _is_, _bns_, _ns_, _ttip_) { |
| 231 | $log = _$log_; | 231 | $log = _$log_; |
| 232 | $scope = _$scope_; | 232 | $scope = _$scope_; |
| 233 | fs = _fs_; | 233 | fs = _fs_; |
| ... | @@ -260,12 +260,6 @@ | ... | @@ -260,12 +260,6 @@ |
| 260 | tag: 'device', | 260 | tag: 'device', |
| 261 | selCb: selCb | 261 | selCb: selCb |
| 262 | }); | 262 | }); |
| 263 | - | ||
| 264 | - $scope.refresh = function () { | ||
| 265 | - $log.debug('Refreshing devices page'); | ||
| 266 | - ts.resetSortIcons(); | ||
| 267 | - $scope.sortCallback(); | ||
| 268 | - }; | ||
| 269 | createDetailsPane(); | 263 | createDetailsPane(); |
| 270 | 264 | ||
| 271 | // details panel handlers | 265 | // details panel handlers | ... | ... |
| ... | @@ -22,20 +22,19 @@ | ... | @@ -22,20 +22,19 @@ |
| 22 | 'use strict'; | 22 | 'use strict'; |
| 23 | 23 | ||
| 24 | // injected references | 24 | // injected references |
| 25 | - var $log, $scope, $location, fs, ts, tbs; | 25 | + var $log, $scope, $location, fs, tbs; |
| 26 | 26 | ||
| 27 | angular.module('ovFlow', []) | 27 | angular.module('ovFlow', []) |
| 28 | .controller('OvFlowCtrl', | 28 | .controller('OvFlowCtrl', |
| 29 | ['$log', '$scope', '$location', | 29 | ['$log', '$scope', '$location', |
| 30 | - 'FnService', 'TableService', 'TableBuilderService', | 30 | + 'FnService', 'TableBuilderService', |
| 31 | 31 | ||
| 32 | - function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) { | 32 | + function (_$log_, _$scope_, _$location_, _fs_, _tbs_) { |
| 33 | var params; | 33 | var params; |
| 34 | $log = _$log_; | 34 | $log = _$log_; |
| 35 | $scope = _$scope_; | 35 | $scope = _$scope_; |
| 36 | $location = _$location_; | 36 | $location = _$location_; |
| 37 | fs = _fs_; | 37 | fs = _fs_; |
| 38 | - ts = _ts_; | ||
| 39 | tbs = _tbs_; | 38 | tbs = _tbs_; |
| 40 | 39 | ||
| 41 | params = $location.search(); | 40 | params = $location.search(); |
| ... | @@ -49,12 +48,6 @@ | ... | @@ -49,12 +48,6 @@ |
| 49 | query: params | 48 | query: params |
| 50 | }); | 49 | }); |
| 51 | 50 | ||
| 52 | - $scope.refresh = function () { | ||
| 53 | - $log.debug('Refreshing flows page'); | ||
| 54 | - ts.resetSortIcons(); | ||
| 55 | - $scope.sortCallback(); | ||
| 56 | - }; | ||
| 57 | - | ||
| 58 | $log.log('OvFlowCtrl has been created'); | 51 | $log.log('OvFlowCtrl has been created'); |
| 59 | }]); | 52 | }]); |
| 60 | }()); | 53 | }()); | ... | ... |
| ... | @@ -22,20 +22,19 @@ | ... | @@ -22,20 +22,19 @@ |
| 22 | 'use strict'; | 22 | 'use strict'; |
| 23 | 23 | ||
| 24 | // injected references | 24 | // injected references |
| 25 | - var $log, $scope, $location, fs, ts, tbs; | 25 | + var $log, $scope, $location, fs, tbs; |
| 26 | 26 | ||
| 27 | angular.module('ovGroup', []) | 27 | angular.module('ovGroup', []) |
| 28 | .controller('OvGroupCtrl', | 28 | .controller('OvGroupCtrl', |
| 29 | ['$log', '$scope', '$location', | 29 | ['$log', '$scope', '$location', |
| 30 | - 'FnService', 'TableService', 'TableBuilderService', | 30 | + 'FnService', 'TableBuilderService', |
| 31 | 31 | ||
| 32 | - function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) { | 32 | + function (_$log_, _$scope_, _$location_, _fs_, _tbs_) { |
| 33 | var params; | 33 | var params; |
| 34 | $log = _$log_; | 34 | $log = _$log_; |
| 35 | $scope = _$scope_; | 35 | $scope = _$scope_; |
| 36 | $location = _$location_; | 36 | $location = _$location_; |
| 37 | fs = _fs_; | 37 | fs = _fs_; |
| 38 | - ts = _ts_; | ||
| 39 | tbs = _tbs_; | 38 | tbs = _tbs_; |
| 40 | 39 | ||
| 41 | params = $location.search(); | 40 | params = $location.search(); |
| ... | @@ -49,12 +48,6 @@ | ... | @@ -49,12 +48,6 @@ |
| 49 | query: params | 48 | query: params |
| 50 | }); | 49 | }); |
| 51 | 50 | ||
| 52 | - $scope.refresh = function () { | ||
| 53 | - $log.debug('Refreshing groups page'); | ||
| 54 | - ts.resetSortIcons(); | ||
| 55 | - $scope.sortCallback(); | ||
| 56 | - }; | ||
| 57 | - | ||
| 58 | $log.log('OvGroupCtrl has been created'); | 51 | $log.log('OvGroupCtrl has been created'); |
| 59 | }]); | 52 | }]); |
| 60 | }()); | 53 | }()); | ... | ... |
| ... | @@ -23,20 +23,14 @@ | ... | @@ -23,20 +23,14 @@ |
| 23 | 23 | ||
| 24 | angular.module('ovHost', []) | 24 | angular.module('ovHost', []) |
| 25 | .controller('OvHostCtrl', | 25 | .controller('OvHostCtrl', |
| 26 | - ['$log', '$scope', 'TableService', 'TableBuilderService', | 26 | + ['$log', '$scope', 'TableBuilderService', |
| 27 | 27 | ||
| 28 | - function ($log, $scope, ts, tbs) { | 28 | + function ($log, $scope, tbs) { |
| 29 | tbs.buildTable({ | 29 | tbs.buildTable({ |
| 30 | scope: $scope, | 30 | scope: $scope, |
| 31 | tag: 'host' | 31 | tag: 'host' |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | - $scope.refresh = function () { | ||
| 35 | - $log.debug('Refreshing hosts page'); | ||
| 36 | - ts.resetSortIcons(); | ||
| 37 | - $scope.sortCallback(); | ||
| 38 | - }; | ||
| 39 | - | ||
| 40 | $log.log('OvHostCtrl has been created'); | 34 | $log.log('OvHostCtrl has been created'); |
| 41 | }]); | 35 | }]); |
| 42 | }()); | 36 | }()); | ... | ... |
| ... | @@ -23,20 +23,14 @@ | ... | @@ -23,20 +23,14 @@ |
| 23 | 23 | ||
| 24 | angular.module('ovIntent', []) | 24 | angular.module('ovIntent', []) |
| 25 | .controller('OvIntentCtrl', | 25 | .controller('OvIntentCtrl', |
| 26 | - ['$log', '$scope', 'TableService', 'TableBuilderService', | 26 | + ['$log', '$scope', 'TableBuilderService', |
| 27 | 27 | ||
| 28 | - function ($log, $scope, ts, tbs) { | 28 | + function ($log, $scope, tbs) { |
| 29 | tbs.buildTable({ | 29 | tbs.buildTable({ |
| 30 | scope: $scope, | 30 | scope: $scope, |
| 31 | tag: 'intent' | 31 | tag: 'intent' |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | - $scope.refresh = function () { | ||
| 35 | - $log.debug('Refreshing intents page'); | ||
| 36 | - ts.resetSortIcons(); | ||
| 37 | - $scope.sortCallback(); | ||
| 38 | - }; | ||
| 39 | - | ||
| 40 | $log.log('OvIntentCtrl has been created'); | 34 | $log.log('OvIntentCtrl has been created'); |
| 41 | }]); | 35 | }]); |
| 42 | }()); | 36 | }()); | ... | ... |
| ... | @@ -23,20 +23,14 @@ | ... | @@ -23,20 +23,14 @@ |
| 23 | 23 | ||
| 24 | angular.module('ovLink', []) | 24 | angular.module('ovLink', []) |
| 25 | .controller('OvLinkCtrl', | 25 | .controller('OvLinkCtrl', |
| 26 | - ['$log', '$scope', 'TableService', 'TableBuilderService', | 26 | + ['$log', '$scope', 'TableBuilderService', |
| 27 | 27 | ||
| 28 | - function ($log, $scope, ts, tbs) { | 28 | + function ($log, $scope, tbs) { |
| 29 | tbs.buildTable({ | 29 | tbs.buildTable({ |
| 30 | scope: $scope, | 30 | scope: $scope, |
| 31 | tag: 'link' | 31 | tag: 'link' |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | - $scope.refresh = function () { | ||
| 35 | - $log.debug('Refreshing links page'); | ||
| 36 | - ts.resetSortIcons(); | ||
| 37 | - $scope.sortCallback(); | ||
| 38 | - }; | ||
| 39 | - | ||
| 40 | $log.log('OvLinkCtrl has been created'); | 34 | $log.log('OvLinkCtrl has been created'); |
| 41 | }]); | 35 | }]); |
| 42 | }()); | 36 | }()); | ... | ... |
| ... | @@ -22,20 +22,18 @@ | ... | @@ -22,20 +22,18 @@ |
| 22 | 'use strict'; | 22 | 'use strict'; |
| 23 | 23 | ||
| 24 | // injected references | 24 | // injected references |
| 25 | - var $log, $scope, $location, fs, ts, tbs; | 25 | + var $log, $scope, $location, fs, tbs; |
| 26 | 26 | ||
| 27 | angular.module('ovPort', []) | 27 | angular.module('ovPort', []) |
| 28 | .controller('OvPortCtrl', | 28 | .controller('OvPortCtrl', |
| 29 | - ['$log', '$scope', '$location', | 29 | + ['$log', '$scope', '$location', 'FnService', 'TableBuilderService', |
| 30 | - 'FnService', 'TableService', 'TableBuilderService', | ||
| 31 | 30 | ||
| 32 | - function (_$log_, _$scope_, _$location_, _fs_, _ts_, _tbs_) { | 31 | + function (_$log_, _$scope_, _$location_, _fs_, _tbs_) { |
| 33 | var params; | 32 | var params; |
| 34 | $log = _$log_; | 33 | $log = _$log_; |
| 35 | $scope = _$scope_; | 34 | $scope = _$scope_; |
| 36 | $location = _$location_; | 35 | $location = _$location_; |
| 37 | fs = _fs_; | 36 | fs = _fs_; |
| 38 | - ts = _ts_; | ||
| 39 | tbs = _tbs_; | 37 | tbs = _tbs_; |
| 40 | 38 | ||
| 41 | params = $location.search(); | 39 | params = $location.search(); |
| ... | @@ -49,12 +47,6 @@ | ... | @@ -49,12 +47,6 @@ |
| 49 | query: params | 47 | query: params |
| 50 | }); | 48 | }); |
| 51 | 49 | ||
| 52 | - $scope.refresh = function () { | ||
| 53 | - $log.debug('Refreshing ports page'); | ||
| 54 | - ts.resetSortIcons(); | ||
| 55 | - $scope.sortCallback(); | ||
| 56 | - }; | ||
| 57 | - | ||
| 58 | $log.log('OvPortCtrl has been created'); | 50 | $log.log('OvPortCtrl has been created'); |
| 59 | }]); | 51 | }]); |
| 60 | }()); | 52 | }()); | ... | ... |
-
Please register or login to post a comment