Fix for ONOS-5406
Change-Id: I932e8efc3cb09b021316950a3104c62fe29e1dbc
diff --git a/web/gui/src/main/webapp/app/view/intent/intent.js b/web/gui/src/main/webapp/app/view/intent/intent.js
index 71c07cf..324f389 100644
--- a/web/gui/src/main/webapp/app/view/intent/intent.js
+++ b/web/gui/src/main/webapp/app/view/intent/intent.js
@@ -74,6 +74,7 @@
$scope.resubmitTip = 'Resubmit selected intent';
$scope.deactivateTip = 'Remove selected intent';
$scope.purgeTip = 'Purge selected intent';
+ $scope.purgeAllTip = 'Purge withdrawn intents';
$scope.showIntent = function () {
var d = $scope.intentData;
@@ -88,6 +89,16 @@
return $scope.intentState === 'Withdrawn';
};
+ $scope.isHavingWithdrawn = function () {
+ var isWithdrawn = false;
+ $scope.tableData.forEach(function (intent) {
+ if (intent.state ==='Withdrawn') {
+ isWithdrawn = true;
+ }
+ });
+ return isWithdrawn;
+ };
+
function executeAction(action) {
var content = ds.createDiv(),
txt,
@@ -119,6 +130,29 @@
.addCancel(dCancel)
.bindKeys();
}
+ function executeActions(action) {
+ var content = ds.createDiv(),
+ txt='purgeIntents';
+ content.append('p').
+ text('Are you sure you want to purge all the withdrawn intents?');
+
+ function dOk() {
+ tts.removeIntents();
+ $scope.fired = true;
+ }
+
+ function dCancel() {
+ ds.closeDialog();
+ $log.debug('Canceling remove-intents action');
+ }
+
+ ds.openDialog(dialogId, dialogOpts)
+ .setTitle('Confirm Action')
+ .addContent(content)
+ .addOk(dOk)
+ .addCancel(dCancel)
+ .bindKeys();
+ }
$scope.deactivateIntent = function () {
executeAction("withdraw");
@@ -141,6 +175,9 @@
$log.debug('OvIntentCtrl has been destroyed');
});
+ $scope.purgeIntents = function () {
+ executeActions("purgeIntents");
+ };
$log.debug('OvIntentCtrl has been created');
}]);
}());