summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/webapp
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main/webapp')
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties7
-rw-r--r--vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties5
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js3
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js49
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js8
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js822
6 files changed, 431 insertions, 463 deletions
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
index 0815accbb..2a0cb5b88 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/dev.features.properties
@@ -1,7 +1,5 @@
FLAG_ENABLE_WEBPACK_MODERN_UI = true
FLAG_ASYNC_JOBS = true
-CREATE_INSTANCE_TEST = false
-EMPTY_DRAWING_BOARD_TEST = false
FLAG_ADD_MSO_TESTAPI_FIELD = true
FLAG_UNASSIGN_SERVICE = true
FLAG_COLLECTION_RESOURCE_SUPPORT = true
@@ -10,11 +8,8 @@ FLAG_SERVICE_MODEL_CACHE = true
FLAG_SHOW_ASSIGNMENTS = true
FLAG_HANDLE_SO_WORKFLOWS = true
FLAG_CREATE_ERROR_REPORTS = true
-
FLAG_SHOW_VERIFY_SERVICE = true
FLAG_DUPLICATE_VNF = true
-FLAG_DEFAULT_VNF = true
-FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD = true
FLAG_RESTRICTED_SELECT = false
FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS = true
FLAG_A_LA_CARTE_AUDIT_INFO=true
@@ -27,7 +22,6 @@ FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF = true
FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI=false
FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST=true
FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY=true
-FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE = false
FLAG_1810_AAI_LOCAL_CACHE = true
FLAG_1902_NEW_VIEW_EDIT= false
FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER = false
@@ -38,3 +32,4 @@ FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG = false
FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE = false
FLAG_SHOW_ORCHESTRATION_TYPE = false
FLAG_1911_INSTANTIATION_ORDER_BUTTON_IN_ASYNC_ALACARTE = false
+FLAG_2002_ANY_ALACARTE_BESIDES_EXCLUDED_NEW_INSTANTIATION_UI = false
diff --git a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
index 709de9566..58f677abc 100644
--- a/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
+++ b/vid-app-common/src/main/webapp/WEB-INF/conf/onap.features.properties
@@ -1,6 +1,5 @@
FLAG_PNP_INSTANTIATION = true
-CREATE_INSTANCE_TEST = false
FLAG_ADD_MSO_TESTAPI_FIELD = true
FLAG_UNASSIGN_SERVICE = true
FLAG_SERVICE_MODEL_CACHE = true
@@ -10,7 +9,6 @@ FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS = true
FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS = true
FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST = true
FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY = true
-FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE = false
FLAG_1810_AAI_LOCAL_CACHE = true
FLAG_EXP_USE_DEFAULT_HOST_NAME_VERIFIER = false
FLAG_HANDLE_SO_WORKFLOWS = true
@@ -22,11 +20,8 @@ FLAG_SHOW_ORCHESTRATION_TYPE = false
FLAG_COLLECTION_RESOURCE_SUPPORT = false
FLAG_ENABLE_WEBPACK_MODERN_UI = false
FLAG_ASYNC_JOBS = false
-EMPTY_DRAWING_BOARD_TEST = false
FLAG_NETWORK_TO_ASYNC_INSTANTIATION = false
FLAG_DUPLICATE_VNF = false
-FLAG_DEFAULT_VNF = false
-FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD = false
FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF = false
FLAG_A_LA_CARTE_AUDIT_INFO = false
FLAG_5G_IN_NEW_INSTANTIATION_UI = false
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
index 3575c382d..9cdd5ceb9 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -197,6 +197,7 @@ appDS2
WELCOME_PATH: "welcome.htm",
IS_PERMITTED_SUB_PATH: "&isPermitted=",
SERVICE_POPUP_IFRAME_URL: "app/ui/#/servicePopup?serviceModelId=",
+ INSTANTIATION_TEMPLATES_IFRAME_URL: "app/ui/#/instantiationTemplatesPopup?serviceModelId=",
SUB_INTERFACE_POPUP_IFRAME_URL: "app/ui/#/vlan?",
VERIFY_SERVICE_URL: "rest/models/services/verifyService",
@@ -256,7 +257,6 @@ appDS2
FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS: "FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS",
FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST: "FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST",
FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY: "FLAG_1810_CR_LET_SELECTING_COLLECTOR_TYPE_UNCONDITIONALLY",
- FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE: "FLAG_1810_CR_SOFT_DELETE_ALACARTE_VF_MODULE",
FLAG_HANDLE_SO_WORKFLOWS: "FLAG_HANDLE_SO_WORKFLOWS",
FLAG_CREATE_ERROR_REPORTS: "FLAG_CREATE_ERROR_REPORTS",
FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH: "FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH",
@@ -265,6 +265,7 @@ appDS2
FLAG_FLASH_REPLACE_VF_MODULE: "FLAG_FLASH_REPLACE_VF_MODULE",
FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT: "FLAG_FLASH_MORE_ACTIONS_BUTTON_IN_OLD_VIEW_EDIT",
FLAG_SHOW_ORCHESTRATION_TYPE: "FLAG_SHOW_ORCHESTRATION_TYPE",
+ FLAG_2004_INSTANTIATION_TEMPLATES_POPUP : "FLAG_2004_INSTANTIATION_TEMPLATES_POPUP"
}
};
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 9037b99f4..673d2f6c4 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
@@ -358,24 +358,14 @@
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);
- });
- }
+ if (DataService.getLoggedInUserId()) {
+ openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule);
}
else {
- $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
- componentId: COMPONENT.VF_MODULE,
- callbackFunction: deleteOrResumeCallback,
- dialogMethod: COMPONENT.DELETE
+ AaiService.getLoggedInUserID(function (response) {
+ var userID = response.data;
+ DataService.setLoggedInUserId(userID);
+ openVfModuleWithHomingDataModal(COMPONENT.DELETE, vfModule);
});
}
console.log("Removing VF-Module", vfModule);
@@ -1013,8 +1003,7 @@
var isVfc = false;
_.map($scope.service.model.vnfs, function (value, key) {
- if (value.uuid == vnf.uuid) {
- if (!_.isEmpty(value.vfcInstanceGroups)) {
+ if (value.uuid == vnf.uuid && !_.isEmpty(value.vfcInstanceGroups)) {
isVfc = true;
var queryData = {
serviceModelId: $scope.service.model.service.uuid,
@@ -1030,7 +1019,6 @@
$scope.$broadcast(COMPONENT.IFRAME_DIALOG, queryData);
return;
}
- }
});
DataService.setSubscriberName($scope.service.instance.subscriberName);
@@ -1244,25 +1232,14 @@
DataService.setVfModuleInstanceName(vfModule.object[FIELD.ID.VF_MODULE_NAME]);
setCurrentServiceModelInfoFromScope();
- 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);
- });
- }
+ if (DataService.getLoggedInUserId()) {
+ openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule);
}
else {
- $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
- componentId: COMPONENT.VF_MODULE,
- volumeGroups: vfModule.volumeGroups,
- callbackFunction: deleteOrResumeCallback,
- dialogMethod: COMPONENT.RESUME
+ AaiService.getLoggedInUserID(function (response) {
+ var userID = response.data;
+ DataService.setLoggedInUserId(userID);
+ openVfModuleWithHomingDataModal(COMPONENT.RESUME, vfModule);
});
}
};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
index bf3d54af0..110f24ec6 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
@@ -489,8 +489,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
if (model && model.vnfs && !_.isEmpty(model.vnfs)) {
Object.keys(model.vnfs).forEach(function (key) {
var vnf = model.vnfs[key];
- if (vnf.vfcInstanceGroups && !_.isEmpty(vnf.vfcInstanceGroups)) {
- if (vnf.uuid === genericVnf.modelVersionId) {
+ if (vnf.vfcInstanceGroups && !_.isEmpty(vnf.vfcInstanceGroups) && vnf.uuid === genericVnf.modelVersionId) {
AaiService.getInstanceGroupsByVNFInstanceId(genericVnf.nodeId,
function (response) { //success
handleGetRelatedInstanceGroupsResponseForVnf(response, genericVnf);
@@ -502,7 +501,6 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
}
)
}
- }
});
}
}
@@ -797,11 +795,9 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER",
};
$scope.isShowAssignmentsEnabled = function () {
- if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ASSIGNMENTS)) {
- if ($scope.serviceOrchestrationStatus) {
+ if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ASSIGNMENTS) && $scope.serviceOrchestrationStatus) {
return $scope.serviceOrchestrationStatus.toLowerCase() === 'assigned';
}
- }
return false;
};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js
index 15627835e..a35411dd1 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js
@@ -1,409 +1,413 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-"use strict";
-
-var creationDialogController = function (COMPONENT, FIELD, PARAMETER, $scope, $http, $timeout, $log,
- CreationService, UtilityService, DataService, VIDCONFIGURATION, $location, $uibModal, featureFlags) {
-
- $scope.isDialogVisible = false;
- $scope.isServiceError = false;
- $scope.summaryControl = {};
- $scope.userProvidedControl = {};
-
-
- var callbackFunction = undefined;
- var componentId = undefined;
-
- $scope.showReportWindow = function() {
-
- let errorMsg;
-
- if($scope.error !== undefined && $scope.error != null) {
- errorMsg = $scope.error;
- } else {
- errorMsg = "";
- }
-
- const modalWindow = $uibModal.open({
- templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',
- controller: 'reportModalController',
- controllerAs: 'vm',
- resolve: {
- errorMsg: function () {
- return errorMsg;
- }
- }
- });
-
- $scope.isDialogVisible = false;
- $scope.popup.isVisible = false;
- };
-
- $scope.isShowErrorReport = function() {
- return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_CREATE_ERROR_REPORTS);
- };
-
- $scope.shouldShowOldPopup = function () {
- return !DataService.getShouldIncludeInAsyncInstantiationFlow();
- };
-
- function receiveMessage(event) {
- if (event.data == 'closeIframe') {
- window.removeEventListener("message", receiveMessage, false);
-
- $scope.cancel();
- }
- else if (event.data.eventId == 'submitIframe') {
- {
- $location.path('/servicePlanning').search({serviceModelId: event.data.data.serviceModelId});
- }
- }
- $scope.$apply();
- }
-
- $scope.$on(COMPONENT.CREATE_COMPONENT, function (event, request) {
- $scope.isSpinnerVisible = true;
- $scope.isErrorVisible = false;
- $scope.isDataVisible = false;
- $scope.isConfirmEnabled = false;
- $scope.isDialogVisible = true;
- $scope.popup.isVisible = true;
-
-
- if (!$scope.shouldShowOldPopup()) {
- $scope.url = COMPONENT.SERVICE_POPUP_IFRAME_URL + request.modelNameVersionId + "&isCreate=true&r=" + Math.random();
- window.addEventListener("message", receiveMessage, false);
-
- }
- else {
- callbackFunction = request.callbackFunction;
- componentId = request.componentId;
- CreationService.initializeComponent(request.componentId);
-
- CreationService.setHttpErrorHandler(function (response) {
- $scope.isServiceError = true;
- showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
- .getHttpErrorMessage(response));
- });
-
- $scope.componentName = CreationService.getComponentDisplayName();
-
- CreationService.getParameters(handleGetParametersResponse);
- }
-
- });
-
- var handleGetParametersResponse = function (parameters) {
- $scope.summaryControl.setList(parameters.summaryList);
- $scope.userProvidedControl.setList(parameters.userProvidedList);
-
- $scope.isSpinnerVisible = false;
- $scope.isDataVisible = true;
- $scope.isConfirmEnabled = true;
- };
-
- var validateInstanceName = function (iname) {
- var patt1 = /^([a-z])+([0-9a-z\-_\.]*)$/i;
-
- if (iname == null) {
- return false;
- }
- if (!iname.match(patt1)) {
- return false;
- }
- return true;
- };
- var validateMap = function (mname) {
- var patt1 = /^{(\s*\w+\s*:\s*\w+\s*)(\s*,\s*\w+\s*:\s*\w+\s*)*}$/im;
- if (mname == null) {
- return true;
- }
- if (!mname.match(patt1)) {
- return false;
- }
- return true;
- };
-
- var validateList = function (lname) {
- var patt1 = /^\[(\s*\w+\s*)(\s*,\s*\w+\s*)*\]$/i;
- if (lname == null) {
- return true;
- }
- if (!lname.match(patt1)) {
- return false;
- }
- return true;
- };
-
- $scope.userParameterChanged = function (id) {
- CreationService.updateUserParameterList(id, $scope.userProvidedControl);
- };
-
- $scope.confirm = function () {
-
- var requiredFields = $scope.userProvidedControl.getRequiredFields();
- if (requiredFields !== "") {
- showError(FIELD.ERROR.MISSING_DATA, requiredFields);
- return;
- }
-
- var isUploadAvailable = false;
- var uploadIndex = 0;
- var paramList = $scope.userProvidedControl.getList();
- var isAnyError = false;
- for (var i = 0; i < paramList.length; i++) {
- if (paramList[i].id === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
- isUploadAvailable = true;
- uploadIndex = i;
- }
- if (paramList[i].id === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE && paramList[i].value && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value == '') {
- isAnyError = true;
- }
- }
-
- if (isUploadAvailable && isAnyError) {
- showError(FIELD.ERROR.MISSING_DATA, FIELD.ERROR.MISSING_FILE);
-
- } else if (isUploadAvailable && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value != '') {
- var errorMsg = "";
- var fileInput = document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE);
- var file = fileInput.files[0];
- var reader = new FileReader();
- reader.onload = function (e) {
- try {
- paramList[uploadIndex].value = JSON.parse(reader.result);
- FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = paramList[uploadIndex].value;
-
- var instanceName = "";
-
- if (DataService.getALaCarte()) {
- if (paramList != null) {
- for (var i = 0; i < paramList.length; i++) {
- if (paramList[i].id === FIELD.ID.INSTANCE_NAME) {
- instanceName = paramList[i].value;
- break;
- }
- }
- }
- var isValid = validateInstanceName(instanceName);
- if (isValid) {
- $scope.isErrorVisible = false;
- } else {
- showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName,
- FIELD.ERROR.INSTANCE_NAME_VALIDATE);
- return;
- }
- }
- var arbitraryParametersList = DataService.getArbitraryParameters();
- var p = null;
- if (UtilityService.hasContents(arbitraryParametersList)) {
- for (var i = 0; i < arbitraryParametersList.length; i++) {
- p = arbitraryParametersList[i];
- if (p.type === PARAMETER.MAP) {
- //validate a map: { <entry_key_1>: <entry_value_1>, ... , <entry_key_n>: <entry_value_n> }
- // need to find the value in paramList
- for (var j = 0; j < paramList.length; j++) {
- if (paramList[j].id === p.id) {
- p.value = paramList[j].value;
- var isValid = validateMap(p.value);
- if (isValid) {
- $scope.isErrorVisible = false;
- break;
- }
- else {
- showError(FIELD.ERROR.INVALID_MAP + p.id,
- FIELD.ERROR.MAP_VALIDATE);
- return;
- }
- }
- }
- } else if (p.type === PARAMETER.LIST) {
- //validate a list: { value or a list of comma separated values }
- // need to find the value in paramList
- for (var j = 0; j < paramList.length; j++) {
- if (paramList[j].id === p.id) {
- p.value = paramList[j].value;
- var isValid = validateList(p.value);
- if (isValid) {
- $scope.isErrorVisible = false;
- break;
- }
- else {
- showError(FIELD.ERROR.INVALID_LIST + p.id,
- FIELD.ERROR.LIST_VALIDATE);
- return;
- }
- }
- }
- }
- }
- }
- var requestDetails = CreationService
- .getMsoRequestDetails($scope.userProvidedControl.getList());
-
- $scope.isDialogVisible = false;
-
- $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
- url: CreationService.getMsoUrl(),
- requestDetails: requestDetails,
- componentId: componentId,
- callbackFunction: function (response) {
- if (response.isSuccessful) {
- $scope.popup.isVisible = false;
- runCallback(response);
- } else {
- $scope.isDialogVisible = false;
- $scope.popup.isVisible = false;
- }
- }
- });
-
- } catch (e) {
- errorMsg = errorMsg + FIELD.ERROR.INVALID_DATA_FORMAT;
- }
- if (errorMsg !== "") {
- showError(FIELD.ERROR.SYSTEM_FAILURE, errorMsg);
-
- }
- };
- reader.readAsText(file);
- } else {
-
- var paramList = $scope.userProvidedControl.getList();
- var instanceName = "";
-
- if (DataService.getALaCarte()) {
- if (paramList != null) {
- for (var i = 0; i < paramList.length; i++) {
- if (paramList[i].id === FIELD.ID.INSTANCE_NAME) {
- instanceName = paramList[i].value;
- break;
- }
- }
- }
- var isValid = validateInstanceName(instanceName);
- if (isValid) {
- $scope.isErrorVisible = false;
- } else {
- showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName,
- FIELD.ERROR.INSTANCE_NAME_VALIDATE);
- return;
- }
- }
- var arbitraryParametersList = DataService.getArbitraryParameters();
- var p = null;
- if (UtilityService.hasContents(arbitraryParametersList)) {
- for (var i = 0; i < arbitraryParametersList.length; i++) {
- p = arbitraryParametersList[i];
- if (p.type === PARAMETER.MAP) {
- //validate a map: { <entry_key_1>: <entry_value_1>, ... , <entry_key_n>: <entry_value_n> }
- // need to find the value in paramList
- for (var j = 0; j < paramList.length; j++) {
- if (paramList[j].id === p.id) {
- p.value = paramList[j].value;
- var isValid = validateMap(p.value);
- if (isValid) {
- $scope.isErrorVisible = false;
- break;
- }
- else {
- showError(FIELD.ERROR.INVALID_MAP + p.id,
- FIELD.ERROR.MAP_VALIDATE);
- return;
- }
- }
- }
- } else if (p.type === PARAMETER.LIST) {
- //validate a list: { value or a list of comma separated values }
- // need to find the value in paramList
- for (var j = 0; j < paramList.length; j++) {
- if (paramList[j].id === p.id) {
- p.value = paramList[j].value;
- var isValid = validateList(p.value);
- if (isValid) {
- $scope.isErrorVisible = false;
- break;
- }
- else {
- showError(FIELD.ERROR.INVALID_LIST + p.id,
- FIELD.ERROR.LIST_VALIDATE);
- return;
- }
- }
- }
- }
- }
- }
- var requestDetails = CreationService
- .getMsoRequestDetails($scope.userProvidedControl.getList());
-
- $scope.isDialogVisible = false;
-
- $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
- url: CreationService.getMsoUrl(),
- requestDetails: requestDetails,
- componentId: componentId,
- callbackFunction: function (response) {
- if (response.isSuccessful) {
- $scope.popup.isVisible = false;
- runCallback(response);
- } else {
- $scope.isDialogVisible = false;
- $scope.popup.isVisible = false;
- }
- }
- });
- }
- };
-
- $scope.cancel = function () {
- $scope.isDialogVisible = false;
- $scope.popup.isVisible = false;
- runCallback(false);
- };
-
-
- var runCallback = function (response) {
- if (angular.isFunction(callbackFunction)) {
- callbackFunction({
- isSuccessful: response.isSuccessful,
- control: $scope.userProvidedControl.getList(),
- instanceId: response.instanceId
- });
- }
- };
-
- var showError = function (summary, details) {
- var message = summary;
- if (UtilityService.hasContents(details)) {
- message += " (" + details + ")";
- }
- $scope.isSpinnerVisible = false;
- $scope.isErrorVisible = true;
- $scope.error = message;
- }
-
-};
-
-appDS2.controller("creationDialogController", ["COMPONENT", "FIELD", "PARAMETER", "$scope", "$http",
- "$timeout", "$log", "CreationService", "UtilityService", "DataService", "VIDCONFIGURATION", "$location",
- "$uibModal", "featureFlags",
- creationDialogController]);
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+"use strict";
+
+var creationDialogController = function (COMPONENT, FIELD, PARAMETER, $scope, $http, $timeout, $log,
+ CreationService, UtilityService, DataService, VIDCONFIGURATION, $location, $uibModal, featureFlags) {
+
+ $scope.isDialogVisible = false;
+ $scope.isServiceError = false;
+ $scope.summaryControl = {};
+ $scope.userProvidedControl = {};
+
+
+ var callbackFunction = undefined;
+ var componentId = undefined;
+
+ $scope.showReportWindow = function() {
+
+ let errorMsg;
+
+ if($scope.error !== undefined && $scope.error != null) {
+ errorMsg = $scope.error;
+ } else {
+ errorMsg = "";
+ }
+
+ const modalWindow = $uibModal.open({
+ templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',
+ controller: 'reportModalController',
+ controllerAs: 'vm',
+ resolve: {
+ errorMsg: function () {
+ return errorMsg;
+ }
+ }
+ });
+
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ };
+
+ $scope.isShowErrorReport = function() {
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_CREATE_ERROR_REPORTS);
+ };
+
+ $scope.shouldShowOldPopup = function () {
+ return !DataService.getShouldIncludeInAsyncInstantiationFlow();
+ };
+
+ function receiveMessage(event) {
+ if (event.data == 'closeIframe') {
+ window.removeEventListener("message", receiveMessage, false);
+
+ $scope.cancel();
+ }
+ else if (event.data.eventId == 'submitIframe') {
+ {
+ $location.path('/servicePlanning').search({serviceModelId: event.data.data.serviceModelId});
+ }
+ } else if (event.data.eventId == 'showPreviousInstantiations') {
+ {
+ $location.path('/instantiationStatus').search({filterText: event.data.data.serviceModelId});
+ }
+ }
+ $scope.$apply();
+ }
+
+ $scope.$on(COMPONENT.CREATE_COMPONENT, function (event, request) {
+ $scope.isSpinnerVisible = true;
+ $scope.isErrorVisible = false;
+ $scope.isDataVisible = false;
+ $scope.isConfirmEnabled = false;
+ $scope.isDialogVisible = true;
+ $scope.popup.isVisible = true;
+
+
+ if (!$scope.shouldShowOldPopup()) {
+ $scope.url = COMPONENT.SERVICE_POPUP_IFRAME_URL + request.modelNameVersionId + "&isCreate=true&r=" + Math.random();
+ window.addEventListener("message", receiveMessage, false);
+
+ }
+ else {
+ callbackFunction = request.callbackFunction;
+ componentId = request.componentId;
+ CreationService.initializeComponent(request.componentId);
+
+ CreationService.setHttpErrorHandler(function (response) {
+ $scope.isServiceError = true;
+ showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
+ .getHttpErrorMessage(response));
+ });
+
+ $scope.componentName = CreationService.getComponentDisplayName();
+
+ CreationService.getParameters(handleGetParametersResponse);
+ }
+
+ });
+
+ var handleGetParametersResponse = function (parameters) {
+ $scope.summaryControl.setList(parameters.summaryList);
+ $scope.userProvidedControl.setList(parameters.userProvidedList);
+
+ $scope.isSpinnerVisible = false;
+ $scope.isDataVisible = true;
+ $scope.isConfirmEnabled = true;
+ };
+
+ var validateInstanceName = function (iname) {
+ var patt1 = /^([a-z])+([0-9a-z\-_\.]*)$/i;
+
+ if (iname == null) {
+ return false;
+ }
+ if (!iname.match(patt1)) {
+ return false;
+ }
+ return true;
+ };
+ var validateMap = function (mname) {
+ var patt1 = /^{(\s*\w+\s*:\s*\w+\s*)(\s*,\s*\w+\s*:\s*\w+\s*)*}$/im;
+ if (mname == null) {
+ return true;
+ }
+ if (!mname.match(patt1)) {
+ return false;
+ }
+ return true;
+ };
+
+ var validateList = function (lname) {
+ var patt1 = /^\[(\s*\w+\s*)(\s*,\s*\w+\s*)*\]$/i;
+ if (lname == null) {
+ return true;
+ }
+ if (!lname.match(patt1)) {
+ return false;
+ }
+ return true;
+ };
+
+ $scope.userParameterChanged = function (id) {
+ CreationService.updateUserParameterList(id, $scope.userProvidedControl);
+ };
+
+ $scope.confirm = function () {
+
+ var requiredFields = $scope.userProvidedControl.getRequiredFields();
+ if (requiredFields !== "") {
+ showError(FIELD.ERROR.MISSING_DATA, requiredFields);
+ return;
+ }
+
+ var isUploadAvailable = false;
+ var uploadIndex = 0;
+ var paramList = $scope.userProvidedControl.getList();
+ var isAnyError = false;
+ for (var i = 0; i < paramList.length; i++) {
+ if (paramList[i].id === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
+ isUploadAvailable = true;
+ uploadIndex = i;
+ }
+ if (paramList[i].id === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE && paramList[i].value && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value == '') {
+ isAnyError = true;
+ }
+ }
+
+ if (isUploadAvailable && isAnyError) {
+ showError(FIELD.ERROR.MISSING_DATA, FIELD.ERROR.MISSING_FILE);
+
+ } else if (isUploadAvailable && document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE).value != '') {
+ var errorMsg = "";
+ var fileInput = document.getElementById(FIELD.ID.SUPPLEMENTORY_DATA_FILE);
+ var file = fileInput.files[0];
+ var reader = new FileReader();
+ reader.onload = function (e) {
+ try {
+ paramList[uploadIndex].value = JSON.parse(reader.result);
+ FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'] = paramList[uploadIndex].value;
+
+ var instanceName = "";
+
+ if (DataService.getALaCarte()) {
+ if (paramList != null) {
+ for (var i = 0; i < paramList.length; i++) {
+ if (paramList[i].id === FIELD.ID.INSTANCE_NAME) {
+ instanceName = paramList[i].value;
+ break;
+ }
+ }
+ }
+ var isValid = validateInstanceName(instanceName);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ } else {
+ showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName,
+ FIELD.ERROR.INSTANCE_NAME_VALIDATE);
+ return;
+ }
+ }
+ var arbitraryParametersList = DataService.getArbitraryParameters();
+ var p = null;
+ if (UtilityService.hasContents(arbitraryParametersList)) {
+ for (var i = 0; i < arbitraryParametersList.length; i++) {
+ p = arbitraryParametersList[i];
+ if (p.type === PARAMETER.MAP) {
+ //validate a map: { <entry_key_1>: <entry_value_1>, ... , <entry_key_n>: <entry_value_n> }
+ // need to find the value in paramList
+ for (var j = 0; j < paramList.length; j++) {
+ if (paramList[j].id === p.id) {
+ p.value = paramList[j].value;
+ var isValid = validateMap(p.value);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ break;
+ }
+ else {
+ showError(FIELD.ERROR.INVALID_MAP + p.id,
+ FIELD.ERROR.MAP_VALIDATE);
+ return;
+ }
+ }
+ }
+ } else if (p.type === PARAMETER.LIST) {
+ //validate a list: { value or a list of comma separated values }
+ // need to find the value in paramList
+ for (var j = 0; j < paramList.length; j++) {
+ if (paramList[j].id === p.id) {
+ p.value = paramList[j].value;
+ var isValid = validateList(p.value);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ break;
+ }
+ else {
+ showError(FIELD.ERROR.INVALID_LIST + p.id,
+ FIELD.ERROR.LIST_VALIDATE);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ var requestDetails = CreationService
+ .getMsoRequestDetails($scope.userProvidedControl.getList());
+
+ $scope.isDialogVisible = false;
+
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url: CreationService.getMsoUrl(),
+ requestDetails: requestDetails,
+ componentId: componentId,
+ callbackFunction: function (response) {
+ if (response.isSuccessful) {
+ $scope.popup.isVisible = false;
+ runCallback(response);
+ } else {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ }
+ }
+ });
+
+ } catch (e) {
+ errorMsg = errorMsg + FIELD.ERROR.INVALID_DATA_FORMAT;
+ }
+ if (errorMsg !== "") {
+ showError(FIELD.ERROR.SYSTEM_FAILURE, errorMsg);
+
+ }
+ };
+ reader.readAsText(file);
+ } else {
+
+ var paramList = $scope.userProvidedControl.getList();
+ var instanceName = "";
+
+ if (DataService.getALaCarte()) {
+ if (paramList != null) {
+ for (var i = 0; i < paramList.length; i++) {
+ if (paramList[i].id === FIELD.ID.INSTANCE_NAME) {
+ instanceName = paramList[i].value;
+ break;
+ }
+ }
+ }
+ var isValid = validateInstanceName(instanceName);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ } else {
+ showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName,
+ FIELD.ERROR.INSTANCE_NAME_VALIDATE);
+ return;
+ }
+ }
+ var arbitraryParametersList = DataService.getArbitraryParameters();
+ var p = null;
+ if (UtilityService.hasContents(arbitraryParametersList)) {
+ for (var i = 0; i < arbitraryParametersList.length; i++) {
+ p = arbitraryParametersList[i];
+ if (p.type === PARAMETER.MAP) {
+ //validate a map: { <entry_key_1>: <entry_value_1>, ... , <entry_key_n>: <entry_value_n> }
+ // need to find the value in paramList
+ for (var j = 0; j < paramList.length; j++) {
+ if (paramList[j].id === p.id) {
+ p.value = paramList[j].value;
+ var isValid = validateMap(p.value);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ break;
+ }
+ else {
+ showError(FIELD.ERROR.INVALID_MAP + p.id,
+ FIELD.ERROR.MAP_VALIDATE);
+ return;
+ }
+ }
+ }
+ } else if (p.type === PARAMETER.LIST) {
+ //validate a list: { value or a list of comma separated values }
+ // need to find the value in paramList
+ for (var j = 0; j < paramList.length; j++) {
+ if (paramList[j].id === p.id) {
+ p.value = paramList[j].value;
+ var isValid = validateList(p.value);
+ if (isValid) {
+ $scope.isErrorVisible = false;
+ break;
+ }
+ else {
+ showError(FIELD.ERROR.INVALID_LIST + p.id,
+ FIELD.ERROR.LIST_VALIDATE);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ var requestDetails = CreationService
+ .getMsoRequestDetails($scope.userProvidedControl.getList());
+
+ $scope.isDialogVisible = false;
+
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url: CreationService.getMsoUrl(),
+ requestDetails: requestDetails,
+ componentId: componentId,
+ callbackFunction: function (response) {
+ if (response.isSuccessful) {
+ $scope.popup.isVisible = false;
+ runCallback(response);
+ } else {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ }
+ }
+ });
+ }
+ };
+
+ $scope.cancel = function () {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ runCallback(false);
+ };
+
+
+ var runCallback = function (response) {
+ if (angular.isFunction(callbackFunction)) {
+ callbackFunction({
+ isSuccessful: response.isSuccessful,
+ control: $scope.userProvidedControl.getList(),
+ instanceId: response.instanceId
+ });
+ }
+ };
+
+ var showError = function (summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isErrorVisible = true;
+ $scope.error = message;
+ }
+
+};
+
+appDS2.controller("creationDialogController", ["COMPONENT", "FIELD", "PARAMETER", "$scope", "$http",
+ "$timeout", "$log", "CreationService", "UtilityService", "DataService", "VIDCONFIGURATION", "$location",
+ "$uibModal", "featureFlags",
+ creationDialogController]);