ONOS-2060: Add strong discouragement message if trying to deactivate or uninstall drivers.

Change-Id: I94b168738f3dbf5d692165cadf954ba9fffc5ae6
This commit is contained in:
Simon Hunt 2016-01-12 17:34:23 -08:00
parent e8402dabfa
commit 3f92c43f74
2 changed files with 30 additions and 9 deletions

View File

@ -41,6 +41,18 @@
color: #c55; color: #c55;
} }
#app-dialog p.strong {
font-weight: bold;
}
.light #app-dialog p.strong {
color: red;
background-color: #ff0;
}
.dark #app-dialog p.strong {
color: #c55;
background-color: #dd4;
}
.light #app-dialog.floatpanel.dialog { .light #app-dialog.floatpanel.dialog {
background-color: #fff; background-color: #fff;

View File

@ -29,7 +29,12 @@
dialogId = 'app-dialog', dialogId = 'app-dialog',
dialogOpts = { dialogOpts = {
edge: 'right' edge: 'right'
}; },
strongWarning = {
'org.onosproject.drivers': true
},
discouragement = 'Deactivating or uninstalling this component can' +
' have serious negative consequences! Do so at your own risk!!';
angular.module('ovApp', []) angular.module('ovApp', [])
.controller('OvAppCtrl', .controller('OvAppCtrl',
@ -45,9 +50,10 @@
$scope.uninstallTip = 'Uninstall selected application'; $scope.uninstallTip = 'Uninstall selected application';
function selCb($event, row) { function selCb($event, row) {
// selId comes from tableBuilder // $scope.selId is set by code in tableBuilder
$scope.ctrlBtnState.selection = !!$scope.selId; $scope.ctrlBtnState.selection = !!$scope.selId;
refreshCtrls(); refreshCtrls();
ds.closeDialog(); // don't want dialog from previous selection
} }
function refreshCtrls() { function refreshCtrls() {
@ -87,33 +93,36 @@
]); ]);
function createConfirmationText(action, sid) { function createConfirmationText(action, itemId) {
var content = ds.createDiv(); var content = ds.createDiv();
content.append('p').text(action + ' ' + sid); content.append('p').text(action + ' ' + itemId);
if (strongWarning[itemId]) {
content.append('p').text(discouragement).classed('strong', true);
}
return content; return content;
} }
function confirmAction(action) { function confirmAction(action) {
var sid = $scope.selId, var itemId = $scope.selId,
spar = $scope.sortParams; spar = $scope.sortParams;
function dOk() { function dOk() {
$log.debug('Initiating', action, 'of', sid); $log.debug('Initiating', action, 'of', itemId);
wss.sendEvent(appMgmtReq, { wss.sendEvent(appMgmtReq, {
action: action, action: action,
name: sid, name: itemId,
sortCol: spar.sortCol, sortCol: spar.sortCol,
sortDir: spar.sortDir sortDir: spar.sortDir
}); });
} }
function dCancel() { function dCancel() {
$log.debug('Canceling', action, 'of', sid); $log.debug('Canceling', action, 'of', itemId);
} }
ds.openDialog(dialogId, dialogOpts) ds.openDialog(dialogId, dialogOpts)
.setTitle('Confirm Action') .setTitle('Confirm Action')
.addContent(createConfirmationText(action, sid)) .addContent(createConfirmationText(action, itemId))
.addButton('OK', dOk) .addButton('OK', dOk)
.addButton('Cancel', dCancel); .addButton('Cancel', dCancel);
} }