ONOS-2060: Add strong discouragement message if trying to deactivate or uninstall drivers.
Change-Id: I94b168738f3dbf5d692165cadf954ba9fffc5ae6
Showing
2 changed files
with
30 additions
and
9 deletions
| ... | @@ -41,6 +41,18 @@ | ... | @@ -41,6 +41,18 @@ |
| 41 | color: #c55; | 41 | color: #c55; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | +#app-dialog p.strong { | ||
| 45 | + font-weight: bold; | ||
| 46 | +} | ||
| 47 | +.light #app-dialog p.strong { | ||
| 48 | + color: red; | ||
| 49 | + background-color: #ff0; | ||
| 50 | +} | ||
| 51 | +.dark #app-dialog p.strong { | ||
| 52 | + color: #c55; | ||
| 53 | + background-color: #dd4; | ||
| 54 | +} | ||
| 55 | + | ||
| 44 | 56 | ||
| 45 | .light #app-dialog.floatpanel.dialog { | 57 | .light #app-dialog.floatpanel.dialog { |
| 46 | background-color: #fff; | 58 | background-color: #fff; | ... | ... |
| ... | @@ -29,7 +29,12 @@ | ... | @@ -29,7 +29,12 @@ |
| 29 | dialogId = 'app-dialog', | 29 | dialogId = 'app-dialog', |
| 30 | dialogOpts = { | 30 | dialogOpts = { |
| 31 | edge: 'right' | 31 | edge: 'right' |
| 32 | - }; | 32 | + }, |
| 33 | + strongWarning = { | ||
| 34 | + 'org.onosproject.drivers': true | ||
| 35 | + }, | ||
| 36 | + discouragement = 'Deactivating or uninstalling this component can' + | ||
| 37 | + ' have serious negative consequences! Do so at your own risk!!'; | ||
| 33 | 38 | ||
| 34 | angular.module('ovApp', []) | 39 | angular.module('ovApp', []) |
| 35 | .controller('OvAppCtrl', | 40 | .controller('OvAppCtrl', |
| ... | @@ -45,9 +50,10 @@ | ... | @@ -45,9 +50,10 @@ |
| 45 | $scope.uninstallTip = 'Uninstall selected application'; | 50 | $scope.uninstallTip = 'Uninstall selected application'; |
| 46 | 51 | ||
| 47 | function selCb($event, row) { | 52 | function selCb($event, row) { |
| 48 | - // selId comes from tableBuilder | 53 | + // $scope.selId is set by code in tableBuilder |
| 49 | $scope.ctrlBtnState.selection = !!$scope.selId; | 54 | $scope.ctrlBtnState.selection = !!$scope.selId; |
| 50 | refreshCtrls(); | 55 | refreshCtrls(); |
| 56 | + ds.closeDialog(); // don't want dialog from previous selection | ||
| 51 | } | 57 | } |
| 52 | 58 | ||
| 53 | function refreshCtrls() { | 59 | function refreshCtrls() { |
| ... | @@ -87,33 +93,36 @@ | ... | @@ -87,33 +93,36 @@ |
| 87 | ]); | 93 | ]); |
| 88 | 94 | ||
| 89 | 95 | ||
| 90 | - function createConfirmationText(action, sid) { | 96 | + function createConfirmationText(action, itemId) { |
| 91 | var content = ds.createDiv(); | 97 | var content = ds.createDiv(); |
| 92 | - content.append('p').text(action + ' ' + sid); | 98 | + content.append('p').text(action + ' ' + itemId); |
| 99 | + if (strongWarning[itemId]) { | ||
| 100 | + content.append('p').text(discouragement).classed('strong', true); | ||
| 101 | + } | ||
| 93 | return content; | 102 | return content; |
| 94 | } | 103 | } |
| 95 | 104 | ||
| 96 | function confirmAction(action) { | 105 | function confirmAction(action) { |
| 97 | - var sid = $scope.selId, | 106 | + var itemId = $scope.selId, |
| 98 | spar = $scope.sortParams; | 107 | spar = $scope.sortParams; |
| 99 | 108 | ||
| 100 | function dOk() { | 109 | function dOk() { |
| 101 | - $log.debug('Initiating', action, 'of', sid); | 110 | + $log.debug('Initiating', action, 'of', itemId); |
| 102 | wss.sendEvent(appMgmtReq, { | 111 | wss.sendEvent(appMgmtReq, { |
| 103 | action: action, | 112 | action: action, |
| 104 | - name: sid, | 113 | + name: itemId, |
| 105 | sortCol: spar.sortCol, | 114 | sortCol: spar.sortCol, |
| 106 | sortDir: spar.sortDir | 115 | sortDir: spar.sortDir |
| 107 | }); | 116 | }); |
| 108 | } | 117 | } |
| 109 | 118 | ||
| 110 | function dCancel() { | 119 | function dCancel() { |
| 111 | - $log.debug('Canceling', action, 'of', sid); | 120 | + $log.debug('Canceling', action, 'of', itemId); |
| 112 | } | 121 | } |
| 113 | 122 | ||
| 114 | ds.openDialog(dialogId, dialogOpts) | 123 | ds.openDialog(dialogId, dialogOpts) |
| 115 | .setTitle('Confirm Action') | 124 | .setTitle('Confirm Action') |
| 116 | - .addContent(createConfirmationText(action, sid)) | 125 | + .addContent(createConfirmationText(action, itemId)) |
| 117 | .addButton('OK', dOk) | 126 | .addButton('OK', dOk) |
| 118 | .addButton('Cancel', dCancel); | 127 | .addButton('Cancel', dCancel); |
| 119 | } | 128 | } | ... | ... |
-
Please register or login to post a comment