From d350d5ac25c8df2846e4f0d9082cb4d364a17a83 Mon Sep 17 00:00:00 2001 From: "Sonsino, Ofir (os0695)" Date: Mon, 6 Aug 2018 16:14:59 +0300 Subject: UI Feature flagging support Change-Id: Ic2151dab6306c42364483e9064c01bab3dd7378b Issue-ID: VID-208 Signed-off-by: Sonsino, Ofir (os0695) --- .../controller/change-management.controller.js | 103 ++++++++++++++------- 1 file changed, 71 insertions(+), 32 deletions(-) (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js index 488ada69..e15ce5fd 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js @@ -8,6 +8,7 @@ vm.lastTimeUpdated = ""; vm.hasScheduler = !!VIDCONFIGURATION.SCHEDULER_PORTAL_URL; + vm.currModal = null; vm.init = function() { vm.lastTimeUpdated = $filter('date')(new Date(), "MM/dd/yyyy | HH:mm:ss"); @@ -15,11 +16,31 @@ loadSchedulerChangeManagements(); }; + var fuseMsoAndSchedulerTaks = function() { + if (vm.changeManagements && vm.pendingChangeManagements) { + var requestIdToVnfName = {} + vm.pendingChangeManagements.forEach(function(schedulerItem) { + if (schedulerItem.msoRequestId && schedulerItem.vnfName) { + requestIdToVnfName[schedulerItem.msoRequestId] = schedulerItem.vnfName; + } + }) + $log.debug("requestIdToVnfName", requestIdToVnfName); + + vm.changeManagements = vm.changeManagements.map(function(msoItem) { + msoItem['vnfNameFromScheduler'] = requestIdToVnfName[msoItem.requestId]; + return msoItem; + }) + } + }; + var loadMSOChangeManagements = function() { changeManagementService.getMSOChangeManagements() .then(function(response) { vm.changeManagements = response.data; }) + .then(function () { + fuseMsoAndSchedulerTaks(); + }) .catch(function (error) { $log.error(error); }); @@ -43,12 +64,16 @@ } }); }) + .then(function () { + fuseMsoAndSchedulerTaks(); + }) .catch(function(error) { $log.error(error); }); }; vm.createNewChange = function() { + vm.closeCurrentModalIfOpen(); var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/new-change-management/new-change-management.html', controller: 'newChangeManagementModalController', @@ -56,6 +81,8 @@ resolve: {} }); + vm.currModal = modalInstance; + modalInstance.result.then(function (result) { console.log("This is the result of the new change management modal.", result); }); @@ -65,29 +92,18 @@ console.log("function for searching changes: " + vm.searchChangesTerm) }; - vm.openFailedModal = function(jobInfo) { - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/failed-change-management/failed-change-management.html', - controller: 'changeManagementManualTasksController', - controllerAs: 'vm', - resolve: { - jobInfo: function () { - return jobInfo; - } - }, - }); + vm.openManualTasksPopup = function($event, jobInfo, templateUrl, message) { - modalInstance.result.then(function (result) { - console.log("This is the result of the failed change management modal.", result); - }); - }; + vm.closeCurrentModalIfOpen(); - vm.openInProgressModal = function(jobInfo) { var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html', + templateUrl: templateUrl, controller: 'changeManagementManualTasksController', controllerAs: 'vm', + backdrop: false, + animation: true, + appendTo: angular.element($event.currentTarget).parent(), resolve: { jobInfo: function () { return jobInfo; @@ -96,31 +112,38 @@ }); modalInstance.result.then(function (result) { - console.log("This is the result of the in progress change management modal.", result); + console.log(message, result); }); + + vm.currModal = modalInstance; }; - vm.openAlertModal = function(jobInfo) { - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/alert-change-management/alert-change-management.html', - controller: 'changeManagementManualTasksController', - controllerAs: 'vm', - resolve: { - jobInfo: function () { - return jobInfo; - } - } - }); + vm.openFailedModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/failed-change-management/failed-change-management.html', + "This is the result of the failed change management modal.") + }; - modalInstance.result.then(function (result) { - console.log("This is the result of the alert change management modal.", result); - }); + vm.openInProgressModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html', + "This is the result of the in progress change management modal.") + }; + + vm.openAlertModal = function($event, jobInfo) { + vm.openManualTasksPopup($event, jobInfo, + 'app/vid/scripts/modals/alert-change-management/alert-change-management.html', + "This is the result of the alert change management modal.") }; + vm.openBasicAlertModal = function(jobInfo) { + vm.closeCurrentModalIfOpen(); var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/alert-modal/alert-modal.html', controller: 'alertModalController', controllerAs: 'vm', + backdrop: false, + animation: true, appendTo: angular.element(".jobs-table").eq(0), resolve: { jobInfo: function () { @@ -128,12 +151,16 @@ } } }); + vm.currModal = modalInstance; modalInstance.result.then(function (result) { console.log("This is the result of the alert change management modal.", result); }); }; vm.openPendingModal = function($event, changeManagement) { + + vm.closeCurrentModalIfOpen(); + var modalInstance = $uibModal.open({ templateUrl: 'app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html', controller: 'cancelPendingWorkflowController', @@ -148,6 +175,8 @@ } }); + vm.currModal = modalInstance; + modalInstance.result.then(function (result) { // send to service if(result){ @@ -173,6 +202,16 @@ }}); }; + vm.isChangeManagementDeleted = function(changeManagement) { + return changeManagement.scheduleRequest.status!=='Deleted' + }; + + vm.closeCurrentModalIfOpen = function() { + if (vm.currModal != null) { + vm.currModal.close(); + vm.currModal = null; + } + } vm.init(); -- cgit 1.2.3-korg