* ============LICENSE_START=======================================================\r
* VID\r
* ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.\r
+ * Modifications Copyright (C) 2019 IBM.\r
* ================================================================================\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
\r
appDS2.requires.push('ui.tree');\r
\r
- 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) {\r
+ 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) {\r
$scope.popup = new Object();\r
$scope.defaultBaseUrl = "";\r
$scope.responseTimeoutMsec = 60000;\r
$scope.properties = UtilityService.getProperties();\r
$scope.resumeStatus = COMPONENT.RESUME_STATUS;\r
//isPermitted - returned as string from url and converted into boolean\r
- $scope.isPermitted = $location.search().isPermitted == "true";\r
+ $scope.isPermitted = $location.search().isPermitted === "true";\r
$scope.STATUS_CONSTANTS = FIELD.STATUS;\r
$scope.pnfs = [];// PNF data init;\r
$scope.collectionResource = {};\r
// takes a default value, retrieves the prop value from the file system and sets it\r
var polls = PropertyService.retrieveMsoMaxPolls();\r
PropertyService.setMsoMaxPolls(polls);\r
+ };\r
\r
- PropertyService.setServerResponseTimeoutMsec(30000);\r
-\r
- /*\r
- * Common parameters that shows an example of how the view edit screen\r
- * is expected to pass some common service instance values to the\r
- * popups.\r
- */\r
-\r
-// DataService.setSubscriberName("Mobility");\r
-// DataService.setGlobalCustomerId("CUSTID12345")\r
-// DataService.setServiceType("Mobility Type 1");\r
-// DataService.setServiceInstanceName("Example Service Instance Name");\r
-// DataService.setServiceName("Mobility Service 1");\r
-// DataService.setServiceInstanceId("mmsc-test-service-instance");\r
-// DataService.setServiceUuid("XXXX-YYYY-ZZZZ");\r
-// DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME");\r
-\r
- }\r
-\r
- //PropertyService.setMsoBaseUrl("testmso");\r
\r
$scope.convertModel = function (asdcModel) {\r
if (!asdcModel) return undefined;\r
};\r
\r
\r
- $scope.isCR = !_.isEmpty($scope.service.model.collectionResource) && featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_COLLECTION_RESOURCE_SUPPORT);\r
+ $scope.isCR = !_.isEmpty($scope.service.model.collectionResources);\r
if ($scope.isCR)\r
prepareCr();\r
else\r
\r
}\r
return null;\r
- }\r
+ };\r
$scope.hasVfModules = function (vnfInstance) {\r
if ($scope.returnVfModules(vnfInstance) != null) {\r
return true;\r
}\r
return false;\r
- }\r
+ };\r
$scope.returnVolumeGroups = function (vnfInstance) {\r
\r
var svcModel = $scope.service.convertedModel;\r
\r
}\r
return null;\r
- }\r
+ };\r
$scope.hasVolumeGroups = function (vnfInstance) {\r
if ($scope.returnVolumeGroups(vnfInstance) != null) {\r
return true;\r
}\r
return false;\r
- }\r
+ };\r
$scope.deleteNetwork = function (serviceObject, network) {\r
\r
console.log("Removing Network " + network.name);\r
});\r
};\r
\r
+ $scope.allowTransferToNewScreenAndShowButton = function (){\r
+ if(featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT)) {\r
+ return $scope.isPermitted;\r
+ }\r
+ return false;\r
+ };\r
+\r
+ $scope.navigateToNewEditViewScreen = function(){\r
+ window.location.href = 'serviceModels.htm#/servicePlanning/EDIT?' +\r
+ 'serviceModelId=' + _.get($scope, 'service.model.service.uuid') +\r
+ '&subscriberId=' + $location.search().subscriberId +\r
+ '&serviceType=' + $location.search().serviceType +\r
+ '&serviceInstanceId=' + $location.search().serviceInstanceId;\r
+ };\r
+\r
$scope.deleteService = function (serviceObject, serviceOrchestrationStatus) {\r
\r
var serviceInstance = serviceObject.object;\r
DataService.setServiceUuid($scope.service.model.service.uuid);\r
}\r
\r
- $scope.deleteVfModule = function (serviceObject, vfModule, vnf) {\r
+ var modalInstance;\r
\r
- console.log("Removing VF-Module " + vfModule.name);\r
+ var openMsoModal = function (msoType, requestParams, callbackFunction, configuration) {\r
+ modalInstance = $uibModal.open({\r
+ templateUrl: 'app/vid/scripts/modals/mso-commit/mso-commit.html',\r
+ controller: "msoCommitModalController",\r
+ backdrop: false,\r
+ resolve: {\r
+ msoType: function () {\r
+ return msoType;\r
+ },\r
+ requestParams: function () {\r
+ requestParams.callbackFunction = callbackFunction;\r
+ return requestParams;\r
+ },\r
+ configuration: function () {\r
+ return configuration;\r
+ }\r
+ }\r
+ });\r
+ };\r
\r
- populate_popup_vfModule(serviceObject, vfModule, vnf);\r
+ var openVfModuleWithHomingDataModal = function(action, vfModule) {\r
+ modalInstance = $uibModal.open({\r
+ controller: 'vfModuleActionModalController',\r
+ templateUrl: 'app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html',\r
+ backdrop: false,\r
+ resolve: {\r
+ action: function () {\r
+ return action;\r
+ },\r
+ vfModule: function() {\r
+ return vfModule;\r
+ }\r
+ }\r
+ });\r
\r
- $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {\r
- componentId: COMPONENT.VF_MODULE,\r
- callbackFunction: deleteOrResumeCallback,\r
- dialogMethod: COMPONENT.DELETE\r
+ modalInstance.result.then(function (data) {\r
+ if (data.msoType && data.requestParams) {\r
+ openMsoModal(data.msoType, data.requestParams, deleteOrResumeCallback, null);\r
+ }\r
});\r
+ };\r
\r
- return;\r
+ function getLcpCloudRegionTenantList() {\r
+ AaiService.getLcpCloudRegionTenantList(DataService\r
+ .getGlobalCustomerId(), DataService.getServiceType(), function(\r
+ response) {\r
+ $scope.lcpAndTenant = response;\r
+ $scope.isFeatureFlagCloudOwner = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST);\r
+ $scope.lcpRegionList = _.uniqBy(response, 'cloudRegionId');\r
+ });\r
+ }\r
+\r
+ $scope.deleteVfModule = function (serviceObject, vfModule, vnf) {\r
+ $scope.isSoftDeleteEnabled = true;\r
\r
+ populate_popup_vfModule(serviceObject, vfModule, vnf);\r
+\r
+ if (DataService.getLoggedInUserId()) {\r
+ openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule);\r
+ }\r
+ else {\r
+ AaiService.getLoggedInUserID(function (response) {\r
+ var userID = response.data;\r
+ DataService.setLoggedInUserId(userID);\r
+ openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule);\r
+ });\r
+ }\r
+ console.log("Removing VF-Module", vfModule);\r
};\r
\r
function setCurrentServiceModelInfoFromScope() {\r
\r
//Display popup with additional VF-Module information\r
DataService.setVfModuleInstanceId(vfModule[FIELD.ID.VF_MODULE_ID]);\r
- DataService.setInventoryItem(vfModule)\r
+ DataService.setInventoryItem(vfModule);\r
\r
DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);\r
DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);\r
var isVfc = false;\r
\r
_.map($scope.service.model.vnfs, function (value, key) {\r
- if (value.uuid == vnf.uuid) {\r
- if (!_.isEmpty(value.vfcInstanceGroups)) {\r
+ if (value.uuid == vnf.uuid && !_.isEmpty(value.vfcInstanceGroups)) {\r
isVfc = true;\r
var queryData = {\r
serviceModelId: $scope.service.model.service.uuid,\r
$scope.$broadcast(COMPONENT.IFRAME_DIALOG, queryData);\r
return;\r
}\r
- }\r
});\r
\r
DataService.setSubscriberName($scope.service.instance.subscriberName);\r
$scope.resume = function (serviceObject, vfModule, vnfModel) {\r
populate_popup_vfModule(serviceObject, vfModule, vnfModel);\r
setCurrentVNFModelInfo(vnfModel);\r
+\r
+ var availableVolumeGroupList = [];\r
+ angular.forEach(vfModule.volumeGroups, function (volumeGroupInstance, key) {\r
+ availableVolumeGroupList.push({"instance": volumeGroupInstance});\r
+ });\r
+\r
+ DataService.setAvailableVolumeGroupList(availableVolumeGroupList);\r
+\r
DataService.setVfModuleInstanceName(vfModule.object[FIELD.ID.VF_MODULE_NAME]);\r
setCurrentServiceModelInfoFromScope();\r
- $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {\r
- componentId: COMPONENT.VF_MODULE,\r
- callbackFunction: deleteOrResumeCallback,\r
- dialogMethod: COMPONENT.RESUME\r
- });\r
+\r
+ if (DataService.getLoggedInUserId()) {\r
+ openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule);\r
+ }\r
+ else {\r
+ AaiService.getLoggedInUserID(function (response) {\r
+ var userID = response.data;\r
+ DataService.setLoggedInUserId(userID);\r
+ openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule);\r
+ });\r
+ }\r
};\r
\r
$scope.deleteConfiguration = function (serviceObject, configuration) {\r
\r
var deleteCallbackFunction = function () {\r
console.log('hi')\r
- }\r
+ };\r
\r
$scope.resetProgress = function () {\r
$scope.percentProgress = 0;\r
else {\r
return true;\r
}\r
- }\r
+ };\r
$scope.isMacro = function () {\r
return $scope.service && AsdcService.isMacro($scope.service.model);\r
- }\r
+ };\r
$scope.reloadRoute = function () {\r
$route.reload();\r
- }\r
+ };\r
\r
\r
/*\r
function _setPnf(data) { // data is the $scope.service.instance object\r
return PnfService.getPnfs(data)\r
.then(\r
- function success(response) {\r
+ function (response) {\r
return response.data;\r
// * can add here changes on the data that are needed to the view ( filter, ect..)\r
},\r
- function error(error) {\r
+ function (error) {\r
console.error(error);\r
}\r
);\r
function _setCr(data) { // data is the $scope.service.instance object\r
return CrService.getCr(data)\r
.then(\r
- function success(response) {\r
+ function (response) {\r
return response.data.results;\r
// * can add here changes on the data that are needed to the view ( filter, ect..)\r
},\r
- function error(error) {\r
+ function (error) {\r
console.error(error);\r
}\r
);\r
+ FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;\r
if (response.isSuccessful) {\r
color = FIELD.ID.COLOR_8F8;\r
- $location.path(COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH)\r
+ $location.path(COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH);\r
} else {\r
color = FIELD.ID.COLOR_F88;\r
}\r