From 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 31 Dec 2018 17:21:27 +0200 Subject: Merge from ECOMP's repository Main Features -------------- - Async-Instantiation jobs mechanism major update; still WIP (package `org.onap.vid.job`) - New features in View/Edit: Activate fabric configuration; show related networks; soft delete - Support AAI service-tree traversal (`AAIServiceTree`) - In-memory cache for SDC models and certain A&AI queries (`CacheProviderWithLoadingCache`) - Upgrade TOSCA Parser and add parsing options; fix malformed TOSCA models - Resolve Cloud-Owner values for MSO - Pass X-ONAP headers to MSO Infrastructure -------------- - Remove codehaus' jackson mapper; use soley fasterxml 2.9.7 - Surefire invokes both TestNG and JUnit tests - Support Kotlin source files - AaiController2 which handles errors in a "Spring manner" - Inline generated-sources and remove jsonschema2pojo Quality -------- - Cumulative bug fixes (A&AI API, UI timeouts, and many more) - Many Sonar issues cleaned-up - Some unused classes removed - Minor changes in vid-automation project, allowing some API verification to run Hard Merges ------------ - HTTP Clients (MSO, A&AI, WebConfig, OutgoingRequestHeadersTest) - Moved `package org.onap.vid.controllers` to `controller`, without plural -- just to keep semantic sync with ECOMP. Reference commit in ECOMP: 3d1141625 Issue-ID: VID-378 Change-Id: I9c8d1e74caa41815891d441fc0760bb5f29c5788 Signed-off-by: Ittay Stern --- .../scripts/controller/InstantiationController.js | 131 +++++++++++++++------ 1 file changed, 97 insertions(+), 34 deletions(-) (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js index 1b3ab09ca..06622cfbc 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js @@ -27,7 +27,7 @@ appDS2.requires.push('ui.tree'); - appDS2.controller("InstantiationController", function ($scope, $route, $location, $timeout, COMPONENT, VIDCONFIGURATION, FIELD, DataService, PropertyService, UtilityService, VnfService, $http, vidService, AaiService, PnfService, CrService, AsdcService, $q, featureFlags, _, CreationService, $window) { + appDS2.controller("InstantiationController", function ($scope, $route, $location, $timeout, $uibModal, COMPONENT, VIDCONFIGURATION, FIELD, DataService, PropertyService, UtilityService, VnfService, $http, vidService, AaiService, PnfService, CrService, AsdcService, $q, featureFlags, _, CreationService, $window, DeleteResumeService) { $scope.popup = new Object(); $scope.defaultBaseUrl = ""; $scope.responseTimeoutMsec = 60000; @@ -53,27 +53,8 @@ // takes a default value, retrieves the prop value from the file system and sets it var polls = PropertyService.retrieveMsoMaxPolls(); PropertyService.setMsoMaxPolls(polls); + }; - PropertyService.setServerResponseTimeoutMsec(30000); - - /* - * Common parameters that shows an example of how the view edit screen - * is expected to pass some common service instance values to the - * popups. - */ - -// DataService.setSubscriberName("Mobility"); -// DataService.setGlobalCustomerId("CUSTID12345") -// DataService.setServiceType("Mobility Type 1"); -// DataService.setServiceInstanceName("Example Service Instance Name"); -// DataService.setServiceName("Mobility Service 1"); -// DataService.setServiceInstanceId("mmsc-test-service-instance"); -// DataService.setServiceUuid("XXXX-YYYY-ZZZZ"); -// DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - } - - //PropertyService.setMsoBaseUrl("testmso"); $scope.convertModel = function (asdcModel) { if (!asdcModel) return undefined; @@ -305,20 +286,86 @@ DataService.setServiceUuid($scope.service.model.service.uuid); } - $scope.deleteVfModule = function (serviceObject, vfModule, vnf) { + var modalInstance; - console.log("Removing VF-Module " + vfModule.name); + var openMsoModal = function (msoType, requestParams, callbackFunction, configuration) { + modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/mso-commit/mso-commit.html', + controller: "msoCommitModalController", + backdrop: false, + resolve: { + msoType: function () { + return msoType; + }, + requestParams: function () { + requestParams.callbackFunction = callbackFunction; + return requestParams; + }, + configuration: function () { + return configuration; + } + } + }); + }; - populate_popup_vfModule(serviceObject, vfModule, vnf); + var openVfModuleWithHomingDataModal = function(action, vfModule) { + modalInstance = $uibModal.open({ + controller: 'vfModuleActionModalController', + templateUrl: 'app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html', + backdrop: false, + resolve: { + action: function () { + return action; + }, + vfModule: function() { + return vfModule; + } + } + }); - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId: COMPONENT.VF_MODULE, - callbackFunction: deleteOrResumeCallback, - dialogMethod: COMPONENT.DELETE + modalInstance.result.then(function (data) { + if (data.msoType && data.requestParams) { + openMsoModal(data.msoType, data.requestParams, deleteOrResumeCallback, null); + } }); + }; - return; + function getLcpCloudRegionTenantList() { + AaiService.getLcpCloudRegionTenantList(DataService + .getGlobalCustomerId(), DataService.getServiceType(), function( + response) { + $scope.lcpAndTenant = response; + $scope.isFeatureFlagCloudOwner = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST); + $scope.lcpRegionList = _.uniqBy(response, 'cloudRegionId'); + }); + } + $scope.deleteVfModule = function (serviceObject, vfModule, vnf) { + $scope.isSoftDeleteEnabled = true; + + populate_popup_vfModule(serviceObject, vfModule, vnf); + + if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE)) { + + if (DataService.getLoggedInUserId()) { + openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule); + } + else { + AaiService.getLoggedInUserID(function (response) { + var userID = response.data; + DataService.setLoggedInUserId(userID); + openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule); + }); + } + } + else { + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VF_MODULE, + callbackFunction: deleteOrResumeCallback, + dialogMethod: COMPONENT.DELETE + }); + } + console.log("Removing VF-Module", vfModule); }; function setCurrentServiceModelInfoFromScope() { @@ -1175,11 +1222,27 @@ setCurrentVNFModelInfo(vnfModel); DataService.setVfModuleInstanceName(vfModule.object[FIELD.ID.VF_MODULE_NAME]); setCurrentServiceModelInfoFromScope(); - $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { - componentId: COMPONENT.VF_MODULE, - callbackFunction: deleteOrResumeCallback, - dialogMethod: COMPONENT.RESUME - }); + + if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE)) { + + if (DataService.getLoggedInUserId()) { + openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule); + } + else { + AaiService.getLoggedInUserID(function (response) { + var userID = response.data; + DataService.setLoggedInUserId(userID); + openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule); + }); + } + } + else { + $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, { + componentId: COMPONENT.VF_MODULE, + callbackFunction: deleteOrResumeCallback, + dialogMethod: COMPONENT.RESUME + }); + } }; $scope.deleteConfiguration = function (serviceObject, configuration) { -- cgit 1.2.3-korg