diff options
author | Ofir Sonsino <os0695@att.com> | 2018-01-31 17:19:00 +0200 |
---|---|---|
committer | Ofir Sonsino <os0695@att.com> | 2018-01-31 17:19:00 +0200 |
commit | 1cfb08779ea0e00be69e072a940b3063e049fe6b (patch) | |
tree | 6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/main/webapp/app/vid/scripts | |
parent | 2f20b001b9243e0f8b44aecc768ec265fd538732 (diff) |
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d
Issue-ID: VID-86
Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts')
82 files changed, 6304 insertions, 4289 deletions
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 534cee505..fa9ff1c75 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 @@ -28,7 +28,9 @@ appDS2 CLOUD_REGION_ID : "cloudRegionID", COMPONENT_STATUS : "ComponentStatus", CREATE_COMPONENT : "createComponent", - DELETE_COMPONENT : "deleteComponent", + DELETE_RESUME_COMPONENT : "deleteResumeComponent", + DELETE:"Delete", + RESUME:"Resume", ENTITY : "entity", GET_COMPONENT_LIST : "getComponentList", GET_SUBS : "getSubs", @@ -43,8 +45,17 @@ appDS2 MODEL_VERSION_1 : "1", MSO_CREATE_REQ : "createInstance", MSO_DELETE_REQ : "deleteInstance", + MSO_CHANGE_CONFIG_STATUS_REQ: "changeConfigurationStatus", + MSO_CHANGE_PORT_STATUS_REQ: "changePortStatus", + MSO_CREATE_ENVIRONMENT: "createEnvironmentInstance", + MSO_DEACTIVATE_ENVIRONMENT: "deactivateEnvironmentInstance", + MSO_ACTIVATE_ENVIRONMENT: "activateEnvironmentInstance", + MSO_ACTIVATE_SERVICE_REQ: "activateServiceInstance", + MSO_DEACTIVATE_SERVICE_REQ: "deactivateServiceInstance", NAME : "name", NETWORK : "network", + CONFIGURATION : "configuration", + PORT: "port", NETWORKS : "networks", PRODUCT_NAME_TRINITY : "Trinity", QUERY_SERVICE_INSTANCE : "queryServiceInstance", @@ -69,8 +80,8 @@ appDS2 VNF_TYPE : "vnfType", VOLUME_GROUP : "volumeGroup", IS_PERMITTED: "is-permitted", - - + RESUME_STATUS: "PendingActivation", + PNF : "pnf", // IDs CIDR_MASK_1 : "255.255.255.000", //COMPONENT_LIST_NAMED_QUERY_ID : "ed0a0f5b-cf79-4784-88b2-911cd726cd3d", @@ -95,11 +106,12 @@ appDS2 SUBSCRIBER_NAME_GED12 : "General Electric Division 12", VNF_INSTANCE_ID : "VNF_INSTANCE_ID_12345", VPN_ID_1 : "1a2b3c4d5e6f", - + // PATHS - GET_WORKFLOW: "change-management/workflow?vnfs=@vnfs", + GET_WORKFLOW: "change-management/get_vnf_workflow_relation", GET_MSO_WORKFLOWS: "change-management/mso", GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler", + CANCEL_SCHEDULE_REQUEST: "change-management/scheduler/schedules", ASSIGN : "?r=", AAI_GET_SERVICE_INSTANCE_PATH : "aai_get_service_instance/", AAI_GET_SERVICES : "aai_get_services", @@ -108,19 +120,31 @@ appDS2 AAI_GET_SERVICES_BY_TYPE : "aai_get_models_by_service_type", AAI_GET_TENANTS : "aai_get_tenants/", AAI_SUB_DETAILS_PATH : "aai_sub_details/", - AAI_GET_VERSION_BY_INVARIANT_ID:"aai_get_version_by_invariant_id/", - AAI_GET_VNF_DATA_PATH: "aai_get_vnf_data/", - AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE: "get_vnf_data_by_globalid_and_service_type/", - AAI_SUB_VIEWEDIT_PATH : "aai_sub_viewedit", + AAI_GET_VERSION_BY_INVARIANT_ID:"aai_get_version_by_invariant_id/", + SEARCH_SERVICE_INSTANCES:"search_service_instances", + AAI_GET_VNF_DATA_PATH: "aai_get_vnf_data/", + AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE: "get_vnf_data_by_globalid_and_service_type/", + AAI_GET_SERVICES_BY_OWNING_ENTITY_ID: 'aai_get_services_by_owning_entity_id', + AAI_SUB_VIEWEDIT_PATH : "aai_sub_viewedit", AAI_GET_VNF_INFO : "aai_get_vnf_information", + AAI_GET_PNF_INSTANCE: "aai_get_service_instance_pnfs", + AAI_GET_VNF_INSTANCES_LIST: "aai_get_vnf_instances", + AAI_GET_PNF_INSTANCES_LIST: "aai_get_pnf_instances", + AAI_GET_BY_URI: "aai_get_by_uri/", + AAI_GET_CONFIGURATION: "aai_get_configuration/", + AAI_GET_TEST_ENVIRONMENTS: "get_operational_environments?operationalEnvironmentType=", + GET_CATEGORY_PARAMETERS : "category_parameter", + PARAMETER_STANDARDIZATION_FAMILY: "PARAMETER_STANDARDIZATION", + TENANT_ISOLATION_FAMILY: "TENANT_ISOLATION", ASDC_GETMODEL_PATH : "asdc/getModel/", - CREATE_INSTANCE_PATH : "/models/services/createInstance", + CREATE_INSTANCE_PATH : "/models/services/createInstance", AAI_GET_PNF_BY_NAME : "aai_get_pnfs/pnf/", //1710 scheduler contants POST_CREATE_NEW_VNF_CHANGE:"post_create_new_vnf_change", GET_POLICY:"get_policy", + WORKFLOW: "workflow", GET_TIME_SLOTS:"get_time_slots", SUBMIT_VNF_CHANGE_TIMESLOTS:"submit_vnf_change_timeslots", - + FORWARD_SLASH : "/", GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH : "get_system_prop_vnf_prov_status", GET_USER_ID : "getuserID", @@ -128,15 +152,20 @@ appDS2 INSTANTIATE_PATH : "/instantiate", INVALID_STRING : "/INVALID_STRING/", INVALID_STRING_MSO_CREATE_SVC_INSTANCE : "INVALID_STRING_mso_create_svc_instance", + MSO: "mso", MSO_CREATE_NW_INSTANCE : "mso_create_nw_instance", MSO_CREATE_NW_INSTANCE_PATH : "mso_create_nw_instance/", MSO_CREATE_SVC_INSTANCE : "mso_create_svc_instance", MSO_DELETE_SVC_INSTANCE_PATH : "mso_delete_svc_instance/", - MSO_ACTIVATE_INSTANCE: "mso/mso_activate_service_instance/@serviceInstanceId", - SELECTED_SERVICE_SUB_PATH : "#/instances/subdetails?selectedServiceSubscription=", - SELECTED_SUB_PATH : "#/instances/subdetails?selectedSubscriber=", - SELECTEDSERVICEINSTANCE_SUB_PATH : "&selectedServiceInstance=", - SELECTEDSUBSCRIBER_SUB_PATH : "&selectedSubscriber=", + MSO_ACTIVATE_INSTANCE: "mso/mso_activate_service_instance/@serviceInstanceId", + MSO_DEACTIVATE_INSTANCE: "mso/mso_deactivate_service_instance/@serviceInstanceId", + MSO_CREATE_REALATIONSHIP : "mso_add_relationship", + MSO_REMOVE_RELATIONSHIP: "mso_remove_relationship", + SELECTED_SERVICE_SUB_PATH : "#/instances/subdetails?", + SELECTED_SERVICE_INSTANCE_SUB_PATH : "serviceInstanceIdentifier=", + SELECTED_SUBSCRIBER_SUB_PATH : "subscriberId=", + OWNING_ENTITY_SUB_PATH : "owningEntity=", + PROJECT_SUB_PATH : "project=", SERVICE_TYPE_LIST_PATH : "#/instances/serviceTypes?serviceTypeList=", SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH : 'serviceModels.htm#/instances/subscribers', SERVICES_DIST_STATUS_PATH : "rest/models/services?distributionStatus=", @@ -150,6 +179,12 @@ appDS2 WELCOME_PATH : "welcome.htm", IS_PERMITTED_SUB_PATH: "&isPermitted=", + //Test Environment Urls: + OPERATIONAL_ENVIRONMENT_CREATE : "operationalEnvironment/create", + OPERATIONAL_ENVIRONMENT_DEACTIVATE : "operationalEnvironment/deactivate?operationalEnvironment=", + OPERATIONAL_ENVIRONMENT_ACTIVATE : "operationalEnvironment/activate?operationalEnvironment=", + OPERATIONAL_ENVIRONMENT_STATUS : "operationalEnvironment/requestStatus?requestId=", + //Template Urls AAI_GET_SUBS_URL : "app/vid/scripts/view-models/aaiGetSubs.htm", AAI_GET_SUBSCRIBER_URL : "app/vid/scripts/view-models/aaiGetSubscriberList.htm", @@ -158,9 +193,9 @@ appDS2 CREATE_INSTANCE_SERVICE_MODELS_URL : "app/vid/scripts/view-models/createInstanceServiceModels.htm", INSTANTIATE_URL : "app/vid/scripts/view-models/instantiate.htm", SERVICE_MODELS : "app/vid/scripts/view-models/serviceModels.htm", - - - + + + FULL_NAME_MAP : { "model-invariant-id" : "Model ID", "model-version-id" : "Model Version ID" @@ -174,11 +209,18 @@ appDS2 }, MANUAL_TASKS: { - "retry": "retry", - "rollback": "rollback", - "abort": "abort", - "skip": "skip" + "retry": "retry", + "rollback": "rollback", + "abort": "abort", + "skip": "skip" + }, + + WORKFLOWS: { + vnfConfigUpdate: "VNF Config Update", + vnfInPlace: "VNF In Place Software Update", + update: "update", + replace: "replace" } - + }; })()) diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js index 9e3f44cc2..d7f429a6e 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js @@ -37,6 +37,10 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { SUBSCRIBER_NAME: "subscriberName",
SUPPRESS_ROLLBACK: "suppressRollback",
TENANT: "tenant",
+ PROJECT: "project",
+ OWNING_ENTITY : "owningEntity",
+ LINE_OF_BUSINESS : "lineOfBusiness",
+ PLATFORM : "platform",
VNF_TARGETPROVSTATUS: "target",
AAI_GET_FULL_SUBSCRIBERS: "aai_get_full_subscribers",
@@ -83,7 +87,7 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { NETWORKS: "networks",
OPERATIONAL_STATUS: "operational-status",
ORCHESTRATION_STATUS: "orchestration-status",
- PERCENT_PROGRESS: "precentProgress",
+ PERCENT_PROGRESS: "percent-progress",
PERSONA_MODEL_ID: "persona-model-id",
PERSONA_MODEL_VERSION: "persona-model-version",
PERSONA_MODEL_CUSTOMIZATION_ID: "persona-model-customization-id",
@@ -129,7 +133,16 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { SUPPLEMENTORY_DATA_FILE: "supplementoryDataFile",
ZONE_ID: "zone-id",
ZONE_NAME: "zone-name",
-
+ GENERIC_CONFIGURATION: "configuration",
+ CONFIGURATIONS: "configurations",
+ CONFIGURATION: "configuration",
+ CONFIGURATION_NAME: "configuration-name",
+ CONFIGURATION_TYPE: "configuration-type",
+ CONFIGURATION_ID: "configuration-id",
+ PORT: "l-interface",
+ PORT_ID: "interface-id",
+ PORT_NAME: "interface-name",
+ PORT_MIRRORED: "is-port-mirrored"
};
var KEY = {
@@ -140,58 +153,62 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { * NAME values are displayed on GUI pages.
*/
var NAME = {
- AVAILABLE_VOLUME_GROUP: "Available Volume Group",
- INSTANCE_NAME: "Instance Name",
- CUSTOMER_ID: "Customer ID",
- LCP_REGION: "LCP Region",
- LCP_REGION_TEXT: "Legacy Region",
- MODEL_INVARIANT_UUID: "Model Invariant UUID",
- MODEL_NAME: "Model Name",
- MODEL_VERSION: "Model Version",
- MODEL_UUID: "Model UUID",
- MODEL_CUSTOMIZATION_UUID: "Model Customization UUID",
- MODEL_VNF_TYPE: "NF Type",
- MODEL_VNF_ROLE: "NF Role",
- MODEL_VNF_FUNCTION: "NF Function",
- MODEL_VNF_CODE: "NF Naming Code",
- MODEL_CUSTOMIZATION_NAME: "Resource Name",
- PRODUCT_FAMILY: "Product Family",
- AIC_ZONES: "AIC Zone",
- RESOURCE_DESCRIPTION: "Resource Description",
- RESOURCE_NAME: "Resource Name",
- SERVICE_CATEGORY: "Service Category",
- SERVICE_DESCRIPTION: "Service Description",
- SERVICE_INSTANCE_ID: "Service Instance ID",
- SERVICE_INSTANCE_Id: "Service Instance Id",
- SERVICE_INSTANCE_NAME: "Service Instance Name",
- SERVICE_INVARIANT_UUID: "Service Invariant UUID",
- SERVICE_NAME: "Service Name",
- SERVICE_TYPE: "Service Type",
- SERVICE_ROLE: "Service Role",
- SERVICE_UUID: "Service UUID",
- SERVICE_VERSION: "Service Version",
- SUBSCRIBER_NAME: "Subscriber Name",
- MOBILITY: "Mobility",
- SUPPRESS_ROLLBACK: "Suppress Rollback on Failure",
- SDN_C_PRELOAD: "SDN-C Pre-Load",
- UPLOAD_SUPPLEMENTORY_DATA_FILE: "Upload Supplementary Data file",
- SUPPLEMENTORY_DATA_FILE: "Supplementory Data file (JSON format)",
- TENANT: "Tenant",
- USER_SERVICE_INSTANCE_NAME: "User Service Instance Name",
- VF_MODULE_DESCRIPTION: "VF Module Description",
- VF_MODULE_LABEL: "VF Module Label",
- VF_MODULE_TYPE: "VF Module Type",
- VNF_ORCHESTRATION_STATUS: "Orchestration Status",
- VNF_Operational_Status: "Operational Status",
- VNF_Current_Prov_Status: "Current Prov_Status",
- VNF_Target_Prov_Status: "Target Prov Status",
- VNF_VNF_ID: "VNF ID",
- VNF_VNF_Name: "VNF Name",
- VNF_VNF_Type: "VNF Type",
- VNF_Service_ID: "Service ID",
- VNF_In_Maint: "In Maint",
- VFMDULE_CUSTOMIZATIONUUID: "VF Module Model Customization UUID",
- RESOURCE_CUSTOMIZATION_UUID: "Resource Model Customization UUID"
+ AVAILABLE_VOLUME_GROUP: "Available Volume Group",
+ INSTANCE_NAME: "Instance Name",
+ CUSTOMER_ID: "Customer ID",
+ LCP_REGION: "LCP Region",
+ LCP_REGION_TEXT: "Legacy Region",
+ MODEL_INVARIANT_UUID: "Model Invariant UUID",
+ MODEL_NAME: "Model Name",
+ MODEL_VERSION: "Model Version",
+ MODEL_UUID: "Model UUID",
+ MODEL_CUSTOMIZATION_UUID: "Model Customization UUID",
+ MODEL_VNF_TYPE: "NF Type",
+ MODEL_VNF_ROLE: "NF Role",
+ MODEL_VNF_FUNCTION: "NF Function",
+ MODEL_VNF_CODE: "NF Naming Code",
+ MODEL_CUSTOMIZATION_NAME: "Resource Name",
+ PRODUCT_FAMILY: "Product Family",
+ AIC_ZONES: "AIC Zone",
+ RESOURCE_DESCRIPTION : "Resource Description",
+ RESOURCE_NAME : "Resource Name",
+ SERVICE_CATEGORY : "Service Category",
+ SERVICE_DESCRIPTION : "Service Description",
+ SERVICE_INSTANCE_ID : "Service Instance ID",
+ SERVICE_INSTANCE_Id : "Service Instance Id",
+ SERVICE_INSTANCE_NAME : "Service Instance Name",
+ SERVICE_INVARIANT_UUID : "Service Invariant UUID",
+ SERVICE_NAME : "Service Name",
+ SERVICE_TYPE : "Service Type",
+ SERVICE_ROLE: "Service Role",
+ SERVICE_UUID : "Service UUID",
+ SERVICE_VERSION : "Service Version",
+ SUBSCRIBER_NAME : "Subscriber Name",
+ MOBILITY : "Mobility",
+ SUPPRESS_ROLLBACK : "Suppress Rollback on Failure",
+ SDN_C_PRELOAD : "SDN-C Pre-Load",
+ UPLOAD_SUPPLEMENTORY_DATA_FILE : "Upload Supplementary Data file",
+ SUPPLEMENTORY_DATA_FILE : "Supplementory Data file (JSON format)",
+ TENANT : "Tenant",
+ PROJECT : "Project",
+ OWNING_ENTITY : "Owning Entity",
+ LINE_OF_BUSINESS : "Line Of Business",
+ PLATFORM : "Platform",
+ USER_SERVICE_INSTANCE_NAME : "User Service Instance Name",
+ VF_MODULE_DESCRIPTION : "VF Module Description",
+ VF_MODULE_LABEL : "VF Module Label",
+ VF_MODULE_TYPE : "VF Module Type",
+ VNF_ORCHESTRATION_STATUS : "Orchestration Status",
+ VNF_Operational_Status: "Operational Status",
+ VNF_Current_Prov_Status: "Current Prov_Status",
+ VNF_Target_Prov_Status: "Target Prov Status",
+ VNF_VNF_ID : "VNF ID",
+ VNF_VNF_Name: "VNF Name",
+ VNF_VNF_Type: "VNF Type",
+ VNF_Service_ID: "Service ID",
+ VNF_In_Maint: "In Maint",
+ VFMDULE_CUSTOMIZATIONUUID: "VF Module Model Customization UUID",
+ RESOURCE_CUSTOMIZATION_UUID: "Resource Model Customization UUID"
};
/*
@@ -211,6 +228,10 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { SUBSCRIBER_NAME: "Select Subscriber Name",
TARGETPROVSTATUS: "Select Target Prov Status",
TENANT: "Select Tenant Name",
+ PROJECT: "Select Project Name",
+ OWNING_ENTITY: "Select Owning Entity",
+ LINE_OF_BUSINESS : "Select Line Of Business",
+ PLATFORM : "Select Platform",
TEXT_INPUT: "Enter data",
SELECT_SERVICE: "Select a service type",
SELECT_SUB: "Select a subscriber name",
@@ -244,7 +265,11 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { SUBMITTING_REQUEST: "Submitting Request",
SUCCESS_VNF_PROV_STATUS: "Successfully set the VNF's Prov_Status to ",
UNLOCKED: "Unlocked",
-
+ AAI_ACTIVE: "Active",
+ AAI_INACTIVE: "Inactive",
+ AAI_CREATED: "Created",
+ AAI_ENABLED: "Enabled",
+ AAI_DISABLED: "Disabled"
};
var STYLE = {
@@ -416,8 +441,8 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { id: ID.SUBSCRIBER_NAME,
type: PARAMETER.SELECT,
prompt: PROMPT.SUBSCRIBER_NAME,
- isRequired : true,
- isSingleOptionAutoSelected : false
+ isRequired: true,
+ isSingleOptionAutoSelected : false
},
TENANT_DISABLED: {
name: NAME.TENANT,
@@ -433,6 +458,38 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { isEnabled: true,
prompt: PROMPT.TENANT,
isRequired: true
+ },
+ PROJECT: {
+ name: NAME.PROJECT,
+ id: ID.PROJECT,
+ type: PARAMETER.SELECT,
+ isEnabled: true,
+ prompt: PROMPT.PROJECT,
+ isRequired: false
+ },
+ OWNING_ENTITY: {
+ name: NAME.OWNING_ENTITY,
+ id: ID.OWNING_ENTITY,
+ type: PARAMETER.SELECT,
+ isEnabled: true,
+ prompt: PROMPT.OWNING_ENTITY,
+ isRequired: true
+ },
+ LINE_OF_BUSINESS: {
+ name: NAME.LINE_OF_BUSINESS,
+ id: ID.LINE_OF_BUSINESS,
+ type: PARAMETER.MULTI_SELECT,
+ isEnabled: true,
+ prompt: PROMPT.LINE_OF_BUSINESS,
+ isRequired: false
+ },
+ PLATFORM: {
+ name: NAME.PLATFORM,
+ id: ID.PLATFORM,
+ type: PARAMETER.SELECT,
+ isEnabled: true,
+ prompt: PROMPT.PLATFORM,
+ isRequired: true
}
};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js index 693186af4..785f3caba 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js @@ -24,6 +24,7 @@ appDS2.constant("PARAMETER", (function() { return {
BOOLEAN : "boolean",
SELECT : "select",
+ MULTI_SELECT : "multi_select",
STRING : "string",
NUMBER : "number",
VALID_VALUES : "valid_values",
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/version.json b/vid-app-common/src/main/webapp/app/vid/scripts/constants/version.json new file mode 100644 index 000000000..5e843e91d --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/version.json @@ -0,0 +1 @@ +{"Version": "BUILD_NUMBER"}
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js index 6ed410a8f..0b69ed556 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js @@ -64,6 +64,12 @@ appDS2.constant("VIDCONFIGURATION", (function() { "orchestrationStatus": "active",
"inMaint": false,
"operationalStatus": "out-of-service-path"
+ },
+ {
+ "provStatus": "prov",
+ "orchestrationStatus": "activated",
+ "inMaint": false,
+ "operationalStatus": "out-of-service-path"
}
];
/*
@@ -96,6 +102,11 @@ appDS2.constant("VIDCONFIGURATION", (function() { */
var COMPONENT_LIST_NAMED_QUERY_ID = "0367193e-c785-4d5f-9cb8-7bc89dc9ddb7";
var MACRO_SERVICES = [];
+
+ var SCHEDULER_CALLBACK_URL = "";
+
+ var SCHEDULER_PORTAL_URL = "";
+
return {
ASDC_MODEL_STATUS : ASDC_MODEL_STATUS,
MSO_MAX_POLLS : MSO_MAX_POLLS,
@@ -106,6 +117,8 @@ appDS2.constant("VIDCONFIGURATION", (function() { VNF_VALID_STATUS_LIST : vnfValidStatusList,
UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED : UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED,
MACRO_SERVICES : MACRO_SERVICES,
- COMPONENT_LIST_NAMED_QUERY_ID : COMPONENT_LIST_NAMED_QUERY_ID
+ COMPONENT_LIST_NAMED_QUERY_ID : COMPONENT_LIST_NAMED_QUERY_ID,
+ SCHEDULER_CALLBACK_URL: SCHEDULER_CALLBACK_URL,
+ SCHEDULER_PORTAL_URL: SCHEDULER_PORTAL_URL
};
})())
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js new file mode 100644 index 000000000..458da3f75 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js @@ -0,0 +1,78 @@ +/*- +* ============LICENSE_START======================================================= +* VID +* ================================================================================ +* Copyright (C) 2017 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========================================================= +*/ + +/** + * The Instantiation (or View/Edit) Controller controls the instantiation/removal of + * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups) + */ + +"use strict"; + +appDS2.controller("AddNetworkNodeController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "CreationService", "$scope", "$window", "$location", + function (COMPONENT, FIELD, PARAMETER, DataService, CreationService, $scope, $window, $location) { + + $scope.serviceMetadataFields = []; + $scope.tenantList = []; + $scope.nodeTemplateFields = {}; + + $scope.regexInstanceName = /^([a-z])+([0-9a-z\-_\.]*)$/i; + $scope.errorMsg = FIELD.ERROR.INSTANCE_NAME_VALIDATE; + + var handleGetParametersResponse = function(parameters) { + $scope.serviceMetadataFields = parameters.summaryList; + $scope.tenantList = DataService.getCloudRegionTenantList(); + + if(DataService.getPortMirroningConfigFields()){ + $scope.nodeTemplateFields =DataService.getPortMirroningConfigFields(); + }else { + $scope.nodeTemplateFields = angular.copy(_.keyBy(parameters.userProvidedList, 'id')); + } + + $scope.modelName = DataService.getModelInfo(COMPONENT.VNF).modelCustomizationName; + }; + + CreationService.initializeComponent(COMPONENT.VNF); + + CreationService.getParameters(handleGetParametersResponse); + + $scope.setTenant = function(field) { + $scope.nodeTemplateFields.tenant.optionList = _.filter($scope.tenantList, {'cloudRegionId': field.value, 'isPermitted': true}); + }; + + $scope.cancel = function() { + $window.history.back(); + }; + + $scope.next = function() { + // DataService.setLcpRegion($scope.nodeTemplateFields.lcpRegion.value); + // DataService.setModelInstanceName($scope.nodeTemplateFields.instanceName.value); + // DataService.setTenant($scope.nodeTemplateFields.tenant.value); + // var suppressRollback = ($scope.nodeTemplateFields.suppressRollback.value) ? true : false; + // DataService.setSuppressRollback(suppressRollback); + DataService.setPortMirroningConfigFields($scope.nodeTemplateFields); + $location.path("/serviceProxyConfig"); + }; + + $scope.$on('$routeChangeStart', function (event, next, current) { + if(next.$$route.originalPath !=="/serviceProxyConfig"){ + DataService.setPortMirroningConfigFields(null); + } + }); + }]); 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 f0653f680..f1dc384c6 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 @@ -26,14 +26,18 @@ "use strict";
appDS2.requires.push('ui.tree');
-
- appDS2.controller("InstantiationController", function ($scope, $route, $location, $timeout, COMPONENT, VIDCONFIGURATION, FIELD, DataService, PropertyService, UtilityService, VnfService, $http, vidService) {
-
+
+ appDS2.controller("InstantiationController", function ($scope, $route, $location, $timeout, COMPONENT, VIDCONFIGURATION, FIELD, DataService, PropertyService, UtilityService, VnfService, $http, vidService, AaiService,PnfService, $q) {
+
$scope.popup = new Object();
$scope.defaultBaseUrl = "";
$scope.responseTimeoutMsec = 60000;
$scope.properties = UtilityService.getProperties();
- $scope.isPermitted = $location.search().isPermitted;
+ $scope.resumeStatus = COMPONENT.RESUME_STATUS;
+ //isPermitted - returned as string from url and converted into boolean
+ $scope.isPermitted = $location.search().isPermitted == "true";
+ $scope.STATUS_CONSTANTS = FIELD.STATUS;
+ $scope.pnfs = [];// PNF data init;
$scope.init = function() {
/*
@@ -63,8 +67,9 @@ // DataService.setServiceInstanceId("mmsc-test-service-instance");
// DataService.setServiceUuid("XXXX-YYYY-ZZZZ");
// DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME");
+
}
-
+
//PropertyService.setMsoBaseUrl("testmso");
$scope.convertModel = function(asdcModel) {
@@ -78,7 +83,23 @@ "convertedModel": $scope.convertModel(vidService.getModel()),
"instance": vidService.getInstance()
};
-
+
+ preparePnfs();
+
+
+ function preparePnfs(){
+ var serviceInstance = {
+ globalCustomerId: $location.search().subscriberId,
+ serviceType: $location.search().serviceType,
+ serviceInstanceId: $location.search().serviceInstanceId
+ };
+
+ _setPnf(serviceInstance).then(function(data){
+ $scope.pnfs = data;
+ });
+ }
+
+
$scope.returnVfModules = function (vnfInstance) {
var svcModel = $scope.service.convertedModel;
@@ -213,9 +234,10 @@ DataService.setServiceUuid($scope.service.model.service.uuid);
DataService.setNetworkInstanceId(network.object[FIELD.ID.NETWORK_ID]);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
componentId : COMPONENT.NETWORK,
- callbackFunction : deleteCallbackFunction
+ callbackFunction : deleteOrResumeCallback,
+ dialogMethod: COMPONENT.DELETE
});
};
@@ -233,14 +255,8 @@ }
DataService.setMacro($scope.isMacro());
DataService.setInventoryItem(serviceInstance);
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": $scope.service.model.service.invariantUuid,
- "modelVersion": $scope.service.model.service.version,
- "modelNameVersionId": $scope.service.model.service.uuid,
- "modelName": $scope.service.model.service.name,
- "inputs": ""
- });
+ setCurrentServiceModelInfoFromScope();
+
DataService.setSubscriberName(serviceObject[FIELD.ID.SUBSCRIBER_NAME]);
DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
@@ -253,105 +269,150 @@ DataService.setServiceUuid($scope.service.model.service.uuid);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
componentId : COMPONENT.SERVICE,
- callbackFunction : deleteServiceInstanceCallbackFunction
+ callbackFunction : deleteServiceInstanceCallbackFunction,
+ dialogMethod: COMPONENT.DELETE
});
};
- $scope.deleteVfModule = function(serviceObject, vfModule, vnf) {
-
- console.log("Removing VF-Module " + vfModule.name);
-
+ function populate_popup_vfModule(serviceObject, vfModule, vnf){
var serviceInstance = serviceObject.object;
- DataService.setInventoryItem(vfModule.object);
-
- var svcModel = $scope.service.convertedModel;
+ DataService.setInventoryItem(vfModule.object);
- //var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
- var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
- var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];;
- var vfModuleInstanceID = vfModule.object[FIELD.ID.VF_MODULE_ID];
- if (vfModuleInstanceID == null) {
- vfModuleInstanceID = "";
- }
-
- var vnfModel = null;
- var vfModuleModel = null;
-
- DataService.setModelInfo(COMPONENT.VF_MODULE, {
- "modelInvariantId": "",
- "modelVersion": "",
- "modelNameVersionId": "",
- "modelCustomizationName": "",
- "customizationUuid": "",
- "modelName": "",
- "inputs": ""
- });
-
- if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
- if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
- vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
-
- var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
- if ( !($scope.isObjectEmpty(vnfModel.vfModules) ) && UtilityService.hasContents(vfModuleCustomizationUuid) ) {
-
- vfModuleModel = vnfModel.vfModules[vfModuleCustomizationUuid];
-
- }
- }
- else {
- // old flow
- if (vnfModelVersionId != null ) {
- vnfModel = svcModel.vnfs[vnfModelVersionId];
- }
- //var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID];
- var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID];
- if ( (!($scope.isObjectEmpty(vnfModel))) && (!($scope.isObjectEmpty(vnfModel.vfModules))) &&
- UtilityService.hasContents(vfModuleModelVersionId) ) {
- vfModuleModel = vnfModel.vfModules[vfModuleModelVersionId];
- }
- }
- if ( !($scope.isObjectEmpty(vfModuleModel)) ) {
- DataService.setModelInfo(COMPONENT.VF_MODULE, {
- "modelInvariantId": vfModuleModel.invariantUuid,
- "modelVersion": vfModuleModel.version,
- "modelNameVersionId": vfModuleModel.uuid,
- "modelCustomizationName": vfModuleModel.modelCustomizationName,
- "customizationUuid": vfModuleModel.customizationUuid,
- "modelName": vfModuleModel.name,
- "inputs": ""
- });
- }
- }
+ var svcModel = $scope.service.convertedModel;
- DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]);
- DataService.setVfModuleInstanceId(vfModuleInstanceID);
-
- DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
- DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
- DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
-
- DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
- DataService.setServiceInstanceName($scope.service.instance.name);
-
- DataService.setServiceName($scope.service.model.service.name);
-
- DataService.setServiceUuid($scope.service.model.service.uuid);
+ //var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];;
+ var vfModuleInstanceID = vfModule.object[FIELD.ID.VF_MODULE_ID];
+ if (vfModuleInstanceID == null) {
+ vfModuleInstanceID = "";
+ }
+
+ var vnfModel = null;
+ var vfModuleModel = null;
+
+ DataService.setModelInfo(COMPONENT.VF_MODULE, {
+ "modelInvariantId": "",
+ "modelVersion": "",
+ "modelNameVersionId": "",
+ "modelCustomizationName": "",
+ "customizationUuid": "",
+ "modelName": "",
+ "inputs": ""
+ });
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+
+ var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ if ( !($scope.isObjectEmpty(vnfModel.vfModules) ) && UtilityService.hasContents(vfModuleCustomizationUuid) ) {
+
+ vfModuleModel = vnfModel.vfModules[vfModuleCustomizationUuid];
+
+ }
+ }
+ else {
+ // old flow
+ if (vnfModelVersionId != null ) {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+ //var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID];
+ var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID];
+ if ( (!($scope.isObjectEmpty(vnfModel))) && (!($scope.isObjectEmpty(vnfModel.vfModules))) &&
+ UtilityService.hasContents(vfModuleModelVersionId) ) {
+ vfModuleModel = vnfModel.vfModules[vfModuleModelVersionId];
+ }
+ }
+ if ( !($scope.isObjectEmpty(vfModuleModel)) ) {
+ DataService.setModelInfo(COMPONENT.VF_MODULE, {
+ "modelInvariantId": vfModuleModel.invariantUuid,
+ "modelVersion": vfModuleModel.version,
+ "modelNameVersionId": vfModuleModel.uuid,
+ "modelCustomizationName": vfModuleModel.modelCustomizationName,
+ "customizationUuid": vfModuleModel.customizationUuid,
+ "modelName": vfModuleModel.name,
+ "inputs": ""
+ });
+ }
+ }
+
+ DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]);
+ DataService.setVfModuleInstanceId(vfModuleInstanceID);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+ }
+
+ $scope.deleteVfModule = function(serviceObject, vfModule, vnf) {
+
+ console.log("Removing VF-Module " + vfModule.name);
+
+ populate_popup_vfModule(serviceObject, vfModule, vnf);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
componentId : COMPONENT.VF_MODULE,
- callbackFunction : deleteCallbackFunction
+ callbackFunction : deleteOrResumeCallback,
+ dialogMethod: COMPONENT.DELETE
});
return;
};
- $scope.deleteVnf = function(serviceObject, vnf) {
+ function setCurrentServiceModelInfoFromScope(){
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": $scope.service.model.service.invariantUuid,
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+ };
+
+ function setCurrentVNFModelInfo(vnf){
+ var svcModel = $scope.service.convertedModel;
+ var vnfModel;
+ var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ }
+ else {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+ if ( !($scope.isObjectEmpty(vnfModel) ) ) {
+
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelInvariantId": vnfModel.invariantUuid,
+ "modelVersion": vnfModel.version,
+ "modelNameVersionId": vnfModel.uuid,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "modelName": vnfModel.name,
+ "inputs": ""
+ });
+ }
+ }
+
+
+
+ }
+ $scope.deleteVnf = function(serviceObject, vnf) {
console.log("Removing VNF " + vnf.name);
var serviceInstance = serviceObject.object;
@@ -424,9 +485,10 @@ DataService.setServiceUuid($scope.service.model.service.uuid);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
componentId : COMPONENT.VNF,
- callbackFunction : deleteCallbackFunction
+ callbackFunction : deleteOrResumeCallback,
+ dialogMethod: COMPONENT.DELETE
});
};
@@ -517,8 +579,9 @@ DataService.setVnfInstanceId(vnf.nodeId);
DataService.setVolumeGroupInstanceId(volumeGroup.nodeId);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
componentId : COMPONENT.VOLUME_GROUP,
+ dialogMethod: COMPONENT.DELETE
});
};
@@ -585,10 +648,11 @@ DataService.setVnfInstanceId(vnf.nodeId);
DataService.setVolumeGroupInstanceId(volumeGroup.nodeId);
- $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
- componentId : COMPONENT.VOLUME_GROUP,
- callbackFunction : deleteCallbackFunction
- });
+ $scope.$broadcast(COMPONENT.DELETE_RESUME_COMPONENT, {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : deleteOrResumeCallback,
+ dialogMethod: COMPONENT.DELETE
+ });
};
$scope.describeNetwork = function(serviceObject, networkObject) {
@@ -783,14 +847,8 @@ "inputs": "",
"displayInputs": netModel.displayInputs
});
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": $scope.service.model.service.invariantUuid,
- "modelVersion": $scope.service.model.service.version,
- "modelNameVersionId": $scope.service.model.service.uuid,
- "modelName": $scope.service.model.service.name,
- "inputs": ""
- });
+ setCurrentServiceModelInfoFromScope();
+
$scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
componentId : COMPONENT.NETWORK,
@@ -814,6 +872,8 @@ DataService.setServiceInstanceId($scope.service.instance.id);
DataService.setServiceName($scope.service.model.service.name);
+ console.log ( "existingVnfs: " );
+ console.log (JSON.stringify ( existingVnfs, null, 4));
console.log ( "existingVnfs: " ); console.log (JSON.stringify ( existingVnfs, null, 4));
var vnf_type = "";
var vnf_role = "";
@@ -833,7 +893,7 @@ vnf_code = vnf.nfCode;
}
DataService.setModelInfo(COMPONENT.VNF, {
- "modelType": "vnf",
+ "modelType": vnf.isPnf ? "pnf" : "vnf",
"modelInvariantId": vnf.invariantUuid,
"modelVersion": vnf.version,
"modelNameVersionId": vnf.uuid,
@@ -845,23 +905,27 @@ "vnfType": vnf_type,
"vnfRole": vnf_role,
"vnfFunction": vnf_function,
- "vnfCode": vnf_code
+ "vnfCode": vnf_code,
+ "properties": vnf.properties
});
DataService.setModelInstanceName($scope.service.model.service.name);
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": $scope.service.model.service.invariantUuid,
- "modelVersion": $scope.service.model.service.version,
- "modelNameVersionId": $scope.service.model.service.uuid,
- "modelName": $scope.service.model.service.name,
- "inputs": ""
- });
-
- $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
- componentId : COMPONENT.VNF,
- callbackFunction : createVnfCallbackFunction
- });
+ setCurrentServiceModelInfoFromScope();
+
+ if (vnf.isConfig) {
+ DataService.setServiceProxies($scope.service.model.serviceProxies);
+ DataService.setSourceServiceProxies(vnf.sourceNodes);
+ DataService.setCollectorServiceProxies(vnf.collectorNodes);
+ DataService.setConfigurationByPolicy(vnf.isConfigurationByPolicy);
+ $location.path("/addNetworkNode");
+ } else if(vnf.isPnf){
+ $location.path("/pnfSearchAssociation");
+ } else {
+ $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
+ componentId: COMPONENT.VNF,
+ callbackFunction: createVnfCallbackFunction
+ });
+ }
};
$scope.addVfModuleInstance = function(vnfInstance, vfModuleModel) {
@@ -898,20 +962,11 @@ availableVolumeGroupList.push({"instance": volumeGroupInstance});
});
- if (vfModuleModel.volumeGroupAllowed) {
- DataService.setAvailableVolumeGroupList(availableVolumeGroupList);
- }
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": $scope.service.model.service.invariantUuid,
- "modelVersion": $scope.service.model.service.version,
- "modelNameVersionId": $scope.service.model.service.uuid,
- "modelName": $scope.service.model.service.name,
- "inputs": ""
- });
+ DataService.setAvailableVolumeGroupList(availableVolumeGroupList);
+ setCurrentServiceModelInfoFromScope();
DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]);
-
+
DataService.setModelInfo(COMPONENT.VNF, {
"modelInvariantId": vnfModel.invariantUuid,
"modelVersion": vnfModel.version,
@@ -954,6 +1009,7 @@ DataService.setServiceInstanceName($scope.service.instance.name);
DataService.setServiceInstanceId($scope.service.instance.id);
DataService.setServiceName($scope.service.model.service.name);
+ setCurrentServiceModelInfoFromScope();
DataService.setModelInfo(COMPONENT.SERVICE, {
"modelInvariantId": $scope.service.model.service.invariantUuid,
@@ -976,7 +1032,7 @@ else {
vnfModel = svcModel.vnfs[vnfModelVersionId];
}
-
+
DataService.setModelInfo(COMPONENT.VNF, {
"modelInvariantId": vnfModel.invariantUuid,
"modelVersion": vnfModel.version,
@@ -1003,6 +1059,76 @@ });
};
+ $scope.resume = function(serviceObject, vfModule, vnfModel) {
+ populate_popup_vfModule(serviceObject, vfModule, vnfModel);
+ 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
+ });
+ };
+
+ $scope.deleteConfiguration = function (serviceObject, configuration) {
+ console.log("Deleting Configuration " + configuration.name);
+
+ var serviceInstance = serviceObject.object;
+ var svcModel = $scope.service.convertedModel;
+ var configModel;
+ DataService.setInventoryItem(configuration.object);
+ // set model default and override later if found
+ DataService.setModelInfo(COMPONENT.CONFIGURATION, {});
+
+ if ( configuration.object != null ) {
+
+ //var netModelInvariantUuid = network.object[FIELD.ID.MODEL_INVAR_ID];
+ var configModelVersionId = configuration.object[FIELD.ID.MODEL_VERSION_ID]; // model uuid
+ var configModelCustomizationUuid = configuration.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ //configurations added to vnfs list, in order to be part of the "Add VNF" drop-down list
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (UtilityService.hasContents(configModelCustomizationUuid) ) ) {
+ configModel = svcModel.vnfs[configModelCustomizationUuid];
+ }
+ else {
+
+ if ( UtilityService.hasContents(configModelVersionId) ) {
+ configModel = svcModel.vnfs[configModelVersionId];
+ }
+
+ }
+ }
+ }
+ if (!($scope.isObjectEmpty(configModel) ) ) {
+ DataService.setModelInfo(COMPONENT.CONFIGURATION, {
+ "modelInvariantId": configModel.invariantUuid,
+ "modelVersion": configModel.version,
+ "modelNameVersionId": configModel.uuid,
+ "modelCustomizationName": configModel.modelCustomizationName,
+ "customizationUuid": configModel.customizationUuid,
+ "modelName": configModel.name,
+ "inputs": ""
+ });
+ }
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceName($scope.service.model.service.name);
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+ DataService.setConfigurationInstanceId(configuration.object[FIELD.ID.CONFIGURATION_ID]);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.CONFIGURATION,
+ callbackFunction : deleteCallbackFunction
+ });
+ };
+
$scope.resetProgress = function() {
$scope.percentProgress = 0;
$scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO;
@@ -1055,7 +1181,35 @@ $scope.reloadRoute = function() {
$route.reload();
}
-
+
+
+
+ /*
+ Private metthods
+ */
+
+ /*
+ setPnf
+ * set the controller pnf param using api call
+ * return: void
+ */
+ function _setPnf(data){ // data is the $scope.service.instance object
+ return PnfService.getPnfs(data)
+ .then(
+ function success(response){
+ return response.data;
+ // * can add here changes on the data that are needed to the view ( filter, ect..)
+ },
+ function error(error){
+ console.error(error);
+ }
+ );
+ }
+
+ /*
+ Callbaks functions
+
+ */
var updateProvStatusVnfCallbackFunction = function(response) {
$scope.callbackResults = "";
var color = FIELD.ID.COLOR_NONE;
@@ -1112,7 +1266,7 @@ };
- var deleteCallbackFunction = function(response) {
+ var deleteOrResumeCallback = function(response) {
$scope.callbackResults = "";
var color = FIELD.ID.COLOR_NONE;
$scope.callbackStyle = {
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js index 8844d40a8..967a39002 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js @@ -41,14 +41,13 @@ $scope.services = [];
if (response.data && angular.isArray(response.data.services)) {
wholeData = response.data.services;
- $scope.services = $scope.filterDataWithHigerVersion(wholeData);
+ $scope.services = $scope.filterDataWithHigherVersion(wholeData);
$scope.viewPerPage=10;
$scope.totalPage=$scope.services.length/$scope.viewPerPage;
$scope.sortBy=COMPONENT.NAME;
$scope.scrollViewPerPage=2;
$scope.currentPage=1;
$scope.searchCategory;
- $scope.searchString="";
$scope.currentPageNum=1;
$scope.isSpinnerVisible = false;
$scope.isProgressVisible = false;
@@ -61,67 +60,35 @@ }, function errorCallback(response) {
console.log("Error: " + response);
});
- }
- $scope.isFiltered=function(arr,obj){
- var filtered = false;
- if(arr.length>0){
- for(var i=0;i<arr.length;i++){
- if((arr[i].name == obj.name) && (obj.invariantUUID == arr[i].invariantUUID)){
- filtered = true;
- }
- }
- }
- return filtered;
- }
+ };
+
var wholeData=[];
- $scope.filterDataWithHigerVersion = function(serviceData){
- var fiterDataServices = [];
- for(var i=0;i<serviceData.length;i++){
- var higherVersion = serviceData[i];
- if(!$scope.isFiltered(fiterDataServices,serviceData[i])){
- for(var j=i;j<serviceData.length;j++){
- if((serviceData[i].invariantUUID.trim() == serviceData[j].invariantUUID.trim()) && (serviceData[i].name.trim() == serviceData[j].name.trim()) && (parseFloat(serviceData[j].version.trim())>=parseFloat(serviceData[i].version.trim()))){
- var data = $scope.isThisHigher(fiterDataServices,serviceData[j]);
- if(data.isHigher){
- fiterDataServices[data.index] = serviceData[j];
- }
- }
- }
- }
- }
- return fiterDataServices;
- }
- $scope.isThisHigher = function(arr,obj){
- var returnObj = {
- isHigher:false,
- index:0
- };
- if(arr.length>0){
- var isNotMatched = true;
- for(var i=0;i<arr.length;i++){
- if((arr[i].name == obj.name) && (arr[i].invariantUUID == obj.invariantUUID ) && (arr[i].version<obj.version) ){
- isNotMatched = false;
- returnObj = {
- isHigher:true,
- index:i
- };
+ $scope.filterDataWithHigherVersion = function(serviceData){
+ var delimiter = '$$';
+ var fiterDataServices = {};
+ for(var i=0;i<serviceData.length;i++) {
+ var index = serviceData[i].invariantUUID.trim() + delimiter + serviceData[i].name.trim();
+ if(!fiterDataServices[index]) {
+ var hasPreviousVersion = false;
+ fiterDataServices[index] = {
+ service: serviceData[i],
+ hasPreviousVersion: false
+ };
+ }
+ else {
+ fiterDataServices[index].hasPreviousVersion = true;
+ if(parseFloat(serviceData[i].version.trim())>parseFloat(fiterDataServices[index].service.version.trim())) {
+ fiterDataServices[index].service = serviceData[i];
}
}
- if(isNotMatched && !$scope.isFiltered(arr,obj)){
- returnObj = {
- isHigher:true,
- index:arr.length
- };
- }
- }else{
- returnObj = {
- isHigher:true,
- index:0
- }
}
- return returnObj;
- }
+ return Object.keys(fiterDataServices).map(function(key) {
+ var service = fiterDataServices[key].service;
+ service.hasPreviousVersion = fiterDataServices[key].hasPreviousVersion;
+ return service;
+ });
+ };
$scope.init = function() {
var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js new file mode 100644 index 000000000..6e7ad50cf --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js @@ -0,0 +1,342 @@ +/*- +* ============LICENSE_START======================================================= +* VID +* ================================================================================ +* Copyright (C) 2017 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========================================================= +*/ + +/** + * The Instantiation (or View/Edit) Controller controls the instantiation/removal of + * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups) + */ + +"use strict"; + +appDS2.controller("ServiceProxyConfigController", ["COMPONENT", "$log", "FIELD", "PARAMETER", "DataService", "CreationService", "$scope", "$window", "$location", "AaiService", "$uibModal", "UtilityService", "$timeout", + function (COMPONENT, $log, FIELD, PARAMETER, DataService, CreationService, $scope, $window, $location, AaiService, $uibModal, UtilityService, $timeout) { + + $scope.selectedMetadata = {}; + + $scope.serviceMetadataFields = []; + $scope.nodeTemplateFields = {}; + + $scope.configurationByPolicy = DataService.getConfigurationByPolicy(); + + $scope.collectorType = $scope.configurationByPolicy ? 'pnf' : 'vnf'; //default + $scope.collectorInstance; + $scope.collectorInstanceName = ""; + $scope.collectorInstanceList = null; + $scope.collectorMetadata = []; + $scope.collectorNoResults = false; + + $scope.sourceInstance; + $scope.sourceInstanceName = ""; + $scope.sourceInstanceList = null; + $scope.sourceMetadata = []; + $scope.sourceNoResults = false; + + $scope.errorMsg = FIELD.ERROR.INSTANCE_NAME_VALIDATE; + + $scope.modelName = DataService.getModelInfo(COMPONENT.VNF).modelCustomizationName; + + $scope.serviceTypes = []; + + function init() { + loadServiceTypes(); + + generateMetadata(sourceServiceProxy); + generateMetadata(collectorServiceProxy); + + } + + function setDefaultCollectorServiceType() { + const configServiceType = DataService.getServiceType(); + $scope.collectorServiceType = mustFind($scope.serviceTypes, {"service-type": configServiceType}); + loadCollectorProxies(); + } + + function handleGetServiceTypesResponse(response) { + $scope.serviceTypes = response.data; + setDefaultCollectorServiceType(); + } + + var handleGetParametersResponse = function(parameters) { + $scope.serviceMetadataFields = parameters.summaryList; + $scope.nodeTemplateFields = DataService.getPortMirroningConfigFields(); + }; + + var mustFind = function (collection, predicate) { + const result = _.find(collection, predicate); + const description = "result for find " + JSON.stringify(predicate); + UtilityService.checkUndefined(description, result); + $log.debug(description, result); + return result; + }; + + + $scope.back = function() { + $window.history.back(); + }; + + + function loadServiceTypes() { + const subscriberId = DataService.getGlobalCustomerId(); + AaiService.getSubscriberServiceTypes(subscriberId) + .then(handleGetServiceTypesResponse) + .catch(function (error) { + $log.error(error); + }); + } + + var modalInstance; + + $scope.create = function() { + $scope.disableCreate= true; + var portMirroringConfigFields = DataService.getPortMirroningConfigFields(); + portMirroringConfigFields.sourceInstance = mustFind($scope.sourceInstanceList, {'id': $scope.sourceInstance}); + portMirroringConfigFields.destinationInstance = mustFind($scope.collectorInstanceList, {'id': $scope.collectorInstance}); + + var selectedVnfsList; + + if ($scope.configurationByPolicy) { + selectedVnfsList = [ + portMirroringConfigFields.sourceInstance.properties + ]; + } else { + selectedVnfsList = [ + portMirroringConfigFields.sourceInstance.properties, + portMirroringConfigFields.destinationInstance.properties + ]; + } + + AaiService.getVnfVersionsByInvariantId( + selectedVnfsList.map(function(x) { + return UtilityService.checkUndefined("model-invariant-id", x['model-invariant-id']); + }) + ) + .then(function (response) { + $log.debug("getVnfVersionsByInvariantId: response", response); + + selectedVnfsList + .map(function (inOutProperties) { + const model = mustFind(response.data.model, {'model-invariant-id': inOutProperties['model-invariant-id']}); + + const modelVer = mustFind(model["model-vers"]["model-ver"], {'model-version-id': inOutProperties['model-version-id']}); + + inOutProperties['model-version'] = modelVer['model-version']; + inOutProperties['model-name'] = modelVer['model-name']; + UtilityService.checkUndefined("model-version", modelVer); + }); + }) + + .then(function () { + var requestParams = { + configurationModelInfo: DataService.getModelInfo(COMPONENT.VNF), + relatedTopModelsInfo: DataService.getModelInfo(COMPONENT.SERVICE), + portMirroringConfigFields:portMirroringConfigFields, + attuuid: DataService.getLoggedInUserId(), + topServiceInstanceId: DataService.getServiceInstanceId(), + configurationByPolicy: $scope.configurationByPolicy, + callbackFunction: updateViewCallbackFunction + }; + + modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/mso-commit/mso-commit.html', + controller : "msoCommitModalController", + backdrop: true, + resolve: { + msoType: function () { + return COMPONENT.MSO_CREATE_REQ; + }, + requestParams: function () { + return requestParams; + } + } + }); + }) + .catch(function (error) { + $log.error("error while configuration create", error); + $scope.disableCreate= false; + }); + }; + + $scope.openMetadataModal = function(name) { + $scope.selectedMetadata = $scope[name]; + modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/service-metadata/service-metadata.html', + backdrop: false, + scope : $scope, + resolve: { + } + }); + }; + + $scope.cancel = function() { + modalInstance.dismiss('cancel'); + }; + + var updateViewCallbackFunction = function(response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color" : color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function() { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $window.history.go(-2); + } else { + $scope.disableCreate=false; + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color" : color + }; + }, 500); + }; + + CreationService.initializeComponent(COMPONENT.VNF); + CreationService.initializeComponent(COMPONENT.SERVICE); + CreationService.getParameters(handleGetParametersResponse); + + var sourceServiceProxies = DataService.getSourceServiceProxies(); + var collectorServiceProxies = DataService.getCollectorServiceProxies(); + var serviceProxiesList = DataService.getServiceProxies(); + + var sourceServiceProxy = { + serviceList: sourceServiceProxies, + instanceListScopePropertyName: "sourceInstanceList", + name: "sourceInstanceName", + metadata: "sourceMetadata", + noResults: "sourceNoResults" + }; + + var collectorServiceProxy = { + serviceList: collectorServiceProxies, + instanceListScopePropertyName: "collectorInstanceList", + name: "collectorInstanceName", + metadata: "collectorMetadata", + noResults: "collectorNoResults" + }; + + $scope.onSourceServiceTypeSelected = function() { + clearSourceProxySelection(); + loadSourceProxies(); + }; + + $scope.onCollectorServiceTypeSelected = function() { + clearCollectorProxySelection(); + loadCollectorProxies(); + }; + + function clearSourceProxySelection() { + $scope.sourceInstance = undefined; + } + + function clearCollectorProxySelection() { + $scope.collectorInstance = undefined; + } + + function loadSourceProxies() { + var serviceProxy = serviceProxiesList[(sourceServiceProxy.serviceList)[0]]; + var selectedServiceType = $scope.sourceServiceType['service-type']; + loadProxyInstances(sourceServiceProxy, selectedServiceType, serviceProxy); + } + + function loadCollectorProxies() { + var serviceProxy = serviceProxiesList[(collectorServiceProxy.serviceList)[0]]; + var selectedServiceType = $scope.collectorServiceType['service-type']; + loadProxyInstances(collectorServiceProxy, selectedServiceType, serviceProxy); + } + + function loadProxyInstances(service, serviceType, serviceProxy) { + $scope[service.instanceListScopePropertyName] = null; + // $scope.collectorType = $scope.configurationByPolicy ? 'pnf' : 'vnf'; + var configNodeTemplateFields = DataService.getPortMirroningConfigFields(); + if (service.name == "collectorInstanceName" && $scope.configurationByPolicy) { + var configurationModel = DataService.getModelInfo(COMPONENT.VNF); + AaiService.getPnfInstancesList( + DataService.getGlobalCustomerId(), + serviceType, + serviceProxy.sourceModelUuid, + serviceProxy.sourceModelInvariant, + configNodeTemplateFields.lcpRegion.value, + configurationModel.properties.equip_vendor, + configurationModel.properties.equip_model + ) + .then(function (response) { + var results = response.results || []; + $scope[service.instanceListScopePropertyName] = results; + $scope[service.noResults] = (results.length === 0); + }) + .catch(function (error) { + $scope[service.noResults] = true; + $log.error("No pnf instance found for " + service.name, error); + }); + } else { + AaiService.getVnfInstancesList( + DataService.getGlobalCustomerId(), + serviceType, + serviceProxy.sourceModelUuid, + serviceProxy.sourceModelInvariant, + configNodeTemplateFields.lcpRegion.value + ) + .then(function (response) { + var results = response.results || []; + $scope[service.instanceListScopePropertyName] = results; + $scope[service.noResults] = (results.length === 0); + }) + .catch(function (error) { + $scope[service.noResults] = true; + $log.error("No vnf instance found for " + service.name, error); + }); + } + } + + function generateMetadata(service) { + const serviceProxy = serviceProxiesList[(service.serviceList)[0]]; + $scope[service.name] = serviceProxy.name; + + $scope[service.metadata] = [ + {"name" :"Name" ,"value" : serviceProxy.name}, + {"name" :"Version",value : serviceProxy.version}, + {"name" :"Description", value : serviceProxy.description}, + {"name" :"Type", value : serviceProxy.type}, + {"name" :"Invariant UUID", value : serviceProxy.invariantUuid}, + {"name" :"UUID", value : serviceProxy.uuid}, + {"name" :"Customization UUID", value : serviceProxy.customizationUuid}, + {"name" :"Source Model Uuid", value : serviceProxy.sourceModelUuid}, + {"name" :"Source Model Invariant", value : serviceProxy.sourceModelInvariant}, + {"name" :"Source Model Name", value : serviceProxy.sourceModelName} + ]; + } + + init(); + $scope.$on('$routeChangeStart', function (event, next, current) { + if(next.$$route.originalPath!=="/addNetworkNode"){ + DataService.setPortMirroningConfigFields(null); + } + }); + }]); + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js index b611def42..6129fd96a 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js @@ -20,7 +20,7 @@ (function () {
'use strict';
-
+
appDS2.config(['$routeProvider', '$locationProvider', function ($routeProvider) {
$routeProvider
.when('/models/services', {
@@ -32,30 +32,47 @@ templateUrl: 'app/vid/scripts/view-models/createInstanceServiceModels.htm'
})
.when('/instances/services', {
- templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm",
+ templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm",
controller : "aaiSubscriberController"
})
.when('/instances/subscribers', {
- templateUrl : "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
+ templateUrl : "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
controller : "aaiSubscriberController"
})
.when('/instances/serviceTypes', {
- templateUrl : "app/vid/scripts/view-models/aaiServiceTypes.htm",
+ templateUrl : "app/vid/scripts/view-models/aaiServiceTypes.htm",
controller : "aaiSubscriberController"
})
.when('/instances/subdetails', {
- templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm",
+ templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm",
controller : "aaiSubscriberController"
})
.when('/change-management', {
templateUrl : "app/vid/scripts/view-models/change-management.html",
controller : "changeManagementController",
controllerAs: 'vm'
- })
+ })
+ .when('/testEnvironments', {
+ templateUrl : "app/vid/scripts/view-models/testEnvironments.htm",
+ controller : "testEnvironmentsController",
+ controllerAs: 'vm'
+ })
.when('/instantiate', {
controller: 'InstantiationController',
templateUrl: 'app/vid/scripts/view-models/instantiate.htm'
})
+ .when('/addNetworkNode', {
+ controller: 'AddNetworkNodeController',
+ templateUrl: 'app/vid/scripts/view-models/addNetworkNode.htm'
+ })
+ .when('/pnfSearchAssociation', {
+ controller: 'pnfSearchAssociationController',
+ templateUrl: 'app/vid/scripts/view-models/pnfSearchAssociation.htm'
+ })
+ .when('/serviceProxyConfig', {
+ controller: 'ServiceProxyConfigController',
+ templateUrl: 'app/vid/scripts/view-models/serviceProxyConfig.htm'
+ })
.otherwise({
redirectTo: '/models/services'
});
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 a86c1b1b4..d58b83f69 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 @@ -20,8 +20,8 @@ "use strict";
-appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "VIDCONFIGURATION", "UtilityService", "vidService", "AaiService", "MsoService",
- function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService) {
+appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "$uibModal", "VIDCONFIGURATION", "UtilityService", "vidService", "AaiService", "MsoService", "OwningEntityService", "$q",
+ function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, $uibModal, VIDCONFIGURATION, UtilityService, vidService, AaiService, MsoService, OwningEntityService, $q) {
$scope.showVnfDetails = function (vnf) {
console.log("showVnfDetails");
@@ -121,253 +121,215 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", DataService.setSubscribers($scope.custSubList);
- if (selectedServicetype !== "" && selectedServicetype !== 'undefined') {
- $location.path(COMPONENT.CREATE_INSTANCE_PATH);
- }
- };
-
- $scope.serviceTypeName="";
- $scope.getAaiServiceModelsList = function(){
- var globalCustomerId="";
- var serviceTypeId = DataService.getGlobalCustomerId();
- $scope.serviceTypeList = DataService.getServiceIdList();
- $scope.createSubscriberName = DataService.getSubscriberName();
- $scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG;
- $scope.custSubList = DataService.getSubscribers();
- for(var i=0; i<$scope.serviceTypeList.length;i++){
- if(parseInt(serviceTypeId) === i ){
- $scope.serviceTypeName = $scope.serviceTypeList[i].name;
+ if (selectedServicetype !== "" && selectedServicetype !== 'undefined'&& selectedServicetype !== undefined) {
+ $location.path(COMPONENT.CREATE_INSTANCE_PATH);
+ }
+ };
+
+ $scope.serviceTypeName = "";
+ $scope.getAaiServiceModelsList = function () {
+ var globalCustomerId = "";
+ var serviceTypeId = DataService.getGlobalCustomerId();
+ $scope.serviceTypeList = DataService.getServiceIdList();
+ $scope.createSubscriberName = DataService.getSubscriberName();
+ $scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG;
+ $scope.custSubList = DataService.getSubscribers();
+ for (var i = 0; i < $scope.serviceTypeList.length; i++) {
+ if (parseInt(serviceTypeId) === i) {
+ $scope.serviceTypeName = $scope.serviceTypeList[i].name;
+ }
+ }
+ ;
+ for (var i = 0; i < $scope.custSubList.length; i++) {
+ if ($scope.createSubscriberName === $scope.custSubList[i].subscriberName) {
+ globalCustomerId = $scope.custSubList[i].globalCustomerId;
+ globalCustId = globalCustomerId;
+ }
+ }
+ ;
+ var pathQuery = "";
+
+ if (null !== globalCustomerId && "" !== globalCustomerId && undefined !== globalCustomerId
+ && null !== serviceTypeId && "" !== serviceTypeId && undefined !== serviceTypeId) {
+ pathQuery = COMPONENT.SERVICES_PATH + globalCustomerId + "/" + $scope.serviceTypeName;
+ }
+
+ var namedQueryId = '6e806bc2-8f9b-4534-bb68-be91267ff6c8';
+ AaiService.getServiceModelsByServiceType(namedQueryId, globalCustomerId, $scope.serviceTypeName, function (response) { // success
+ $scope.services = [];
+ if (angular.isArray(response.data['inventory-response-item']) && response.data['inventory-response-item'].length > 0 && response.data['inventory-response-item'][0]['inventory-response-items']) {
+ wholeData = response.data['inventory-response-item'][0]['inventory-response-items']['inventory-response-item'];
+ $scope.services = $scope.filterDataWithHigerVersion(response.data['inventory-response-item'][0]['inventory-response-items']['inventory-response-item']);
+ $scope.serviceType = response.data['inventory-response-item'][0]['service-subscription']['service-type'];
+ $scope.viewPerPage = 10;
+ $scope.totalPage = $scope.services.length / $scope.viewPerPage;
+ $scope.sortBy = "name";
+ $scope.scrollViewPerPage = 2;
+ $scope.currentPage = 1;
+ $scope.searchCategory;
+ $scope.searchString = "";
+ $scope.currentPageNum = 1;
+ $scope.isSpinnerVisible = false;
+ $scope.isProgressVisible = false;
+ } else {
+ $scope.status = "Failed to get service models from ASDC.";
+ $scope.error = true;
+ $scope.isSpinnerVisible = false;
}
- }
- ;
- for(var i=0; i<$scope.custSubList.length;i++){
- if($scope.createSubscriberName === $scope.custSubList[i].subscriberName){
- globalCustomerId = $scope.custSubList[i].globalCustomerId;
- globalCustId = globalCustomerId;
- }
- }
- ;
- var pathQuery ="";
-
- if(null !== globalCustomerId && "" !== globalCustomerId && undefined !== globalCustomerId
- && null !== serviceTypeId && "" !== serviceTypeId && undefined !== serviceTypeId){
- pathQuery = COMPONENT.SERVICES_PATH +globalCustomerId+"/"+$scope.serviceTypeName;
- }
-
- var namedQueryId='6e806bc2-8f9b-4534-bb68-be91267ff6c8';
- AaiService.getServiceModelsByServiceType(namedQueryId,globalCustomerId,$scope.serviceTypeName,function(response) { // success
- $scope.services = [];
- if (angular.isArray(response.data['inventory-response-item']) && response.data['inventory-response-item'].length > 0 && response.data['inventory-response-item'][0]['inventory-response-items']) {
- wholeData = response.data['inventory-response-item'][0]['inventory-response-items']['inventory-response-item'];
- $scope.services = $scope.filterDataWithHigerVersion(response.data['inventory-response-item'][0]['inventory-response-items']['inventory-response-item']);
- $scope.serviceType = response.data['inventory-response-item'][0]['service-subscription']['service-type'];
- $scope.viewPerPage=10;
- $scope.totalPage=$scope.services.length/$scope.viewPerPage;
- $scope.sortBy="name";
- $scope.scrollViewPerPage=2;
- $scope.currentPage=1;
- $scope.searchCategory;
- $scope.searchString="";
- $scope.currentPageNum=1;
- $scope.isSpinnerVisible = false;
- $scope.isProgressVisible = false;
- } else {
- $scope.status = "Failed to get service models from A&AI.";
- $scope.error = true;
- $scope.isSpinnerVisible = false;
- }
- DataService.setServiceIdList(response);
- }, function(response) { // failure
- $scope.showError(FIELD.ERROR.AAI);
- $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICES+ response.status;
- $scope.errorDetails = response.data;
- });
-
- };
-
- var globalCustId;// This value will be assigned only on create new service instance screen-macro
- $scope.createType = "a la carte";
- $scope.deployService = function(service,hideServiceFields) {
- hideServiceFields = hideServiceFields|| false;
- var temp = service;
- service.uuid = service['service-instance']['model-version-id'];
-
- console.log("Instantiating ASDC service " + service.uuid);
-
- $http.get('rest/models/services/' + service.uuid)
- .then(function successCallback(getServiceResponse) {
- getServiceResponse.data['service'].serviceTypeName =$scope.serviceTypeName ;
- getServiceResponse.data['service'].createSubscriberName =$scope.createSubscriberName ;
- var serviceModel = getServiceResponse.data;
- DataService.setServiceName(serviceModel.service.name);
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": serviceModel.service.invariantUuid,
- "modelVersion": serviceModel.service.version,
- "modelNameVersionId": serviceModel.service.uuid,
- "modelName": serviceModel.service.name,
- "description": serviceModel.service.description,"serviceType": serviceModel.service.serviceType,
+ DataService.setServiceIdList(response);
+ }, function (response) { // failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICES + response.status;
+ $scope.errorDetails = response.data;
+ });
+
+ };
+
+ var globalCustId;// This value will be assigned only on create new service instance screen-macro
+ $scope.createType = "a la carte";
+ $scope.deployService = function (service, hideServiceFields) {
+ hideServiceFields = hideServiceFields || false;
+ var temp = service;
+ service.uuid = service['service-instance']['model-version-id'];
+
+ console.log("Instantiating ASDC service " + service.uuid);
+
+ $http.get('rest/models/services/' + service.uuid)
+ .then(function successCallback(getServiceResponse) {
+ getServiceResponse.data['service'].serviceTypeName = $scope.serviceTypeName;
+ getServiceResponse.data['service'].createSubscriberName = $scope.createSubscriberName;
+ var serviceModel = getServiceResponse.data;
+ DataService.setServiceName(serviceModel.service.name);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": serviceModel.service.invariantUuid,
+ "modelVersion": serviceModel.service.version,
+ "modelNameVersionId": serviceModel.service.uuid,
+ "modelName": serviceModel.service.name,
+ "description": serviceModel.service.description,
+ "serviceType": serviceModel.service.serviceType,
"serviceRole": serviceModel.service.serviceRole,
- "category":serviceModel.service.category,
- "serviceTypeName":serviceModel.service.serviceTypeName,
- "createSubscriberName":serviceModel.service.createSubscriberName
- });
- DataService.setHideServiceFields(hideServiceFields);
- if(hideServiceFields){
- DataService.setServiceType($scope.serviceTypeName);
- DataService.setGlobalCustomerId(globalCustId);
- }
-
- DataService.setALaCarte (true);
- $scope.createType = "a la carte";
- var broadcastType = "createComponent";
-
- if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid )) {
- DataService.setALaCarte (false);
- $scope.createType = "Macro";
- var convertedAsdcModel = UtilityService.convertModel(serviceModel);
-
- //console.log ("display inputs ");
- //console.log (JSON.stringify ( convertedAsdcModel.completeDisplayInputs));
-
- DataService.setModelInfo(COMPONENT.SERVICE, {
- "modelInvariantId": serviceModel.service.invariantUuid,
- "modelVersion": serviceModel.service.version,
- "modelNameVersionId": serviceModel.service.uuid,
- "modelName": serviceModel.service.name,
- "description": serviceModel.service.description,
- "category":serviceModel.service.category,
- "serviceEcompNaming": serviceModel.service.serviceEcompNaming,
- "inputs": serviceModel.service.inputs,
- "displayInputs": convertedAsdcModel.completeDisplayInputs,
- "serviceTypeName":serviceModel.service.serviceTypeName,
- "createSubscriberName":serviceModel.service.createSubscriberName,
- "serviceType": serviceModel.service.serviceType,
+ "category": serviceModel.service.category,
+ "serviceTypeName": serviceModel.service.serviceTypeName,
+ "createSubscriberName": serviceModel.service.createSubscriberName
+ });
+ DataService.setHideServiceFields(hideServiceFields);
+ if (hideServiceFields) {
+ DataService.setServiceType($scope.serviceTypeName);
+ DataService.setGlobalCustomerId(globalCustId);
+ }
+
+ DataService.setALaCarte(true);
+ $scope.createType = "a la carte";
+ var broadcastType = "createComponent";
+
+ if (UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid)) {
+ DataService.setALaCarte(false);
+ $scope.createType = "Macro";
+ var convertedAsdcModel = UtilityService.convertModel(serviceModel);
+
+ //console.log ("display inputs ");
+ //console.log (JSON.stringify ( convertedAsdcModel.completeDisplayInputs));
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": serviceModel.service.invariantUuid,
+ "modelVersion": serviceModel.service.version,
+ "modelNameVersionId": serviceModel.service.uuid,
+ "modelName": serviceModel.service.name,
+ "description": serviceModel.service.description,
+ "category": serviceModel.service.category,
+ "serviceEcompNaming": serviceModel.service.serviceEcompNaming,
+ "inputs": serviceModel.service.inputs,
+ "displayInputs": convertedAsdcModel.completeDisplayInputs,
+ "serviceTypeName": serviceModel.service.serviceTypeName,
+ "createSubscriberName": serviceModel.service.createSubscriberName,
+ "serviceType": serviceModel.service.serviceType,
"serviceRole": serviceModel.service.serviceRole
- });}
- ;
-
- $scope.$broadcast(broadcastType, {
- componentId : COMPONENT.SERVICE,
- callbackFunction : function(response) {
- if (response.isSuccessful) {
- vidService.setModel(serviceModel);
-
- var subscriberId = "Not Found";
- var serviceType = "Not Found";
-
- var serviceInstanceId = response.instanceId;
-
- for (var i = 0; i < response.control.length; i++) {
- if (response.control[i].id == "subscriberName") {
- subscriberId = response.control[i].value;
- } else if (response.control[i].id == "serviceType") {
- serviceType = response.control[i].value;
- }
- }
-
-
- $scope.refreshSubs(subscriberId,serviceType,serviceInstanceId);
-
- }
- }
- });
-
- }, function errorCallback(response) {
- console.log("Error: " + response);
- });
- };
- $scope.isFiltered=function(arr,obj){
- var filtered = false;
- if(arr.length>0){
- for(var i=0;i<arr.length;i++){
- if(obj['extra-properties']['extra-property'] && (obj['extra-properties']['extra-property'][2]['property-value'] == arr[i]['extra-properties']['extra-property'][2]['property-value'])
- && (obj['extra-properties']['extra-property'][4]['property-value'] == arr[i]['extra-properties']['extra-property'][4]['property-value'])){
- filtered = true;
- }
- }
- }
- return filtered;
- }
- var wholeData=[];
- $scope.filterDataWithHigerVersion = function(serviceData){
- var fiterDataServices = [];
- for(var i=0;i<serviceData.length;i++){
- var higherVersion = serviceData[i];
- if(!$scope.isFiltered(fiterDataServices,serviceData[i])){
- for(var j=i;j<serviceData.length;j++){
- if(serviceData[i]['extra-properties']['extra-property'] && serviceData[j]['extra-properties']['extra-property'] && (serviceData[i]['extra-properties']['extra-property'][4]['property-value'] == serviceData[j]['extra-properties']['extra-property'][4]['property-value'])
- && (serviceData[i]['extra-properties']['extra-property'][2]['property-value'] == serviceData[j]['extra-properties']['extra-property'][2]['property-value'])
- && (parseFloat(serviceData[j]['extra-properties']['extra-property'][6]['property-value'])>=parseFloat(serviceData[i]['extra-properties']['extra-property'][6]['property-value']))){
- var data = $scope.isThisHigher(fiterDataServices,serviceData[j]);
- if(data.isHigher){
- fiterDataServices[data.index] = serviceData[j];
- }
- }
- }
- }
- }
- return fiterDataServices;
- }
-
- $scope.isThisHigher = function(arr,obj){
- var returnObj = {
- isHigher:false,
- index:0
- };
- if(arr.length>0){
- var isNotMatched = true;
- for(var i=0;i<arr.length;i++){
- if(arr[i]['extra-properties']['extra-property'] && (arr[i]['extra-properties']['extra-property'][2]['property-value'] == obj['extra-properties']['extra-property'][2]['property-value'])
- && (arr[i]['extra-properties']['extra-property'][4]['property-value'] == obj['extra-properties']['extra-property'][4]['property-value'] )
- && (arr[i]['extra-properties']['extra-property'][6]['property-value'] < obj['extra-properties']['extra-property'][6]['property-value']) ){
- isNotMatched = false;
- returnObj = {
- isHigher:true,
- index:i
- };
- }
- }
- if(isNotMatched && !$scope.isFiltered(arr,obj)){
- returnObj = {
- isHigher:true,
- index:arr.length
- };
- }
- }else{
- returnObj = {
- isHigher:true,
- index:0
- }
- }
- return returnObj;
- }
-
- $scope.tableData=[];
- var oldData=[];
- $scope.loadPreviousVersionData=function(version,invariantUUID){
- $scope.tableData =[];
- oldData=[];
- for(var i=0;i<wholeData.length;i++){
- if(wholeData[i]['extra-properties']['extra-property'] && wholeData[i]['extra-properties']['extra-property'][4]['property-value'] == invariantUUID && version!=wholeData[i]['extra-properties']['extra-property'][6]['property-value']){
- oldData.push(wholeData[i]);
- }
- }
- $scope.tableData = oldData;
- $scope.createType = "Previous Version";
- var broadcastType = "createTableComponent";
- $scope.componentName = invariantUUID;
- $scope.$broadcast(broadcastType, {
- componentId : COMPONENT.OLDVERSION,
- callbackFunction : function(response) {
- }
- });
- }
- $scope.cancelCreateSIType = function(){
-
- window.location.href = COMPONENT.SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH;
-
- }
+ });
+ }
+ ;
+
+ $scope.$broadcast(broadcastType, {
+ componentId: COMPONENT.SERVICE,
+ callbackFunction: function (response) {
+ if (response.isSuccessful) {
+ vidService.setModel(serviceModel);
+
+ var subscriberId = "Not Found";
+ var serviceType = "Not Found";
+
+ var serviceInstanceId = response.instanceId;
+
+ for (var i = 0; i < response.control.length; i++) {
+ if (response.control[i].id == "subscriberName") {
+ subscriberId = response.control[i].value;
+ } else if (response.control[i].id == "serviceType") {
+ serviceType = response.control[i].value;
+ }
+ }
+
+
+ $scope.refreshSubs(subscriberId, serviceType, serviceInstanceId);
+
+ }
+ }
+ });
+
+ }, function errorCallback(response) {
+ $log.error("Error: ", response);
+ });
+ };
+
+ var wholeData=[];
+ //extract all models from service instances properties and filter by the higher model version
+ $scope.filterDataWithHigerVersion = function(serviceData){
+
+ //get all service instances & models collected into array. key = model invariant id
+ var servicesByModelInvariant = _.reduce(serviceData, function(result, item) {
+ if (item['extra-properties']['extra-property']) {
+ var invariantId = item['extra-properties']['extra-property'][4];
+ if (invariantId) {
+ (result[invariantId["property-value"]] || (result[invariantId["property-value"]] = [])).push(item);
+ }
+ }
+ return result;
+ }, {});
+
+ //iterate over the array and get the highest model version for each group of services
+ var filterDataServicesByVersion = [];
+ _.forEach(servicesByModelInvariant, function(items) {
+ var maxVersionItem = _.maxBy(items, function(item) { return parseFloat(item['extra-properties']['extra-property'][6]["property-value"]); });
+ filterDataServicesByVersion.push(maxVersionItem);
+ });
+
+ return filterDataServicesByVersion;
+ };
+
+ $scope.tableData = [];
+ var oldData = [];
+ $scope.loadPreviousVersionData = function (version, invariantUUID) {
+ $scope.tableData = [];
+ oldData = [];
+ for (var i = 0; i < wholeData.length; i++) {
+ if (wholeData[i]['extra-properties']['extra-property'] && wholeData[i]['extra-properties']['extra-property'][4]['property-value'] == invariantUUID && version != wholeData[i]['extra-properties']['extra-property'][6]['property-value']) {
+ oldData.push(wholeData[i]);
+ }
+ }
+ $scope.tableData = oldData;
+ $scope.createType = "Previous Version";
+ var broadcastType = "createTableComponent";
+ $scope.componentName = invariantUUID;
+ $scope.$broadcast(broadcastType, {
+ componentId: COMPONENT.OLDVERSION,
+ callbackFunction: function (response) {
+ }
+ });
+ }
+ $scope.cancelCreateSIType = function () {
+
+ window.location.href = COMPONENT.SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH;
+
+ }
$scope.fetchServices = function () {
var serviceIdList = [];
@@ -379,7 +341,7 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICES + response.status;
$scope.errorDetails = response.data;
});
- }
+ };
$scope.refreshSubs = function () {
$scope.init();
@@ -387,10 +349,20 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.fetchServices();
};
+ $scope.loadOwningEntity = function () {
+ OwningEntityService.getOwningEntityProperties(function (response) {
+ $scope.owningEntities = response.owningEntity;
+ $scope.projects = response.project;
+
+ // working project name: owning-entity-id-val-cp8128
+ // working owning entity name: owning-entity-id-val-cp8128
+ });
+ };
+
$scope.fetchSubs = function (status) {
$scope.status = status;
- AaiService.getSubList(function (response) { // sucesss
+ AaiService.getSubList(function (response) {
$scope.setProgress(100); // done
$scope.status = FIELD.STATUS.DONE;
$scope.isSpinnerVisible = false;
@@ -408,16 +380,23 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", }
- $scope.getSubDetails = function (request) {
+ $scope.getSubDetails = function () {
$scope.init();
- $scope.selectedSubscriber = $location.search().selectedSubscriber;
- $scope.selectedServiceInstance = $location.search().selectedServiceInstance;
+ //$scope.selectedSubscriber = $location.search().selectedSubscriber;
+ // $scope.selectedServiceInstance = $location.search().selectedServiceInstance;
$scope.status = FIELD.STATUS.FETCHING_SUB_DETAILS + $scope.selectedSubscriber;
+ var query = $location.url().replace($location.path(),'');
$scope.displayData = [];
- AaiService.getSubDetails($scope.selectedSubscriber, $scope.selectedServiceInstance, function (displayData, subscriberName) {
- $scope.displayData = displayData;
+ AaiService.searchServiceInstances(query).then(function (response) {
+ $scope.displayData = response.displayData;
+ if (response.displayData.length)
+ {
+ var first = response.displayData[0];
+ $scope.selectedSubscriberId = first.globalCustomerId;
+ $scope.selectedSubscriberName = first.subscriberName;
+ }
$scope.viewPerPage = 10;
$scope.totalPage = $scope.displayData.length / $scope.viewPerPage;
$scope.scrollViewPerPage = 2;
@@ -429,13 +408,13 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.setProgress(100); // done
$scope.status = FIELD.STATUS.DONE;
$scope.isSpinnerVisible = false;
- $scope.subscriberName = subscriberName;
- }, function (response) {
+
+ }).catch(function (response) {
$scope.showError(FIELD.ERROR.AAI);
$scope.errorMsg = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.status;
$scope.errorDetails = response.data;
});
- }
+ };
$scope.$on(COMPONENT.MSO_DELETE_REQ, function (event, request) {
@@ -452,7 +431,6 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", });
$scope.init = function () {
-
//PropertyService.setAaiBaseUrl("testaai");
//PropertyService.setAsdcBaseUrl("testasdc");
@@ -529,37 +507,67 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", alert(response.statusText);
}
- $scope.getAsdcModel = function (disData) {
+ function getModelVersionIdForServiceInstance(instance) {
+ if (UtilityService.hasContents(instance.aaiModelVersionId)) {
+ return $q.resolve(instance.aaiModelVersionId);
+ } else {
+ return AaiService.getModelVersionId(instance.globalCustomerId, instance.serviceInstanceId);
+ }
+ }
- console.log("disData");
- console.log(JSON.stringify(disData, null, 4));
+ $scope.onViewEditClick = function (disData) {
+ $log.debug("disData", disData, null, 4);
- // if ( !(UtilityService.hasContents (disData.aaiModelVersionId)) ) {
- // $scope.errorMsg = FIELD.ERROR.MODEL_VERSION_ID_MISSING;
- // alert($scope.errorMsg);
- // return;
- // }
+ getModelVersionIdForServiceInstance(disData)
+ .then(getAsdcModelByVersionId, handleErrorGettingModelVersion)
+ .then(navigateToViewEditPage);
- // aaiModelVersionId is the model uuid
- var pathQuery = COMPONENT.SERVICES_PATH + disData.aaiModelVersionId;
- $http({
- method: 'GET',
- url: pathQuery
- }).then(function successCallback(response) {
- vidService.setModel(response.data);
+
+ function navigateToViewEditPage() {
window.location.href =
COMPONENT.INSTANTIATE_ROOT_PATH + disData.globalCustomerId +
COMPONENT.SUBSCRIBERNAME_SUB_PATH + disData.subscriberName +
COMPONENT.SERVICETYPE_SUB_PATH + disData.serviceType +
COMPONENT.SERVICEINSTANCEID_SUB_PATH + disData.serviceInstanceId +
COMPONENT.IS_PERMITTED_SUB_PATH + disData.isPermitted;
+ }
+ };
+
+ function handleErrorGettingModelVersion(err) {
+ $log.error("aaiSubscriber getModelVersionIdForServiceInstance - " + err);
+ $scope.errorMsg = err;
+ alert($scope.errorMsg);
+ return $q.reject();
+ }
+
+ function getAsdcModelByVersionId(aaiModelVersionId) {
+ // aaiModelVersionId is the model uuid
+ var pathQuery = COMPONENT.SERVICES_PATH + aaiModelVersionId;
+ return $http({
+ method: 'GET',
+ url: pathQuery
+ }).then(function successCallback(response) {
+ vidService.setModel(response.data);
console.log("aaiSubscriber getAsdcModel DONE!!!!");
}, function errorCallback(response) {
- console.log("aaiSubscriber getAsdcModel - No matching model found matching the A&AI model version ID = " + disData.aaiModelVersionId);
- $scope.errorMsg = FIELD.ERROR.NO_MATCHING_MODEL_AAI + disData.aaiModelVersionId;
+ $log.error("aaiSubscriber getAsdcModel - " + FIELD.ERROR.NO_MATCHING_MODEL_AAI + aaiModelVersionId);
+ $scope.errorMsg = FIELD.ERROR.NO_MATCHING_MODEL_AAI + aaiModelVersionId;
alert($scope.errorMsg);
});
+ }
+ function returnMatchingServiceSubscription(serviceSubs, serviceId){
+ var orchStatus;
+ serviceSubs.forEach(function(item){
+ if (item[FIELD.ID.SERVICE_INSTANCES] != null) {
+ item[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE].forEach(function (service) {
+ if (service[FIELD.ID.SERVICE_INSTANCE_ID] === serviceId) {
+ orchStatus = service['orchestration-status']
+ }
+ })
+ }
+ });
+ return orchStatus;
}
$scope.getTenants = function (globalCustomerId) {
@@ -572,10 +580,26 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", });
}
+ $scope.isActivateDeactivateEnabled = function(btnType) {
+ if ($scope.serviceOrchestrationStatus && $scope.service.model.service.serviceType.toLowerCase().indexOf('transport') != -1) {
+ switch (btnType) {
+ case "activate":
+ return $scope.serviceOrchestrationStatus === 'Created' ||
+ $scope.serviceOrchestrationStatus.toLowerCase() === 'pendingdelete' || $scope.serviceOrchestrationStatus.toLowerCase() === 'pending-delete';
+ break;
+ case "deactivate":
+ return $scope.serviceOrchestrationStatus === 'Active';
+ break;
+ }
+ }
+
+ return false;
+ };
+
$scope.handleInitialResponseInventoryItems = function (response) {
$scope.inventoryResponseItemList = response.data[FIELD.ID.INVENTORY_RESPONSE_ITEM]; // get data from json
- console.log($scope.inventoryResponseItemList.toString());
+ $log.debug($scope.inventoryResponseItemList);
$scope.displayData = [];
$scope.vnfs = [];
@@ -585,8 +609,9 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.subscriberName = "";
// just look up the subscriber name in A&AI here...
AaiService.getSubscriberName($scope.globalCustomerId, function (response) {
- $scope.subscriberName = response;
+ $scope.subscriberName = response.subscriberName;
DataService.setSubscriberName($scope.subscriberName);
+ $scope.serviceOrchestrationStatus = returnMatchingServiceSubscription(response.serviceSubscriptions[FIELD.ID.SERVICE_SUBSCRIPTION], $scope.serviceInstanceId);
angular.forEach($scope.inventoryResponseItemList, function (inventoryResponseItem, key) {
@@ -609,12 +634,13 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", "type": PARAMETER.STRING,
"description": FIELD.PROMPT.VAR_DESCRIPTION_B,
"default": FIELD.PROMPT.DEFAULT_B
- },
+ }
},
"object": $scope.inventoryResponseItem[FIELD.ID.SERVICE_INSTANCE],
"vnfs": [],
- "networks": []
- }
+ "networks": [],
+ "configurations": []
+ };
if (inventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
@@ -760,6 +786,44 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", });
}
}
+
+ if (subInventoryResponseItem[FIELD.ID.GENERIC_CONFIGURATION] != null) {
+ var configObject = subInventoryResponseItem[FIELD.ID.GENERIC_CONFIGURATION];
+ var config = {
+ "id": $scope.counter++,
+ "name": configObject[FIELD.ID.CONFIGURATION_NAME],
+ "itemType": FIELD.ID.CONFIGURATION,
+ "nodeId": configObject[FIELD.ID.CONFIGURATION_ID],
+ "nodeType": configObject[FIELD.ID.CONFIGURATION_TYPE],
+ "nodeStatus": configObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "modelInvariantId": configObject[FIELD.ID.MODEL_INVAR_ID],
+ "modelVersionId": configObject[FIELD.ID.MODEL_VERSION_ID],
+ "modelCustomizationId": configObject[FIELD.ID.MODEL_CUSTOMIZATION_ID],
+ "object": configObject,
+ "ports": []
+ };
+
+ $scope.allowConfigurationActions = [FIELD.STATUS.AAI_ACTIVE, FIELD.STATUS.AAI_INACTIVE, FIELD.STATUS.AAI_CREATED].indexOf(config.nodeStatus) != -1;
+
+ if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+ angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function (subSubInventoryResponseItem, key) {
+ var port = {};
+ var portObject;
+ if (subSubInventoryResponseItem[FIELD.ID.PORT] != null) {
+ portObject = subSubInventoryResponseItem[FIELD.ID.PORT];
+ port = {
+ "portId": portObject[FIELD.ID.PORT_ID],
+ "portName": portObject[FIELD.ID.PORT_NAME],
+ "portStatus": portObject[FIELD.ID.PORT_MIRRORED] === true ? FIELD.STATUS.AAI_ENABLED : FIELD.ID.AAI_DISABLED,
+ "object": portObject
+ };
+ config.ports.push(port);
+ }
+ });
+ }
+ $scope.service.instance[FIELD.ID.CONFIGURATIONS].push(config);
+ }
+
});
}
});
@@ -901,63 +965,239 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.currentPage--;
}
- $scope.activateMSOInstance = function() {
- MsoService.activateInstance($scope.service.instance, $scope.service.model)
- .then(function(response) {
- alert("Activation succeeded");
- })
- .catch(function (error) {
- $log.error(error);
+ var getAicZoneAndSendToMso = function (msoType, requestParams) {
+ AaiService.getAicZoneForPNF(
+ $scope.service.instance.globalCustomerId,
+ $scope.service.instance.serviceType,
+ $scope.service.instance.serviceInstanceId, function (aicZone) {
+
+ requestParams.aicZone = aicZone;
+
+ openMsoModal(msoType, requestParams);
});
- ;
+ };
+
+ var activateDeactivateServiceInstance = function(msoType) {
+ var requestParams = {
+ model: $scope.service.model,
+ instance: $scope.service.instance
+ };
+
+ if (DataService.getLoggedInUserId()) {
+ requestParams.userId = DataService.getLoggedInUserId();
+ getAicZoneAndSendToMso(msoType, requestParams)
+ } else {
+ AaiService.getLoggedInUserID(function (response) {
+ var userID = response.data;
+ DataService.setLoggedInUserId(userID);
+ requestParams.userId = userID;
+
+ getAicZoneAndSendToMso(msoType, requestParams);
+ });
+ }
+ };
+
+ $scope.activateMSOInstance = function() {
+
+ activateDeactivateServiceInstance(COMPONENT.MSO_ACTIVATE_SERVICE_REQ);
+ };
+
+ $scope.deactivateMSOInstance = function() {
+
+ activateDeactivateServiceInstance(COMPONENT.MSO_DEACTIVATE_SERVICE_REQ);
+ };
+
+ $scope.toggleConfigurationStatus = function (serviceObject, configuration) {
+
+
+ AaiService.getLoggedInUserID(function (response) {
+ DataService.setLoggedInUserId(response.data);
+ var requestParams = {
+ serviceModel: {
+ "modelType": "service",
+ "modelInvariantId": serviceObject.model.service.invariantUuid,
+ "modelVersionId": "uuid",
+ "modelName": serviceObject.model.service.name,
+ "modelVersion": serviceObject.model.service.version
+ },
+ configurationModel: {
+ "modelType": "configuration",
+ "modelInvariantId": configuration.modelInvariantId,
+ "modelVersionId": configuration.modelVersionId,
+ "modelCustomizationId": configuration.modelCustomizationId
+ },
+ serviceInstanceId: serviceObject.instance.serviceInstanceId,
+ configurationId: configuration.nodeId,
+ configStatus: configuration.nodeStatus,
+ userId: DataService.getLoggedInUserId()
+ };
+
+ openMsoModal(COMPONENT.MSO_CHANGE_CONFIG_STATUS_REQ, requestParams);
+ });
+
+ };
+
+ $scope.togglePortStatus = function(serviceObject, configuration, port) {
+
+ var requestParams = {
+ serviceInstanceId: serviceObject.instance.serviceInstanceId,
+ configurationId: configuration.nodeId,
+ portId: port.portId,
+ portStatus: port.portStatus,
+ serviceModel: {
+ "modelType": "service",
+ "modelInvariantId": serviceObject.model.service.invariantUuid,
+ "modelVersionId": "uuid",
+ "modelName": serviceObject.model.service.name,
+ "modelVersion": serviceObject.model.service.version
+ },
+ configurationModel: {
+ "modelType": "configuration",
+ "modelInvariantId": configuration.modelInvariantId,
+ "modelVersionId": configuration.modelVersionId,
+ "modelCustomizationId": configuration.modelCustomizationId
+ },
+ userId: DataService.getLoggedInUserId()
+ };
+
+ openMsoModal(COMPONENT.MSO_CHANGE_PORT_STATUS_REQ, requestParams);
+ };
+
+ $scope.dissociatePnf = function(pnfName) {
+
+ var jobInfo = {
+ status: "confirm",
+ message: "Are you sure you would like to dissociate " + pnfName + " from the service instance?"
+ };
+
+ var modalInstance = $uibModal.open({
+ templateUrl: 'app/vid/scripts/modals/alert-modal/alert-modal.html',
+ controller: 'alertModalController',
+ controllerAs: 'vm',
+ appendTo: angular.element("#pnfs-tree"),
+ resolve: {
+ jobInfo: function () {
+ return jobInfo;
+ }
+ }
+ });
+
+ modalInstance.result.then(function (result) {
+ console.log("This is the result of the alert modal.", result);
+
+ if (result) {
+ var requestParams = {
+ pnf: pnfName,
+ serviceModelInfo: {
+ invariantUuid: $scope.service.model.service.invariantUuid,
+ uuid: $scope.service.model.service.uuid,
+ version: $scope.service.model.service.version,
+ name: $scope.service.model.service.name
+ },
+ serviceInstanceId: $scope.service.instance.serviceInstanceId
+ };
+
+ if (DataService.getLoggedInUserId()) {
+ requestParams.attuuid = DataService.getLoggedInUserId();
+ openMsoModal(COMPONENT.MSO_REMOVE_RELATIONSHIP, requestParams);
+ } else {
+ AaiService.getLoggedInUserID(function (response) {
+ DataService.setLoggedInUserId(response.data);
+
+ requestParams.attuuid = response.data;
+ openMsoModal(COMPONENT.MSO_REMOVE_RELATIONSHIP, requestParams);
+ });
+ }
+ }
+ });
+
+
+ };
+
+ var openMsoModal = function (msoType, requestParams) {
+ var 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 = updateViewCallbackFunction;
+ return requestParams;
+ }
+ }
+ });
+ };
+
+ var updateViewCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $scope.reloadRoute();
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
};
$scope.nextPage = function () {
$scope.currentPage++;
+ };
+
+ $scope.serviceInstanceses = [{"sinstance": FIELD.NAME.SERVICE_INSTANCE_Id}, {"sinstance": FIELD.NAME.SERVICE_INSTANCE_NAME}];
+
+ function navigateToSearchResultsPage(globalCustomerId, selectedServiceInstance, selectedProjects, selectedOwningEntities) {
+ var projectQuery = AaiService.getMultipleValueParamQueryString(_.map(selectedProjects, 'id'), COMPONENT.PROJECT_SUB_PATH);
+ var owningEntityQuery = AaiService.getMultipleValueParamQueryString(_.map(selectedOwningEntities, 'id'), COMPONENT.OWNING_ENTITY_SUB_PATH);
+ var globalCustomerIdQuery = globalCustomerId ? COMPONENT.SELECTED_SUBSCRIBER_SUB_PATH + globalCustomerId : null;
+ var serviceInstanceQuery = selectedServiceInstance ? COMPONENT.SELECTED_SERVICE_INSTANCE_SUB_PATH + selectedServiceInstance : null;
+ var query = AaiService.getJoinedQueryString([projectQuery, owningEntityQuery, globalCustomerIdQuery, serviceInstanceQuery]);
+
+ window.location.href = COMPONENT.SELECTED_SERVICE_SUB_PATH + query;
}
- $scope.serviceInstanceses = [{"sinstance": FIELD.NAME.SERVICE_INSTANCE_Id}, {"sinstance": FIELD.NAME.SERVICE_INSTANCE_NAME}]
- $scope.getSubscriberDet = function (selectedCustomer, selectedserviceinstancetype, selectedServiceInstance) {
-
- var sintype = selectedserviceinstancetype;
- if (selectedServiceInstance != "" && selectedServiceInstance != undefined) {
- selectedServiceInstance.trim();
-
- // check with A&AI
- $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + selectedServiceInstance + "/" + sintype + "?r=" + Math.random(), {}, {
- timeout: $scope.responseTimeoutMsec
- }).then(function (response) {
- var notFound = true;
- if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
- var item = [];
- var urlParts = [];
- item = response.data[FIELD.ID.RESULT_DATA][0];
- var url = item[FIELD.ID.RESOURCE_LINK];
- var globalCustomerId = "";
- var serviceSubscription = "";
- // split it and find the customer Id and service-subscription
- urlParts = url.split("/");
- if (urlParts[7] === FIELD.ID.CUSTOMER) {
- globalCustomerId = urlParts[8];
- }
- if (urlParts[10] === FIELD.ID.SERVICE_SUBSCRIPTION) {
- serviceSubscription = urlParts[11];
- }
- if (globalCustomerId !== "") {
- notFound = false;
- window.location.href = COMPONENT.SELECTED_SERVICE_SUB_PATH + serviceSubscription + COMPONENT.SELECTEDSUBSCRIBER_SUB_PATH + globalCustomerId + COMPONENT.SELECTEDSERVICEINSTANCE_SUB_PATH + selectedServiceInstance;
- }
+ $scope.getServiceInstancesSearchResults =
+ function (selectedCustomer, selectedInstanceIdentifierType, selectedServiceInstance, selectedProject, selectedOwningEntity) {
+ var isSelectionValid = UtilityService.hasContents(selectedCustomer) || UtilityService.hasContents(selectedProject)
+ || UtilityService.hasContents(selectedOwningEntity) || UtilityService.hasContents(selectedServiceInstance);
+
+ if (isSelectionValid) {
+ if (UtilityService.hasContents(selectedServiceInstance)) {
+ AaiService
+ .getGlobalCustomerIdByInstanceIdentifier(selectedServiceInstance, selectedInstanceIdentifierType)
+ .then(handleCustomerIdResponse);
+ } else {
+ navigateToSearchResultsPage(selectedCustomer, null, selectedProject, selectedOwningEntity);
}
- if (notFound) {
+ } else {
+ alert(FIELD.ERROR.SELECT);
+ }
+
+ function handleCustomerIdResponse(globalCustomerId) {
+ if (UtilityService.hasContents(globalCustomerId)) {
+ navigateToSearchResultsPage(globalCustomerId, selectedServiceInstance, selectedProject, selectedOwningEntity);
+ } else {
alert(FIELD.ERROR.SERVICE_INST_DNE);
}
- }); // add a failure callback...
- } else if (selectedCustomer != null) {
- window.location.href = COMPONENT.SELECTED_SUB_PATH + selectedCustomer;
- } else {
- alert(FIELD.ERROR.SELECT);
- }
- };
+ }
+ };
}]).directive('restrictInput', function () {
return {
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 662b10ecd..273f13017 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 @@ -1,12 +1,15 @@ (function () { 'use strict'; - appDS2.controller("changeManagementController", ["$uibModal", "changeManagementService", "_", "$log", changeManagementController]); + appDS2.controller("changeManagementController", ["$uibModal", "changeManagementService", "_", "$log", "SchedulerService", "$filter", changeManagementController]); - function changeManagementController($uibModal, changeManagementService, _, $log) { + function changeManagementController($uibModal, changeManagementService, _, $log, SchedulerService, $filter) { var vm = this; - var init = function() { + vm.lastTimeUpdated = ""; + + vm.init = function() { + vm.lastTimeUpdated = $filter('date')(new Date(), "MM/dd/yyyy | HH:mm:ss"); loadMSOChangeManagements(); loadSchedulerChangeManagements(); }; @@ -26,16 +29,16 @@ .then(function(response) { vm.pendingChangeManagements = response.data; _.forEach(vm.pendingChangeManagements, function(changeManagement) { - var callbackData = _.filter(changeManagement.scheduleRequest.domainData, {name: "CallbackData"}); + var callbackData = _.filter(changeManagement.scheduleRequest.domainData, {name: "WorkflowName"}); if(callbackData) { var parsedModel = {}; try { - parsedModel = JSON.parse(callbackData[0].value); + parsedModel = callbackData[0].value; } catch(exception) { $log.error(exception); } - changeManagement.workflow = parsedModel.requestType || 'No workflow'; + changeManagement.workflow = parsedModel; } }); }) @@ -57,10 +60,6 @@ }); }; - vm.openScheduler = function() { - console.log("function for opening the scheduler app") - }; - vm.searchChanges = function() { console.log("function for searching changes: " + vm.searchChangesTerm) }; @@ -74,7 +73,8 @@ jobInfo: function () { return jobInfo; } - } + }, + }); modalInstance.result.then(function (result) { @@ -115,12 +115,12 @@ console.log("This is the result of the alert change management modal.", result); }); }; - - vm.openPendingModal = function(jobInfo) { + vm.openBasicAlertModal = function(jobInfo) { var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/pending-change-management/pending-change-management.html', - controller: 'changeManagementManualTasksController', + templateUrl: 'app/vid/scripts/modals/alert-modal/alert-modal.html', + controller: 'alertModalController', controllerAs: 'vm', + appendTo: angular.element(".jobs-table").eq(0), resolve: { jobInfo: function () { return jobInfo; @@ -129,10 +129,51 @@ }); modalInstance.result.then(function (result) { - console.log("This is the result of the pending change management modal.", result); + console.log("This is the result of the alert change management modal.", result); }); }; + vm.openPendingModal = function($event, changeManagement) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html', + controller: 'cancelPendingWorkflowController', + controllerAs: 'vm', + backdrop: false, + animation: true, + appendTo: angular.element($event.currentTarget).parent(), + resolve: { + changeManagement: function () { + return changeManagement; + } + } + }); + + modalInstance.result.then(function (result) { + // send to service + if(result){ + SchedulerService.cancelScheduleRequest(changeManagement.scheduleRequest.scheduleId, + function(response) { + + //success popup + var jobInfo= { + status:"success", + message: "Cancel workflow "+changeManagement.scheduleRequest.scheduleName+" succeeded."}; + vm.openBasicAlertModal(jobInfo); + + return response; + }, function(error) { + + //failed popup + var jobInfo = { + status:"failed", + message: "Cancel workflow "+changeManagement.scheduleRequest.scheduleName+" failed due to an unexpected error."}; + vm.openBasicAlertModal(jobInfo); + + }); + }}); + + }; + - init(); + vm.init(); } })();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js index 499a1ec02..9715484d4 100755..100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js @@ -1,123 +1,148 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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 deletionDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log,
- DeletionService, UtilityService) {
-
- $scope.isDialogVisible = false;
- $scope.summaryControl = {};
- $scope.userProvidedControl = {};
-
- var callbackFunction = undefined;
- var componentId = undefined;
-
- $scope.$on(COMPONENT.DELETE_COMPONENT, function(event, request) {
-
- $scope.isDataVisible = false;
- $scope.isSpinnerVisible = false;
- $scope.isErrorVisible = false;
- $scope.isDialogVisible = true;
- $scope.popup.isVisible = true;
- $scope.isConfirmEnabled = false;
-
- callbackFunction = request.callbackFunction;
- componentId = request.componentId;
-
- DeletionService.initializeComponent(request.componentId);
-
- $scope.componentName = DeletionService.getComponentDisplayName();
-
- $scope.summaryControl.setList(DeletionService.getSummaryList());
-
- DeletionService.getParameters(handleGetParametersResponse);
-
- });
-
- var handleGetParametersResponse = function(parameters, dontshow) {
- $scope.summaryControl.setList(parameters.summaryList);
- $scope.userProvidedControl.setList(parameters.userProvidedList);
-
- $scope.isSpinnerVisible = false;
- if (dontshow)
- $scope.isDataVisible = false;
- else
- $scope.isDataVisible = true;
- $scope.isConfirmEnabled = true;
- };
-
- $scope.userParameterChanged = function(id) {
- DeletionService.updateUserParameterList(id, $scope.userProvidedControl);
- }
-
- $scope.confirm = function() {
-
- var requiredFields = $scope.userProvidedControl.getRequiredFields();
- if (requiredFields === "") {
- $scope.isErrorVisible = false;
- } else {
- showError(FIELD.ERROR.MISSING_DATA, requiredFields);
- return;
- }
-
-
- var requestDetails = DeletionService.getMsoRequestDetails($scope.userProvidedControl.getList());
-
- if(DeletionService.isMacro === true){
- requestDetails.requestParameters.aLaCarte = false;
- }
-
- $scope.isDialogVisible = false;
-
- $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
- url : DeletionService.getMsoUrl(),
- requestDetails : requestDetails,
- componentId: componentId,
- callbackFunction : function(isSuccessful) {
- if (isSuccessful) {
- $scope.popup.isVisible = false;
- runCallback(true);
- } else {
- $scope.isDialogVisible = true;
- }
- }
- });
-
- }
-
- $scope.cancel = function() {
- $scope.isDialogVisible = false;
- $scope.popup.isVisible = false;
- runCallback(false);
- }
-
- var runCallback = function(isSuccessful) {
- if (angular.isFunction(callbackFunction)) {
- callbackFunction({
- isSuccessful : isSuccessful
- });
- }
- }
-}
-
-appDS2.controller("deletionDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
- "$timeout", "$log", "DeletionService", "UtilityService",
- deletionDialogController ]);
+/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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 deleteResumeDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log, + DeleteResumeService, CreationService, UtilityService) { + + $scope.isDialogVisible = false; + $scope.summaryControl = {}; + $scope.userProvidedControl = {}; + + var callbackFunction = undefined; + var componentId = undefined; + + $scope.$on(COMPONENT.DELETE_RESUME_COMPONENT, function(event, request) { + + $scope.isDataVisible = false; + $scope.isSpinnerVisible = false; + $scope.isErrorVisible = false; + $scope.isDialogVisible = true; + $scope.popup.isVisible = true; + $scope.isConfirmEnabled = false; + $scope.dialogMethod = request.dialogMethod; + callbackFunction = request.callbackFunction; + componentId = request.componentId; + + DeleteResumeService.initializeComponent(request.componentId); + + $scope.componentName = DeleteResumeService.getComponentDisplayName(); + + $scope.summaryControl.setList(DeleteResumeService.getSummaryList()); + + DeleteResumeService.getParameters(handleGetParametersResponse); + + }); + + var handleGetParametersResponse = function(parameters, dontshow) { + $scope.summaryControl.setList(parameters.summaryList); + $scope.userProvidedControl.setList(parameters.userProvidedList); + + $scope.isSpinnerVisible = false; + if (dontshow) + $scope.isDataVisible = false; + else + $scope.isDataVisible = true; + $scope.isConfirmEnabled = true; + }; + + $scope.userParameterChanged = function(id) { + DeleteResumeService.updateUserParameterList(id, $scope.userProvidedControl); + } + + $scope.confirm = function() { + var requiredFields = $scope.userProvidedControl.getRequiredFields(); + if (requiredFields === "") { + $scope.isErrorVisible = false; + } else { + showError(FIELD.ERROR.MISSING_DATA, requiredFields); + return; + } + + + + var callbackAfterMSO = function(isSuccessful) { + if (isSuccessful) { + $scope.popup.isVisible = false; + runCallback(true); + } else { + $scope.isDialogVisible = true; + } + }; + + + $scope.isDialogVisible = false; + + if ($scope.dialogMethod == COMPONENT.DELETE) + { + + var requestDetails = DeleteResumeService.getMsoRequestDetails($scope.userProvidedControl.getList()); + + if(DeleteResumeService.isMacro === true){ + requestDetails.requestParameters.aLaCarte = false; + } + + $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, { + url : DeleteResumeService.getMsoUrl(), + requestDetails : requestDetails, + componentId: componentId, + callbackFunction : callbackAfterMSO + }); + } + else + if ($scope.dialogMethod == COMPONENT.RESUME) + { + CreationService.initializeComponent(componentId); + CreationService.setInventoryInfo(); + + var requestDetails = CreationService.getMsoRequestDetails($scope.userProvidedControl.getList()); + + + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url : CreationService.getMsoUrl(), + requestDetails : requestDetails, + componentId: componentId, + callbackFunction : callbackAfterMSO + }); + + + } + + } + + $scope.cancel = function() { + $scope.isDialogVisible = false; + $scope.popup.isVisible = false; + runCallback(false); + } + + var runCallback = function(isSuccessful) { + if (angular.isFunction(callbackFunction)) { + callbackFunction({ + isSuccessful : isSuccessful + }); + } + } +} + +appDS2.controller("deleteResumeDialogController", [ "COMPONENT", "FIELD", "$scope", "$http", + "$timeout", "$log", "DeleteResumeService","CreationService", "UtilityService", + deleteResumeDialogController]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js index 65fac289a..dd3ba50f0 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js @@ -64,25 +64,42 @@ */
var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $window, $log,
- MsoService, PropertyService, UtilityService, DataService) {
+ MsoService, PropertyService, UtilityService, TestEnvironmentsService) {
$scope.isViewVisible = false;
$scope.progressBarControl = {};
$scope.popupWindowControl = {};
-
+ var getRequestStatusFunc = getOrchestrationRequestStatus; //default
var _this = this;
$scope.$on("createInstance", function(event, request) {
- init(request, COMPONENT.MSO_CREATE_REQ );
+ init(request, COMPONENT.MSO_CREATE_REQ, getOrchestrationRequestStatus );
MsoService.createInstance(request, handleInitialResponse);
});
$scope.$on("deleteInstance", function(event, request) {
- init(request, COMPONENT.MSO_DELETE_REQ);
+ init(request, COMPONENT.MSO_DELETE_REQ, getOrchestrationRequestStatus);
MsoService.deleteInstance(request, handleInitialResponse);
});
- var init = function(request, msoRequestType ) {
+ $scope.$on(COMPONENT.MSO_CREATE_ENVIRONMENT, function(event, request) {
+ init(request, COMPONENT.MSO_CREATE_ENVIRONMENT, getCloudResourcesRequestStatus);
+ TestEnvironmentsService.createApplicationEnv(request).then(handleInitialResponse);
+ });
+
+ $scope.$on(COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, function(event, request) {
+ init(request, COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, getCloudResourcesRequestStatus);
+ TestEnvironmentsService.deactivateApplicationEnv(request).then(handleInitialResponse)
+ });
+
+ $scope.$on(COMPONENT.MSO_ACTIVATE_ENVIRONMENT, function(event, request) {
+ init(request, COMPONENT.MSO_ACTIVATE_ENVIRONMENT, getCloudResourcesRequestStatus);
+ TestEnvironmentsService.activateApplicationEnv(request).then(handleInitialResponse)
+ });
+
+
+ var init = function(request, msoRequestType, getStatusRequest ) {
+ getRequestStatusFunc = getStatusRequest;
$scope.status = FIELD.STATUS.SUBMITTING_REQUEST;
$scope.isSpinnerVisible = true;
$scope.isProgressVisible = true;
@@ -109,13 +126,13 @@ var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $w showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
.getHttpErrorMessage(response));
});
- }
+ };
var handleInitialResponse = function(response) {
try {
updateViewAfterInitialResponse(response);
- _this.timer = $timeout(getRequestStatus, PropertyService
+ _this.timer = $timeout(getRequestStatusFunc, PropertyService
.getMsoMaxPollingIntervalMsec());
$scope.instanceId = response.data.entity.instanceId;
@@ -133,11 +150,16 @@ var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $w }
}
- var getRequestStatus = function() {
- MsoService.getOrchestrationRequest(_this.requestId, handleGetResponse);
+ function getOrchestrationRequestStatus() {
+ MsoService.getOrchestrationRequest(_this.requestId, handleGetStatusResponse);
}
- var handleGetResponse = function(response) {
+ function getCloudResourcesRequestStatus() {
+ TestEnvironmentsService.getRequestStatus(_this.requestId, handleGetStatusResponse);
+ }
+
+
+ var handleGetStatusResponse = function(response) {
try {
if (isUpdateViewAfterGetResponseComplete(response)) {
return;
@@ -147,7 +169,7 @@ var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $w _this.isMsoError = true;
showError(FIELD.ERROR.MAX_POLLS_EXCEEDED);
} else {
- _this.timer = $timeout(getRequestStatus, PropertyService
+ _this.timer = $timeout(getRequestStatusFunc, PropertyService
.getMsoMaxPollingIntervalMsec());
}
} catch (error) {
@@ -296,5 +318,5 @@ var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $w }
appDS2.controller("msoCommitController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout",
- "$window", "$log", "MsoService", "PropertyService", "UtilityService",
+ "$window", "$log", "MsoService", "PropertyService", "UtilityService", "TestEnvironmentsService",
msoCommitController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js new file mode 100644 index 000000000..148b4ccec --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js @@ -0,0 +1,237 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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 msoCommitModalController = function(COMPONENT, FIELD, $scope, $http, $timeout, $window, $log, + MsoService, PropertyService, UtilityService, DataService, $uibModalInstance, msoType, requestParams, vidService) { + + $scope.isSpinnerVisible = true; + $scope.isProgressVisible = true; + $scope.status = FIELD.STATUS.SUBMITTING_REQUEST; + $scope.error = ""; + $scope.log = ""; + $scope.progressBarControl = {}; + $scope.isCloseEnabled = false; + + var _this = this; + _this.pollAttempts = 0; + _this.callbackFunction = requestParams.callbackFunction; + _this.isMsoError = false; + + + if (angular.isFunction($scope.progressBarControl.reset)) { + $scope.progressBarControl.reset(); + } + $scope.percentProgress = 2; // Show "a little" progress + + + /* + * Updates the view and returns "true" if the MSO operation has returned a + * "Complete" status. + */ + var isUpdateViewAfterGetResponseComplete = function(response) { + //console.log("msoCommitController isUpdateViewAfterGetResponseComplete"); + updateLogFinalResponse(response); + + var requestStatus = UtilityService.checkUndefined(FIELD.ID.REQUEST_STATUS, + UtilityService.checkUndefined(FIELD.ID.REQUEST, + response.data.entity.request).requestStatus); + + var requestState = requestStatus.requestState; + console.log("msoCommitController requestState=" + requestState); + // look for "progress" or "pending" + var patt1 = /progress/i; + var patt2 = /pending/i; + var result1 = patt1.test(requestState); + var result2 = patt2.test(requestState); + if (result1 || result2) { + requestState = FIELD.STATUS.IN_PROGRESS; + } + var statusMessage = requestStatus.statusMessage; + console.log("msoCommitController statusMessage=" + statusMessage); + if (UtilityService.hasContents(statusMessage)) { + $scope.status = requestState + " - " + statusMessage; + } else { + $scope.status = requestState; + } + if (UtilityService.hasContents(requestStatus.percentProgress)) { + $scope.percentProgress = requestStatus.percentProgress; + } + + if ( (requestState.toLowerCase() === FIELD.STATUS.FAILED.toLowerCase()) || (requestState.toLowerCase() === FIELD.STATUS.UNLOCKED.toLowerCase())) { + throw { + type : FIELD.STATUS.MSO_FAILURE + }; + } + + if (requestState.toLowerCase() === FIELD.STATUS.COMPLETE.toLowerCase()) { + $scope.isSpinnerVisible = false; + return true; + } + + return false; + }; + + var handleGetResponse = function(response) { + try { + if (isUpdateViewAfterGetResponseComplete(response)) { + return; + } + if (++_this.pollAttempts > PropertyService.getMsoMaxPolls()) { + _this.isMsoError = true; + showError(FIELD.ERROR.MAX_POLLS_EXCEEDED); + } else { + _this.timer = $timeout(getRequestStatus, PropertyService + .getMsoMaxPollingIntervalMsec()); + } + } catch (error) { + _this.isMsoError = true; + MsoService.showResponseContentError(error, showError); + } + }; + + var showError = function(summary, details) { + var message = summary; + if (UtilityService.hasContents(details)) { + message += " (" + details + ")"; + } + $scope.isSpinnerVisible = false; + $scope.isProgressVisible = false; + $scope.error = message; + $scope.status = FIELD.STATUS.ERROR; + }; + + var getRequestStatus = function() { + MsoService.getOrchestrationRequest(_this.requestId, handleGetResponse); + }; + + var updateLog = function(response) { + $scope.log = MsoService.getFormattedCommonResponse(response) + + $scope.log; + UtilityService.checkUndefined("entity", response.data.entity); + UtilityService.checkUndefined("status", response.data.status); + MsoService.checkValidStatus(response); + }; + + var updateLogFinalResponse = function(response) { + $scope.log = MsoService.getFormattedSingleGetOrchestrationRequestResponse(response) + + $scope.log; + UtilityService.checkUndefined("entity", response.data.entity); + UtilityService.checkUndefined("status", response.data.status); + MsoService.checkValidStatus(response); + }; + + var updateViewAfterInitialResponse = function(response) { + $scope.isCloseEnabled = true; + updateLog(response); + + _this.requestId = UtilityService.checkUndefined(FIELD.ID.REQUEST_ID, + UtilityService.checkUndefined(FIELD.ID.REQUEST_REFERENCES, + response.data.entity.requestReferences).requestId); + + $scope.percentProgress = 4; // Show "a little more" progress + $scope.status = FIELD.STATUS.IN_PROGRESS; + }; + + var init = function(msoType) { + switch(msoType) { + case COMPONENT.MSO_CREATE_REQ: + return MsoService.createConfigurationInstance(requestParams); + case COMPONENT.MSO_CHANGE_CONFIG_STATUS_REQ: + return MsoService.toggleConfigurationStatus(requestParams); + case COMPONENT.MSO_CHANGE_PORT_STATUS_REQ: + return MsoService.togglePortStatus(requestParams); + case COMPONENT.MSO_CREATE_REALATIONSHIP: + return MsoService.associatePnf(requestParams); + case COMPONENT.MSO_REMOVE_RELATIONSHIP: + return MsoService.dissociatePnf(requestParams); + case COMPONENT.MSO_ACTIVATE_SERVICE_REQ: + return MsoService.activateInstance(requestParams); + case COMPONENT.MSO_DEACTIVATE_SERVICE_REQ: + return MsoService.deactivateInstance(requestParams); + } + }; + + var successCallbackFunction = function(response) { + try { + updateViewAfterInitialResponse(response); + _this.timer = $timeout(getRequestStatus, PropertyService + .getMsoMaxPollingIntervalMsec()); + + $scope.instanceId = response.data.entity.instanceId; + if ($scope.instanceId == null) { + $scope.instanceId = response.data.entity.requestReferences.instanceId; + } + } catch (error) { + if ( response.data != null && response.data.status != null ) { + if (response.data.status > 299 || response.data.status < 200 ) { + // MSO returned an error + _this.isMsoError = true; + } + } + MsoService.showResponseContentError(error, showError); + } + }; + + var errorCallbackFunction = function (error) { + UtilityService.setHttpErrorHandler(function(error) { + $scope.isCloseEnabled = true; + _this.isMsoError = true; + showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService + .getHttpErrorMessage(error)); + }); + }; + + $scope.close = function() { + $uibModalInstance.dismiss('cancel'); + + if (_this.timer !== undefined) { + $timeout.cancel(_this.timer); + } + + if (angular.isFunction(_this.callbackFunction)) { + if ($scope.error === "") { + _this.callbackFunction({ + isSuccessful : true, + instanceId : $scope.instanceId + }); + } else { + _this.callbackFunction({ + isSuccessful : false + }); + } + } + }; + + _this.msoRequestType = msoType; + + init(_this.msoRequestType) + .then(function (response) { + successCallbackFunction(response); + }) + .catch(function (error) { + errorCallbackFunction(error); + }); +}; + +appDS2.controller("msoCommitModalController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout", + "$window", "$log", "MsoService", "PropertyService", "UtilityService", "DataService", "$uibModalInstance", "msoType", "requestParams", "vidService", + msoCommitModalController ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js new file mode 100644 index 000000000..22a20abf8 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js @@ -0,0 +1,138 @@ +/*- +* ============LICENSE_START======================================================= +* VID +* ================================================================================ +* Copyright (C) 2017 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========================================================= +*/ + +/** + * The Instantiation (or View/Edit) Controller controls the instantiation/removal of + * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups) + */ + +"use strict"; + +appDS2.controller("pnfSearchAssociationController", ["COMPONENT", "$log", "FIELD", "PARAMETER", "DataService", "CreationService", "$scope", "$window", "$location", "AaiService", "$uibModal", "UtilityService", "vidService", "$timeout", + function (COMPONENT, $log, FIELD, PARAMETER, DataService, CreationService, $scope, $window, $location, AaiService, $uibModal, UtilityService, vidService, $timeout) { + + var requestParams = {}; + + $scope.selectedMetadata = {}; + + $scope.serviceMetadataFields = []; + $scope.nodeTemplateFields = {}; + + $scope.pnfInstance= false; + $scope.notFound= false; + + $scope.pnfMetadata = []; + + $scope.errorMsg = FIELD.ERROR.INSTANCE_NAME_VALIDATE; + + $scope.modelName = DataService.getModelInfo(COMPONENT.VNF).modelCustomizationName; + + var handleGetParametersResponse = function(parameters) { + $scope.serviceMetadataFields = parameters.summaryList; + $scope.serviceMetadataFields.forEach(function (t, number) { + $scope.serviceMetadataFields[number].key = $scope.serviceMetadataFields[number].name.split(' ').join('') + }) + $scope.nodeTemplateFields = _.keyBy(parameters.userProvidedList, 'id'); + }; + + CreationService.initializeComponent(COMPONENT.VNF); + + CreationService.getParameters(handleGetParametersResponse); + + $scope.back = function() { + $window.history.back(); + }; + + $scope.searchPnf = function(pnfName) { + $scope.pnfInstance= false; + $scope.notFound=false; + + AaiService.getPnfByName(pnfName) + .then(function (response) { + $scope.pnfInstance = response.data; + requestParams.pnf = response.data.pnfName; + }) + .catch(function (error) { + $scope.pnfNameNotFound= pnfName; + $scope.notFound= true; + }); + + } + var modalInstance; + + $scope.associate = function() { + + requestParams.serviceModelInfo = vidService.getModel().service; + requestParams.attuuid = DataService.getLoggedInUserId(); + requestParams.instanceId = DataService.getServiceInstanceId(); + + modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/mso-commit/mso-commit.html', + controller: "msoCommitModalController", + backdrop: false, + resolve: { + msoType: function () { + return COMPONENT.MSO_CREATE_REALATIONSHIP; + }, + requestParams: function () { + requestParams.callbackFunction = updateViewCallbackFunction; + return requestParams; + } + } + }) + + + }; + + var updateViewCallbackFunction = function(response) { + $scope.callbackResults = ""; + var color = FIELD.ID.COLOR_NONE; + $scope.callbackStyle = { + "background-color" : color + }; + + /* + * This 1/2 delay was only added to visually highlight the status + * change. Probably not needed in the real application code. + */ + $timeout(function() { + $scope.callbackResults = UtilityService.getCurrentTime() + + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful; + if (response.isSuccessful) { + color = FIELD.ID.COLOR_8F8; + $scope.back(); + } else { + color = FIELD.ID.COLOR_F88; + } + $scope.callbackStyle = { + "background-color" : color + }; + }, 500); + }; + + + $scope.cancel = function() { + modalInstance.dismiss('cancel'); + }; + + + }]); + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js new file mode 100644 index 000000000..f5c3a0e0a --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js @@ -0,0 +1,102 @@ +(function () { + 'use strict'; + + appDS2.controller("testEnvironmentsController", ["$uibModal", "TestEnvironmentsService", "$log", "$rootScope", "$scope", "COMPONENT", testEnvironmentsController]); + + function testEnvironmentsController($uibModal, TestEnvironmentsService, $log, $rootScope, $scope, COMPONENT) { + var vm = this; + + var toggleValue; + + var init = function() { + vm.loadAAIestEnvironments(); + }; + + vm.loadAAIestEnvironments = function() { + TestEnvironmentsService.loadAAIestEnvironments("VNF") + .then(function(response) { + vm.environments = response.operationalEnvironment; + vm.connectError = false; + if(!vm.environments.length) { + vm.emptyData = true; + } + }) + .catch(function (error) { + vm.connectError = error.message || "Unknown error"; + $log.error(error); + }); + }; + + function handleEnvActionComplete(result) { + if (result.isSuccessful) { + vm.loadAAIestEnvironments(); + } + $scope.popup.isVisible = false; + } + + vm.onTestEnvActivateClick = function(testEnv) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.html', + controller: 'attachTestEnvManifestController', + controllerAs: 'vm', + resolve: {} + }); + + modalInstance.result.then(function (result) { + if (result) { + + var relatedEcompEnv = _.find(testEnv.relationshipList.relationship, { relatedTo: "operational-environment" }); + + var manifest = result; + var envId = testEnv.operationalEnvironmentId; + var relatedInstanceId = + _.find(relatedEcompEnv.relationshipData, {"relationshipKey": "operational-environment.operational-environment-id"}) + .relationshipValue; + var relatedInstanceName = + _.find(relatedEcompEnv.relatedToProperty, {"propertyKey": "operational-environment.operational-name"}) + .propertyValue; + var workloadContext = testEnv.workloadContext; + + $rootScope.$broadcast(COMPONENT.MSO_ACTIVATE_ENVIRONMENT, { + url: COMPONENT.MSO_ACTIVATE_ENVIRONMENT, + envId: envId, + relatedInstanceId: relatedInstanceId, + relatedInstanceName: relatedInstanceName, + workloadContext: workloadContext, + manifest: manifest, + callbackFunction: handleEnvActionComplete + }); + + } + }); + }; + + vm.onTestEnvDeactivateClick = function(testEnv) { + var envId = testEnv.operationalEnvironmentId; + $rootScope.$broadcast(COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, { + url : COMPONENT.MSO_DEACTIVATE_ENVIRONMENT, + envId : envId, + callbackFunction: handleEnvActionComplete + }); + }; + + vm.isEnvActive = function(testEnv) { + return testEnv.operationalEnvironmentStatus==='Activate'; + }; + + vm.getEnvStatus = function (testEnv) { + return this.isEnvActive(testEnv) ? "Active" : "Inactive"; + }; + + vm.createNewTestEnvironment = function() { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/new-test-environment/new-test-environment.html', + controller: 'newTestEnvironmentModalController', + controllerAs: 'vm', + resolve: {} + }); + }; + + init(); + } +})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/messageViewer.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/messageViewer.js new file mode 100644 index 000000000..8ff67fac1 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/messageViewer.js @@ -0,0 +1,17 @@ +"use strict"; + +appDS2.directive('messageViewer', function() { + return { + restrict : "E", + templateUrl: 'app/vid/scripts/view-models/messageViewer.htm', + scope: { + primaryMessage:'@', + icon:'@', + secondaryMessage:'@', + tryAgain:'&' + }, + link: function(scope, elem, attrs) { + scope.showTryAgain = angular.isDefined(attrs.tryAgain); + } + } +});
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js index e57b43ec4..d36b3823f 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js @@ -20,7 +20,7 @@ "use strict";
-var parameterBlockDirective = function($log, PARAMETER, UtilityService) {
+var parameterBlockDirective = function($log, PARAMETER, UtilityService, $compile) {
/*
* If "IS_SINGLE_OPTION_AUTO_SELECTED" is set to "true" ...
*
@@ -221,6 +221,9 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { + additionalStyle + "'>" + getOptionListHtml(parameter)
+ "</select>";
break;
+ case PARAMETER.MULTI_SELECT:
+ return '<multiselect id="' + parameter.id + '"' + attributeString + ' ng-model="multiselectModel.' + parameter.id + '" options="getOptionsList(\'' + parameter.id + '\')" display-prop="name" id-prop="id"></multiselect>';
+ break;
case PARAMETER.STRING:
default:
var value = "";
@@ -255,9 +258,7 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { }
if (UtilityService.hasContents(parameter.prompt)) {
- if (!(IS_SINGLE_OPTION_AUTO_SELECTED && parameter.optionList.length === 1) || !(parameter.isSingleOptionAutoSelected && parameter.optionList.length === 1)) {
html += "<option value=''>" + parameter.prompt + "</option>";
- }
}
for (var i = 0; i < parameter.optionList.length; i++) {
@@ -298,7 +299,7 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { var getParameter = function(element, expectedId) {
var id = $(element).attr("parameter-id");
- if (expectedId !== undefined && expectedId !== id) {
+ if (!id || (expectedId !== undefined && expectedId !== id)) {
return undefined;
}
var parameter = {
@@ -327,14 +328,20 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { };
var getRequiredField = function(element) {
- if ($(element).prop("type") === "text") {
- $(element).val($(element).val().trim());
+ if($(element).is("multiselect")) {
+ if(!$(element).find(".active").text().trim()) {
+ return '"' + $(element).attr("parameter-name") + '"';
+ }
}
- if ($(element).val() === "" || $(element).val() === null) {
- return '"' + $(element).attr("parameter-name") + '"';
- } else {
- return "";
+ else {
+ if ($(element).prop("type") === "text") {
+ $(element).val($(element).val().trim());
+ }
+ if ($(element).val() === "" || $(element).val() === null) {
+ return '"' + $(element).attr("parameter-name") + '"';
+ }
}
+ return "";
};
var callback = function(element, scope) {
@@ -354,13 +361,20 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { link : function(scope, element, attrs) {
var control = scope.control || {};
+ scope.multiselectModel = {};
+ scope.getOptionsList = function (parameterId) {
+ return _.find(scope.parameterList, {'id': parameterId})["optionList"];
+ };
control.setList = function(parameterList) {
+ scope.parameterList = parameterList;
+ scope.multiselectModel = {};
var html = "";
for (var i = 0; i < parameterList.length; i++) {
html += getParameterHtml(parameterList[i], attrs.editable);
}
- element.html(html);
+ element.replaceWith($compile(element.html(html))(scope));
+
element.find("input, select").bind("change", function() {
callback(this, scope);
});
@@ -390,13 +404,16 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { parameterList.push(parameter);
}
});
+ angular.forEach(scope.multiselectModel, function(value, key) {
+ parameterList.push({id: key, value: value});
+ });
return parameterList;
}
control.getRequiredFields = function() {
var requiredFields = "";
var count = 0;
- element.find("input, select").each(function() {
+ element.find("input, select, multiselect").each(function() {
if ($(this).attr("is-required") === "true") {
var requiredField = getRequiredField(this);
if (requiredField !== "") {
@@ -418,7 +435,7 @@ var parameterBlockDirective = function($log, PARAMETER, UtilityService) { }
}
-appDS2.directive('parameterBlock', [ "$log", "PARAMETER", "UtilityService",
+appDS2.directive('parameterBlock', [ "$log", "PARAMETER", "UtilityService", "$compile",
parameterBlockDirective ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js.orig b/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js.orig deleted file mode 100644 index 0e937826a..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js.orig +++ /dev/null @@ -1,507 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 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 parameterBlockDirective = function($log, PARAMETER, UtilityService) { - /* - * If "IS_SINGLE_OPTION_AUTO_SELECTED" is set to "true" ... - * - * IF these 3 conditions all exist: - * - * 1) The parameter type is PARAMETER.SELECT - * - * 2) AND the "prompt" attribute is set to a string. - * - * 3) AND the optionList" only contains a single entry - * - * THEN the "prompt" will not be displayed as an initial select option. - */ - - var IS_SINGLE_OPTION_AUTO_SELECTED = true; - - /* - * Optionally remove "nameStyle" and "valueStyle" "width" entries to set - * dynamic sizing. - */ - var tableStyle = "width: auto; margin: 0 auto; border-collapse: collapse; border: none;"; - var nameStyle = "width: 220px; text-align: left; vertical-align: middle; font-weight: bold; padding: 3px 5px; border: none;"; - var valueStyle = "width: 400px; text-align: left; vertical-align: middle; padding: 3px 5px; border: none;"; - var checkboxValueStyle = "width: 400px; text-align: center; vertical-align: middle; padding: 3px 5px; border: none;" - var textInputStyle = "height: 25px; padding: 2px 5px;"; - var checkboxInputStyle = "height: 18px; width: 18px; padding: 2px 5px;"; - var selectStyle = "height: 25px; padding: 2px; text-align: center;"; - var requiredLabelStyle = "width: 25px; padding: 5px 10px 10px 5px;"; - - - var getParameterHtml = function(parameter, editable) { - var style = valueStyle; - var attributeString = ""; - if (parameter.type === PARAMETER.BOOLEAN) { - style = checkboxValueStyle; - } - if (UtilityService.hasContents(parameter.description)) { - attributeString += " title=' " + parameter.description + " '"; - } - var rowstyle=''; - if(parameter.type == 'file' && !parameter.isVisiblity){ - rowstyle = ' style="display:none;"'; - } - var html = "<tr"+rowstyle+"><td style='" + nameStyle + "'" + attributeString + ">" - + getNameHtml(parameter) + "</td>"; - if (editable === undefined) { - if (UtilityService.hasContents(parameter.value)) { - html += "<td data-tests-id='" + getParameterName(parameter) + "' style='" + style + "'>" + parameter.value; - } else { - html += "<td data-tests-id='" + getParameterName(parameter) + "' style='" + style + "'>"; - } - } else { - html += "<td style='" + style + "'>" + getValueHtml(parameter); - } - html += "</td></tr>"; - return html; - }; - - var updateParameter = function(parameter, element, editable) { - $(element).parent().parent().children("td").first().html( - getNameHtml(parameter)); - if (editable === undefined) { - $(element).html(parameter.value); - } else { - $(element).parent().html(getValueHtml(parameter)); - } - }; - - var getNameHtml = function(parameter) { - if (parameter.isVisible === false) { - return ""; - } - var name = getParameterName(parameter); - - var requiredLabel = ""; - if (parameter.isRequired) { - requiredLabel = "<img src='app/vid/images/asterisk.png' style='" - + requiredLabelStyle + "'></img>"; - } - return name + ":" + requiredLabel; - }; - - var getParameterName = function(parameter) { - var name = ""; - if (UtilityService.hasContents(parameter.name)) { - name = parameter.name; - } else { - name = parameter.id; - } - return name; - } - - var getValueHtml = function(parameter) { - - var textInputPrompt = "Enter data"; - var attributeString = " data-tests-id='" + parameter.id +"' parameter-id='" + parameter.id + "'"; - var additionalStyle = ""; - if (parameter.isEnabled === false) { - attributeString += " disabled='disabled'"; - } - if (parameter.isRequired) { - attributeString += " is-required='true'"; - } - if (UtilityService.hasContents(parameter.description)) { - attributeString += " title=' " + parameter.description + " '"; - } - if (UtilityService.hasContents(parameter.isReadOnly) && (parameter.isReadOnly === true)) { - attributeString += " readonly"; - } - if ( (UtilityService.hasContents(parameter.maxLength)) && (UtilityService.hasContents(parameter.minLength)) ) { - attributeString += " pattern='.{" + parameter.minLength + "," + parameter.maxLength + "}' required"; - } - else if (UtilityService.hasContents(parameter.maxLength)) { - attributeString += " maxlength='" + parameter.maxLength + "'"; - } - else if (UtilityService.hasContents(parameter.minLength)) { - attributeString += " pattern='.{" + parameter.minLength + ",}'" - } - if (parameter.isVisible === false) { - additionalStyle = " visibility: hidden;"; - } - - var name = ""; - if (UtilityService.hasContents(parameter.name)) { - name = parameter.name; - } else { - name = parameter.id; - } - attributeString += " parameter-name='" + name + "'"; - - if ( parameter.type === PARAMETER.MAP ) { - textInputPrompt = "{<key1>: <value1>,\.\.\.,<keyN>: <valueN>}"; - } - - if ( parameter.type === PARAMETER.LIST ) { - textInputPrompt = "[<value1>,\.\.\.,<valueN>]"; - } - - switch (parameter.type) { - case PARAMETER.BOOLEAN: - if (parameter.value) { - return "<select" + attributeString + " style='" + selectStyle - + additionalStyle + "'>" + "<option value=true>true</option>" - + "<option value=false>false</option>"; - + "</select>"; - }else{ - return "<select" + attributeString + " style='" + selectStyle - + additionalStyle + "'>" + "<option value=false>false</option>" - + "<option value=true>true</option>" - + "</select>"; - } - break; - case PARAMETER.CHECKBOX: - if (parameter.value) { - return "<input type='checkbox' "+attributeString+ " checked='checked' style='"+checkboxInputStyle+"'" - + " value='true'/>"; - }else{ - return "<input type='checkbox' "+attributeString+ "' style='"+checkboxInputStyle+"'" - + " value='false'/>"; - } - break; - case PARAMETER.FILE: - return "<input type='file' "+attributeString+ " id='"+parameter.id+"' value='"+parameter.value+"'/>"; - break; - case PARAMETER.NUMBER: - var value=parameter.value; - var parameterSpec = "<input type='number'" + attributeString + " style='" + textInputStyle + additionalStyle + "'"; - - if ( UtilityService.hasContents(parameter.min) ) { - parameterSpec += " min='" + parameter.min + "'"; - } - if ( UtilityService.hasContents(parameter.max) ) { - parameterSpec += " max='" + parameter.max + "'"; - } - if (UtilityService.hasContents(value)) { - parameterSpec += " value='" + value + "'"; - } - parameterSpec += ">"; - - /*if(!isNaN(value) && value.toString().index('.') != -1){ - //float - return "<input type='text'" + attributeString + " style='" - + textInputStyle + additionalStyle + "' only-integers" + value - + "></input>"; - } else { - //integer - return "<input type='text'" + attributeString + " style='" - + textInputStyle + additionalStyle + "' only-float" + value - + "></input>"; - }*/ - return (parameterSpec); - break; - case PARAMETER.SELECT: - if (UtilityService.hasContents(parameter.prompt)) { - attributeString += " prompt='" + parameter.prompt + "'"; - } - return "<select" + attributeString + " style='" + selectStyle - + additionalStyle + "'>" + getOptionListHtml(parameter) - + "</select>"; - break; - case PARAMETER.STRING: - default: - var value = ""; - if (UtilityService.hasContents(parameter.value)) { - value = " value='" + parameter.value + "'"; - } - if (UtilityService.hasContents(parameter.prompt)) { - attributeString += " placeholder='" + parameter.prompt + "'"; - } else if (textInputPrompt !== "") { - attributeString += " placeholder='" + textInputPrompt + "'"; - } - var finalString = "<input type='text'" + attributeString + " style='" - + textInputStyle + additionalStyle + "'" + value - + ">"; - return finalString; - } - }; - - - var getBooleanListHtml = function(parameter){ - var html = ""; - - }; - - var getOptionListHtml = function(parameter) { - -<<<<<<< HEAD - var html = ""; - - if (!angular.isArray(parameter.optionList) - || parameter.optionList.length === 0) { - return ""; - } - - if (UtilityService.hasContents(parameter.prompt)) { - if (!(IS_SINGLE_OPTION_AUTO_SELECTED && parameter.optionList.length === 1) || !(parameter.isSingleOptionAutoSelected && parameter.optionList.length === 1)) { - html += "<option value=''>" + parameter.prompt + "</option>"; - } - } - - for (var i = 0; i < parameter.optionList.length; i++) { - var option = parameter.optionList[i]; - var name = option.name; - var value = ""; - if (option.id === undefined) { - value = option.name; - } else { - if (name === undefined) { - name = option.id; - } - value = option.id; - } - if (option.isDefault === undefined || option.isDefault === false ) { - html += "<option value='" + value + "'>" + name + "</option>"; - } - else { - html += "<option value='" + value + "' selected>" + name + "</option>"; - } - } - return html; -======= - var html = ""; - - if (!angular.isArray(parameter.optionList) - || parameter.optionList.length === 0) { - return ""; - } - - if (UtilityService.hasContents(parameter.prompt)) { - if (!(IS_SINGLE_OPTION_AUTO_SELECTED && parameter.optionList.length === 1)) { - html += "<option value=''>" + parameter.prompt + "</option>"; - } - } - - for (var i = 0; i < parameter.optionList.length; i++) { - var option = parameter.optionList[i]; - var name = option.name; - var value = ""; - if (option.id === undefined) { - value = option.name; - } else { - if (name === undefined) { - name = option.id; - } - value = option.id; - } - html += getOptionHtml(option.isPermitted, option.isDataLoading, value, name, parameter); - } - return html; ->>>>>>> 7e45cad... merge - }; - - function getOptionHtml(isPermitted, isDefault, value, name, parameter) { - var html = ""; - if (isDefault === undefined || isDefault === false ) { - if(isPermitted) - html = "<option class='" + parameter.id + "Option' value='" + value + "'>" + name + "</option>"; - else { - html = "<option class='" + parameter.id + "Option' value='" + value + "' disabled>" + name + "</option>"; - } - } - else { - if(isPermitted) - html = "<option class='" + parameter.id + "Option' value='" + value + "'>" + "' selected>" + name + "</option>"; - else { - html = "<option class='" + parameter.id + "Option' value='" + value + "' disabled>" + "' selected>" + name + "</option>"; - } - } - return html; - } - - var getParameter = function(element, expectedId) { - var id = $(element).attr("parameter-id"); - if (expectedId !== undefined && expectedId !== id) { - return undefined; - } - var parameter = { - id : id - }; - if ($(element).prop("type") === "checkbox") { - parameter.value = $(element).prop("checked"); - }else if ($(element).prop("type") === "file") { - parameter.value = $('#'+id).attr("value"); - - } else { - if ($(element).prop("type") === "text") { - $(element).val($(element).val().trim()); - } - parameter.value = $(element).val(); - } - if ($(element).prop("selectedIndex") === undefined) { - parameter.selectedIndex = -1; - } else { - parameter.selectedIndex = $(element).prop("selectedIndex"); - if (UtilityService.hasContents($(element).attr("prompt"))) { - parameter.selectedIndex--; - } - } - return parameter; - }; - - var getRequiredField = function(element) { - if ($(element).prop("type") === "text") { - $(element).val($(element).val().trim()); - } - if ($(element).val() === "" || $(element).val() === null) { - return '"' + $(element).attr("parameter-name") + '"'; - } else { - return ""; - } - }; - - var callback = function(element, scope) { - scope.callback({ - id : $(element).attr("parameter-id") - }); - }; - - return { - restrict : "EA", - replace : true, - template : "<div><table style='" + tableStyle + "'></table></div>", - scope : { - control : "=", - callback : "&" - }, - link : function(scope, element, attrs) { - - var control = scope.control || {}; - - control.setList = function(parameterList) { - var html = ""; - for (var i = 0; i < parameterList.length; i++) { - html += getParameterHtml(parameterList[i], attrs.editable); - } - element.html(html); - element.find("input, select").bind("change", function() { - callback(this, scope); - }); - } - - control.updateList = function(parameterList) { - element.find("input, select").each( - function() { - for (var i = 0; i < parameterList.length; i++) { - if (parameterList[i].id === $(this).attr( - "parameter-id")) { - updateParameter(parameterList[i], this, - attrs.editable); - } - } - }); - element.find("input, select").bind("change", function() { - callback(this, scope); - }); - } - - control.getList = function(expectedId) { - var parameterList = new Array(); - element.find("input, select").each(function() { - var parameter = getParameter(this, expectedId); - if (parameter !== undefined) { - parameterList.push(parameter); - } - }); - return parameterList; - } - - control.getRequiredFields = function() { - var requiredFields = ""; - var count = 0; - element.find("input, select").each(function() { - if ($(this).attr("is-required") === "true") { - var requiredField = getRequiredField(this); - if (requiredField !== "") { - if (++count == 1) { - requiredFields = requiredField; - } - } - } - }); - if (--count <= 0) { - return requiredFields; - } else if (count == 1) { - return requiredFields + " and 1 other field"; - } else { - return requiredFields + " and " + count + " other fields"; - } - } - } - } -} - -appDS2.directive('parameterBlock', [ "$log", "PARAMETER", "UtilityService", - parameterBlockDirective ]); - - -appDS2.directive('onlyIntegers', function () { - return { - restrict: 'A', - link: function (scope, elm, attrs, ctrl) { - elm.on('keydown', function (event) { - if(event.shiftKey){event.preventDefault(); return false;} - //console.log(event.which); - if ([8, 13, 27, 37, 38, 39, 40].indexOf(event.which) > -1) { - // backspace, enter, escape, arrows - return true; - } else if (event.which >= 49 && event.which <= 57) { - // numbers - return true; - } else if (event.which >= 96 && event.which <= 105) { - // numpad number - return true; - } - // else if ([110, 190].indexOf(event.which) > -1) { - // // dot and numpad dot - // return true; - // } - else { - event.preventDefault(); - return false; - } - }); - } - } -}); - -appDS2.directive('onlyFloat', function () { - return { - restrict: 'A', - link: function (scope, elm, attrs, ctrl) { - elm.on('keydown', function (event) { - if ([110, 190].indexOf(event.which) > -1) { - // dot and numpad dot - event.preventDefault(); - return true; - } - else{ - return false; - } - }); - } - } -}); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js index ed71436bb..76585f4bc 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js @@ -58,7 +58,7 @@ * called immediately after HTML is rendered. This is due to a timing-related
* behavior.
*
- * 3) The progress bar displays values of "0" and "100" if precentProgress is,
+ * 3) The progress bar displays values of "0" and "100" if percentProgress is,
* respectively, less than 0 or greater than 100.
*
* CUSTOM STYLING:
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/search.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/search.js new file mode 100644 index 000000000..05ae1211c --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/search.js @@ -0,0 +1,11 @@ +"use strict"; + +appDS2.directive('searchText', function() { + return { + restrict : "E", + templateUrl: 'app/vid/scripts/view-models/search.htm', + scope: { + searchString : '=' + } + } +});
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/serviceMetadata.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/serviceMetadata.js new file mode 100644 index 000000000..1c15f7034 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/serviceMetadata.js @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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"; + +appDS2.directive('serviceMetadata', function() { + return { + restrict : "E", + templateUrl: 'app/vid/scripts/view-models/serviceMetadata.htm', + scope: { + serviceMetadataFields : '=', + titleTxt: '@' + }, + link : function(scope, element, attrs) { + } + } +});
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html index bdc95c98e..60596f499 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html @@ -1,4 +1,4 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> <link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/alert-change-management/alert-change-management.css" /> <div class="modal-header"> <h3 class="modal-title" id="alert-modal-header">On Hold</h3> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.controller.js new file mode 100644 index 000000000..6cb3f9c89 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.controller.js @@ -0,0 +1,33 @@ +(function () { + 'use strict'; + + appDS2.controller("alertModalController", ["$uibModalInstance", "jobInfo", + "$log", alertModalController]); + + function alertModalController($uibModalInstance, jobInfo, $log) { + var vm = this; + var init = function() { + if (jobInfo) { + vm.content = jobInfo.message; + vm.mode = jobInfo.status; + if (vm.mode == "failed") { + vm.Header = "Failed" + } else if (vm.mode == "confirm") { + vm.Header = "Confirm" + } else { + vm.Header = "Success" + } + } + }; + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.ok = function () { + $uibModalInstance.close(true); + }; + + init(); + } +})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.css new file mode 100644 index 000000000..85382b0ee --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.css @@ -0,0 +1,15 @@ +.modal-header { + border-bottom-color: #ffb81c; +} +.modal-header.success { + border-bottom: 3px solid #4ca90c; +} +.modal-header.failed { + border-bottom: 3px solid #cf2a2a; +} +.modal-header.confirm { + border-bottom: 3px solid #009FDB; +} +.modal-footer { + border-radius: 0 0 6px 6px; +}
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.html new file mode 100644 index 000000000..4fa9d4587 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.html @@ -0,0 +1,15 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/modals.css"> +<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/alert-modal/alert-modal.css" /> +<div class="modal-header" ng-class="vm.mode"> + <span class="modal-title" id="alert-modal-header">{{vm.Header}}</span> + <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> +</div> +<div class="modal-body"> + <span id="failed-modal-content">{{vm.content}}</span> +</div> +<div class="modal-footer"> + <div class="pull-right"> + <button data-tests-id="ok" id="ok-button" name="ok" class="btn" + ng-click="vm.ok()">OK</button> + </div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js deleted file mode 100644 index 2c5eabed9..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js +++ /dev/null @@ -1,33 +0,0 @@ -(function () { - 'use strict'; - - appDS2.controller("alertNewSchedulerController", ["$uibModalInstance", "jobInfo", "MsoService", "COMPONENT", - "$log", alertNewSchedulerController]); - - function alertNewSchedulerController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log) { - var vm = this; - - vm.manualTasks = []; - vm.MANUAL_TASKS = COMPONENT.MANUAL_TASKS; - var init = function() { - if (jobInfo) { - vm.content = jobInfo; - } else { - vm.content = "Successfully"; - } - - - - }; - - - - - - vm.close = function () { - $uibModalInstance.close(); - }; - - init(); - } -})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css deleted file mode 100644 index 316c2e46e..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css +++ /dev/null @@ -1,3 +0,0 @@ -.modal-header h3 { - border-bottom: 3px solid #ffb81c; -}
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html deleted file mode 100644 index e6255cf36..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html +++ /dev/null @@ -1,12 +0,0 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/alert-change-management/alert-change-management.css" /> -<div class="modal-header"> - <h3 class="modal-title" id="alert-modal-header">Response From Server</h3> - <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> -</div> -<div class="modal-body"> - <span id="alert-modal-content">{{vm.content}}</span> -</div> -<div class="modal-footer"> -<!-- <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div> --> -</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.controller.js new file mode 100644 index 000000000..930240437 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.controller.js @@ -0,0 +1,58 @@ +(function () { + 'use strict'; + + appDS2.controller("attachTestEnvManifestController", ["$uibModalInstance", "$uibModal", "$log", "$scope", + attachTestEnvManifestController]); + + function attachTestEnvManifestController($uibModalInstance, $uibModal, $log, $scope) { + var vm = this; + + var init = function () { + vm.manifest = ""; + vm.error=""; + }; + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.submit = function () { + $uibModalInstance.close(vm.manifest); + }; + + vm.isSubmitDisabled = function () { + return !(vm.manifest); + }; + + + + /* + Must be $scope because we bind to the onchange of the html (cannot attached to vm variable). + We use scope because angular doesn't support ng-change on input file + https://github.com/angular/angular.js/issues/1375 + https://stackoverflow.com/questions/17922557/angularjs-how-to-check-for-changes-in-file-input-fields + */ + $scope.selectAttachmentManifest = function (fileInput) { + if (fileInput && fileInput.id) { + vm.manifest = ""; + vm.error=""; + var file = fileInput.files[0]; + vm.filename=file.name; + var fileReader = new FileReader(); + fileReader.onload = function (load) { + try { + var lines = load.target.result; + vm.manifest = JSON.parse(lines); + } catch (error) { + $log.error(error); + vm.error = "file: " + vm.filename + " is not a valid JSON" + } + $scope.$apply(); + }; + fileReader.readAsText(file); + } + }; + + init(); + } +})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.css new file mode 100644 index 000000000..ff06addbb --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.css @@ -0,0 +1,109 @@ +.modal-header { + border: none!important; + padding: 10px 20px 0px 20px!important; + font-family: "OpenSans-Light"; + font-size: 22px; + color: #000000; +} + +.modal-header h3 { + font-family: "OpenSans-Light"; + color: #000000; + color: #000000; + font-size: 22px; + font-weight: 300; + line-height: 16px; + padding-bottom: 20px; + border-bottom: 3px solid #009fdb; + +} + +.control-label { + font-family: "OpenSans-Light"; + color: #5a5a5a; + font-size: 13px; + font-weight: 400; +} + +.modal-content { + width: 468px; + height: 242px; + border-radius: 8px; + background-color: #ffffff; +} + +body .modal-body { + padding-bottom: 0; + padding-top: 0; + padding-left: 20px; + padding-right: 20px; + width: 468px; + height: 91px; +} + +.modal-footer { + margin-top: 0; + background-color: #fff; +} + + +.modal-close { + margin: -60px 5px 0 0; + color: #5a5a5a; + font-size: 20px; + cursor: pointer; +} + +.inputfile { + width: 0.1px; + height: 0.1px; + opacity: 0; + overflow: hidden; + position: absolute; + z-index: -1; +} + +.manifestName{ + font-family: OpenSans-Semibold; + font-size: 12px; + color: #191919; +} + +.manifestFileName { + width: 389px; + height: 37px; + background: #FFFFFF; + border: 1px solid #D2D2D2; + border-radius: 2px; + display: inline-block; + line-height: 37px; + font-weight: normal !important; + padding-left: 3px; + border-bottom-right-radius: 0; + border-top-right-radius: 0; +} + +.elipsisImg { + width: 37px; + padding: 10px; + background: #FFFFFF; + border: 1px solid #D2D2D2; + display: inline-block; + cursor: pointer; + vertical-align: top; + border-radius: 2px; + border-bottom-left-radius: 0; + border-top-left-radius: 0; +} + +.labelForImage { + vertical-align: top; +} + +.errorLabel { + color: red; +} + + + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.html new file mode 100644 index 000000000..12e0ab33f --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.html @@ -0,0 +1,26 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-buttons.css"> +<link rel="stylesheet" type="text/css" + href="app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.css"/> +<div class="modal-header"> + <h3 id="modal-title">Attach Manifest</h3> + <span ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> +</div> +<form name="Attach Manifest" ng-submit="vm.submit()"> + <div class="modal-body"> + <label id="manifestName" class="manifestName">Manifest Name</label> + <input onchange="angular.element(this).scope().selectAttachmentManifest(this)" type="file" + id="testEnvManifestFileInput" class="inputfile" accept=".json"/> + <label id="manifestFileName" class="manifestFileName">{{vm.filename}}</label><label for="testEnvManifestFileInput" class="labelForImage" > + <span class="icon-browse"></span> + </label><label id="errorLabel" class="errorLabel">{{vm.error}}</label> + + </div> + <div class="modal-footer"> + <div class="pull-right"> + <button type="submit" id="submit" name="submit" class="btn btn-primary" + ng-disabled="vm.isSubmitDisabled()">Attach + </button> + <button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button> + </div> + </div> +</form> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.controller.js new file mode 100644 index 000000000..a04e127db --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.controller.js @@ -0,0 +1,29 @@ +(function () { + 'use strict'; + + appDS2.controller("cancelPendingWorkflowController", ["$scope", "$uibModalInstance", "changeManagement", + "$log", cancelPendingWorkflowController]); + + function cancelPendingWorkflowController($scope, $uibModalInstance, changeManagement, $log) { + var vm = this; + + function init() { + if (changeManagement) { + vm.workflow = changeManagement; + } else { + console.log("Pending Workflow is undefined: ", changeManagement); + vm.workflow = null; + } + } + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.ok = function () { + $uibModalInstance.close(true); + }; + + init(); + } +})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.css new file mode 100644 index 000000000..daf86538a --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.css @@ -0,0 +1,16 @@ +.modal { + position: inherit; + text-align: left; +} +.modal-dialog { + position: absolute; + right: 0; + display: inline; + margin-top: -243px; +} +.modal-header { + border-bottom-color: #009FDB; +} +.modal-content { + width: 540px; +}
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html new file mode 100644 index 000000000..6dca76d25 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html @@ -0,0 +1,14 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/modals.css"> +<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.css"/> +<div class="modal-header"> + <span class="modal-title" id="pending-modal-header">Pending</span> + <span id="cancel" ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> +</div> +<div class="modal-body" id="modal-body"> + Are you sure you want to delete workflow + <br/> + {{vm.workflow.scheduleRequest.scheduleName}}? +</div> +<div class="modal-footer"> + <button class="btn btn-cancel-workflow" data-tests-id="cancel" ng-click="vm.ok()">Cancel Workflow</button> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html index 0deaf93d2..d51620d0c 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html @@ -1,4 +1,4 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> <link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/failed-change-management/failed-change-management.css" /> <div class="modal-header"> <h3 class="modal-title" id="failed-modal-header">Failed</h3> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html index 9b40db2a5..615c95ceb 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html @@ -1,4 +1,4 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> <link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css" /> <div class="modal-header"> <h3 class="modal-title" id="in-progress-modal-header">In Progress</h3> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.css new file mode 100644 index 000000000..6af5a66ec --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.css @@ -0,0 +1,6 @@ +.modal-dialog .popupContents .log { + width: 560px; +} +.modal-dialog .cancel-btn { + width: 120px; +} diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.html new file mode 100644 index 000000000..7698981c3 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.html @@ -0,0 +1,48 @@ +<!-- + ============LICENSE_START======================================================= + VID + ================================================================================ + Copyright (C) 2017 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========================================================= + --> +<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/mso-commit/mso-commit.css"/> + +<div class="modal-wrapper popupContents" data-tests-id="msoPopup"> + + <div class="statusLine"> + <img src="app/vid/images/spinner.gif" + ngx-visible="{{isSpinnerVisible}}"> </img> <label>Status:</label><span + class="status" data-tests-id="msoRequestStatus">{{status}}</span> + </div> + + <div class="feedback"> + + <div progress-bar control="progressBarControl" + value="{{percentProgress}}" increases-only="true" + ngx-show="{{isProgressVisible}}"></div> + + <div class="error" ng-hide="isProgressVisible"> + <img src="app/vid/images/error.png"></img>{{error}} + </div> + + </div> + + <pre class="log">{{log}}</pre> + + <div class="buttonRow"> + <button data-tests-id="msoCommitDialogCloseButton" ngx-enabled="{{isCloseEnabled}}" att-button size="small" + ng-click="close();">Close</button> + </div> +</div> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js index 14ca43b56..f0b85a6e3 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -1,11 +1,16 @@ (function () { 'use strict'; - appDS2.controller("newChangeManagementModalController", ["$uibModalInstance", "$uibModal", "AaiService", "changeManagementService", - "$log", "$scope", "_", newChangeManagementModalController]); + appDS2.controller("newChangeManagementModalController", ["$uibModalInstance", "$uibModal",'$q', "AaiService", "changeManagementService", "Upload", + "$log", "$scope", "_", "COMPONENT", "VIDCONFIGURATION", newChangeManagementModalController]); + + function newChangeManagementModalController($uibModalInstance, $uibModal,$q, AaiService, changeManagementService, Upload, $log, $scope, _, COMPONENT, VIDCONFIGURATION) { - function newChangeManagementModalController($uibModalInstance, $uibModal, AaiService, changeManagementService, $log, $scope, _) { var vm = this; + vm.configUpdatePatternError = "Invalid file type. Please select a file with a CSV extension."; + vm.configUpdateContentError = "Invalid file structure."; + + vm.softwareVersionRegex = "[-a-zA-Z0-9\.]+"; var init = function () { vm.changeManagement = {}; @@ -46,8 +51,8 @@ availableVersions.push(extractVNFModel(vnf, response.data.service, newVNFName)); } }); - var versions = _.uniqBy(availableVersions, ['modelInfo.modelVersion']); - newVNFName.availableVersions = _.uniq(versions, response.data.service, true); + var versions = _.uniqBy(availableVersions, 'modelInfo.modelVersion'); + newVNFName.availableVersions = _.sortBy(_.uniq(versions, response.data.service, true),"modelInfo.modelVersion"); }).catch(function (error) { $log.error(error); }); @@ -107,23 +112,41 @@ $uibModalInstance.close(); }; - vm.schedule = function () { - $uibModalInstance.close(vm.changeManagement); - - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/new-scheduler/new-scheduler.html', - controller: 'newSchedulerController', - controllerAs: 'vm', - resolve: { - changeManagement: function () { - return vm.changeManagement; - } - } + vm.uploadConfigFile = function (file) { + var defer = $q.defer(); + Upload.upload({ + url: "change-management/uploadConfigUpdateFile", + file: file, + transformResponse: [function (data) { + return data; + }] + }) + .then(function (configUpdateResponse) { + vm.changeManagement.configUpdateFile = configUpdateResponse && JSON.parse(configUpdateResponse.data).payload; + defer.resolve(true); + }) + .catch(function (error) { + defer.resolve(false); }); + return defer.promise; + }; - modalInstance.result.then(function (result) { - console.log("This is the result of the new change management modal.", result); - }) + + vm.openModal = function () { + $scope.widgetParameter = ""; // needed by the scheduler? + + // properties needed by the scheduler so it knows whether to show + // policy or sniro related features on the scheduler UI or not. + vm.changeManagement.policyYN = "Y"; + vm.changeManagement.sniroYN = "Y"; + + var data = { + widgetName: 'Portal-Common-Scheduler', + widgetData: vm.changeManagement, + widgetParameter: $scope.widgetParameter + }; + + window.parent.postMessage(data, VIDCONFIGURATION.SCHEDULER_PORTAL_URL); }; vm.loadSubscribers = function () { @@ -165,11 +188,11 @@ if (vnfsData[i]) { const nodeType = vnfsData[i]['node-type']; if (nodeType === "generic-vnf") { - _.forEach(vnfsData[i]['related-to'], function (node) { - if (node['node-type'] === 'vserver') { - vm.vnfs.push(vnfsData[i]); - } - }) + if (_.find(vnfsData[i]['related-to'], function (node) { + return node['node-type'] === 'vserver' + }) !== undefined) { + vm.vnfs.push(vnfsData[i]); + } } else if (nodeType === "service-instance") { vm.serviceInstances.push(vnfsData[i]); } @@ -197,63 +220,50 @@ ); }; + var fromVNFVersions = []; + vm.loadVNFVersions = function () { - vm.fromVNFVersions = []; + fromVNFVersions = []; vm.serviceInstancesToGetVersions = []; var versions = []; _.forEach(vm.vnfs, function (vnf) { if (vnf.properties['nf-role'] === vm.changeManagement['vnfType']) { - vm.serviceInstancesToGetVersions.push(vnf); - - versions.push(vnf.properties["model-invariant-id"]); - + vm.serviceInstancesToGetVersions.push({ + "model-invariant-id": vnf.properties["model-invariant-id"], + "model-version-id": vnf.properties["model-version-id"] } + ); + versions.push(vnf.properties["model-invariant-id"]); } }); - AaiService.getVnfVersionsByInvariantId(versions).then(function (response) { - if (response.data) { - var key = response.data.model["0"]["model-invariant-id"]; - var value = response.data.model["0"]["model-vers"]["model-ver"]["0"]["model-version"]; - var element = {"key": key, "value": value}; - vm.fromVNFVersions.push(element); - } - //TODO promise all and call the new api to get the versions. - // vm.fromVNFVersions.push(response.data.model["0"]["model-vers"]["model-ver"]["0"]["model-version"]); - // if(vm.serviceInstancesToGetVersions.length > 0){ - // - // var promiseArrOfGetVnfs = preparePromiseArrOfGetVersions('a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb'); - // - // Promise.all(promiseArrOfGetVnfs).then(function (allData) { - // vm.vnfs = _.flattenDeep(_.without(allData, null)); - // var filteredVnfs = _.sortedUniqBy(vm.vnfs, function (vnf) { - // return vnf.properties.vnfType; - // }); - // - // _.forEach(filteredVnfs, function (vnf) { - // vm.vnfTypes.push(vnf.properties.vnfType) - // }); - // - // }).catch(function (error) { - // $log(error); - // }); - // } - }) - // debugger; + if (versions.length > 0) { + AaiService.getVnfVersionsByInvariantId(versions).then(function (response) { + if (response.data) { + + $log.debug("getVnfVersionsByInvariantId: response", response); + + fromVNFVersions = vm.serviceInstancesToGetVersions + .map(function (serviceInstanceToGetVersion) { + const model = _.find(response.data.model, {'model-invariant-id': serviceInstanceToGetVersion['model-invariant-id']}); + $log.debug("getVnfVersionsByInvariantId: model for " + serviceInstanceToGetVersion['model-invariant-id'], model); + + const modelVer = _.find(model["model-vers"]["model-ver"], {'model-version-id': serviceInstanceToGetVersion['model-version-id']}); + $log.debug("getVnfVersionsByInvariantId: modelVer for " + serviceInstanceToGetVersion['model-version-id'], modelVer); + + var modelVersionId = serviceInstanceToGetVersion["model-version-id"]; + var modelVersion = modelVer["model-version"]; + return {"key": modelVersionId, "value": modelVersion}; + }); + + vm.fromVNFVersions = _.uniqBy(fromVNFVersions, 'value'); + } + }) + } }; - // function preparePromiseArrOfGetVersions(serviceInstances) { - // var promiseArr = []; - // for (var i = 0; i < serviceInstances.length; i++) { - // var modelInvariantId = serviceInstances[i].properties["model-invariant-id"]; - // promiseArr.push( - // getVnfs(modelInvariantId) - // ); - // } - // return promiseArr; - // } function getVnfs(modelInvariantId) { return new Promise(function (resolve, reject) { @@ -281,12 +291,20 @@ }); } + var getVersionNameForId = function(versionId) { + var version = _.find(fromVNFVersions, {"key": versionId}); + return version.value; + }; + vm.loadVNFNames = function () { vm.vnfNames = []; + const vnfs = vm.changeManagement.fromVNFVersion ? vm.vnfs : []; + _.forEach(vnfs, function (vnf) { - _.forEach(vm.vnfs, function (vnf) { + var selectedVersionNumber = getVersionNameForId(vm.changeManagement.fromVNFVersion); - if (vnf.properties['nf-role'] === vm.changeManagement.vnfType) { + if (vnf.properties['nf-role'] === vm.changeManagement.vnfType && + selectedVersionNumber === getVersionNameForId(vnf.properties["model-version-id"])) { var vServer = {}; _.forEach(vnf['related-to'], function (node) { @@ -295,11 +313,27 @@ } }); + var serviceInstancesIds = + _.filter(vnf['related-to'], {'node-type': 'service-instance'}) + .map(function (serviceInstance) { return serviceInstance.id }); + + var serviceInstances = _.filter(vm.serviceInstances, function(serviceInstance) { + return _.includes(serviceInstancesIds, serviceInstance.id); + }); + + // logging only + if (serviceInstancesIds.length === 0) { + $log.error("loadVNFNames: no serviceInstancesIds for vnf", vnf); + } else { + $log.debug("loadVNFNames: serviceInstancesIds", serviceInstancesIds); + $log.debug("loadVNFNames: serviceInstances", serviceInstances); + } + vm.vnfNames.push({ "id": vnf.properties["vnf-id"], "name": vnf.properties["vnf-name"], "invariant-id": vnf.properties["model-invariant-id"], - "service-instance-node": _.filter(vm.serviceInstances, {id: vnf["related-to"][0].id}), + "service-instance-node": serviceInstances, "modelVersionId": vnf.properties["model-version-id"], "properties": vnf.properties, 'cloudConfiguration': vServer, @@ -316,30 +350,32 @@ tenantId: '' }; - var splitedUrlByDash = _.split(url, '/', 100); + /* + e.g., in both URLs below - + Â - lcpCloudRegionId == 'rdm5b' + Â - tenantId == '0675e0709bd7444a9e13eba8b40edb3c' - cloudConfiguration.lcpCloudRegionId = splitedUrlByDash[7]; - cloudConfiguration.tenantId = splitedUrlByDash[10]; + "url": "https://aai-conexus-e2e.ecomp.cci.att.com:8443/aai/v10/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/0675e0709bd7444a9e13eba8b40edb3c/vservers/vserver/932b330d-733e-427d-a519-14eebd261f70" + "url": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/0675e0709bd7444a9e13eba8b40edb3c/vservers/vserver/932b330d-733e-427d-a519-14eebd261f70" + */ + + var cloudRegionMatch = url.match(/\/cloud-regions\/cloud-region\/[^\/]+\/([^\/]+)/); + var tenantMatch = url.match(/\/tenants\/tenant\/([^\/]+)/); + + cloudConfiguration.lcpCloudRegionId = cloudRegionMatch[1]; + cloudConfiguration.tenantId = tenantMatch[1]; return cloudConfiguration; }; vm.loadWorkFlows = function () { - var vnfs = []; - angular.forEach(vm.changeManagement.vnfNames, function (vnfName) { - vnfs.push(vnfName.name) - }); - - //TODO: When we'll have the mappings, use the backend call to get the workflows - // changeManagementService.getWorkflows(vnfs) - // .then(function(response) { - // vm.workflows = response.data; - // }) - // .catch(function(error) { - // $log.error(error); - // }); - - vm.workflows = ["Update", "Replace"]; + changeManagementService.getWorkflows(vm.changeManagement.vnfNames) + .then(function(response) { + vm.workflows = response.data.workflows; + }) + .catch(function(error) { + $log.error(error); + }); }; //Must be $scope because we bind to the onchange of the html (cannot attached to vm variable). @@ -364,6 +400,14 @@ console.log("Will add version for selected vnf name: " + vnfName.name); }; + vm.isConfigUpdate = function () { + return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfConfigUpdate; + } + + vm.shouldShowVnfInPlaceFields = function () { + return vm.changeManagement.workflow === COMPONENT.WORKFLOWS.vnfInPlace; + }; + init(); } })();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css deleted file mode 100644 index 9d270987a..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css +++ /dev/null @@ -1,130 +0,0 @@ -.btn-white { - font-family: "Open Sans"; - border-radius: 2px; - border: 1px solid #d8d8d8; - background-color: #ffffff; - width: 94px; - height: 30px; - color: #5a5a5a; - font-size: 13px; - font-weight: 400; - line-height: 36px; - text-align: center; - padding: 4px 12px !important; -} - -.btn-primary { - font-family: "Open Sans"; - border-radius: 2px; - border: 1px solid #0091c8; - background-color: #009fdb; - width: 94px; - height: 30px; - color: #ffffff; - font-size: 13px; - font-weight: 400; - line-height: 36px; - text-align: center; - padding: 4px 12px !important; -} - -.modal-header { - border: none!important; - padding: 15px 15px 0px 15px!important; -} - -.modal-header h3 { - font-family: "Open Sans"; - color: #191919; - font-size: 22px; - font-weight: 300; - line-height: 16px; - padding-bottom: 20px; - border-bottom: 3px solid #009fdb; - -} - -.control-label { - font-family: "Open Sans"; - color: #5a5a5a; - font-size: 13px; - font-weight: 400; -} - -.modal-footer { - background-color: #eaeaea; -} - -.modal-dialog { - width: 587px; - border-radius: 8px; -} - -.modal-content { - width: 587px; - border-radius: 8px; - background-color: #ffffff; -} - -button.dropdown-toggle { - text-align: left; -} - -button[disabled].dropdown-toggle { - opacity: 1; - cursor: not-allowed; - background-color: #eee; - border: 1px solid #aaa; - color: #a0a0a0; -} - -multiselect[disabled] { - cursor: not-allowed; -} - -a.item-unselected:before { - font-family: "icomoon"!important; - content: "\e90c"; - color: #4ca90c; -} - -.modal-close { - margin: -40px 5px 0 0; - color: #5a5a5a; - font-size: 20px; - cursor: pointer; -} - -.vnf-versions-container .table { - position: relative; - background-color: #f8f8f8; - background-clip: padding-box; - border-radius: 6px; - outline: 0; -} - -.vnf-versions-name { - padding-top: 6px; - font-family: "Open Sans"; - position: absolute; -} - -.vnf-versions-select-as-text { - font-family: "Open Sans"; - appearance: none; - -webkit-appearance: none; - -moz-appearance: none; - border: none; - overflow:hidden; - background-color: #f8f8f8; - height: 31px; -} - -.vnf-files-select { - z-index: 999; - opacity: 0.0; - position: absolute; - width: 23%; - cursor: pointer; - height:100%; -} diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html index 71c7eb331..4473ee3b8 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html @@ -1,51 +1,51 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> <div class="modal-header"> <h3 class="modal-title" id="modal-title">New VNF Change</h3> <span ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> </div> -<form name="newChangeManagement" ng-submit="vm.schedule()"> +<form class="form-create" name="newChangeManagement" ng-submit="vm.openModal();vm.close();" novalidate> <div class="modal-body"> <div class="form-group"> <label class="control-label">Subscriber</label> <select class="form-control" ng-model="vm.changeManagement.subscriberId" ng-change="vm.loadServiceTypes()" name="subscriber" id="subscriber" data-tests-id="subscriberName" required> <option value="" disabled>Select subscriber</option> - <option data-tests-id="subscriberNameOption" ng-repeat="item in vm.subscribers" ng-value="item['global-customer-id']">{{item['subscriber-name']}}</option> + <option data-tests-id="subscriberNameOption" class="subscriberNameOption" ng-repeat="item in vm.subscribers" ng-value="item['global-customer-id']" ng-disabled="!(item['is-permitted'])">{{item['subscriber-name']}}</option> </select> </div> <div class="form-group"> <label class="control-label">Service type</label> - <select class="form-control" ng-model="vm.changeManagement.serviceType" ng-change="vm.loadVNFTypes()" name="serviceType" id="serviceType" ng-options="item['service-type'] for item in vm.serviceTypes" required data-ng-disabled="newChangeManagement.subscriber.$pristine"> + <select class="form-control" ng-model="vm.changeManagement.serviceType" ng-change="vm.loadVNFTypes()" name="serviceType" id="serviceType" ng-options="item['service-type'] disable when !(item['is-permitted']) for item in vm.serviceTypes" required data-ng-disabled="newChangeManagement.subscriber.$pristine" data-tests-id="serviceType"> <option value="" disabled>Select service type</option> </select> </div> <div class="form-group"> - <label class="control-label">VNF type</label> + <label class="control-label">NF Role</label> <select class="form-control" ng-model="vm.changeManagement.vnfType" ng-change="vm.loadVNFVersions()" name="vnfType" id="vnfType" ng-options="item for item in vm.vnfTypes" required data-ng-disabled="newChangeManagement.serviceType.$pristine"> - <option value="" disabled>Select VNF type</option> + <option value="" disabled>NF Role</option> </select> </div> <div class="form-group"> - <label class="control-label">Source Version</label> + <label class="control-label">Source VNF Model Version</label> <select class="form-control" ng-model="vm.changeManagement.fromVNFVersion" ng-change="vm.loadVNFNames()" name="fromVNFVersion" id="fromVNFVersion" ng-options="item.key as item.value for item in vm.fromVNFVersions" required data-ng-disabled="newChangeManagement.vnfType.$pristine"> - <option value="" disabled>Select from VNF version</option> + <option value="" disabled>Select VNF Model Version</option> </select> </div> <div class="form-group"> - <label class="control-label">VNF name</label> + <label class="control-label">Available VNF</label> <multiselect ng-model="vm.changeManagement.vnfNames" ng-change="vm.loadWorkFlows()" name="vnfName" id="vnfName" options="vm.vnfNames" display-prop="name" id-prop="id" required data-ng-disabled="newChangeManagement.fromVNFVersion.$pristine"></multiselect> </div> <div ng-show="vm.changeManagement.vnfNames && vm.changeManagement.vnfNames.length > 0" class="form-group vnf-versions-container"> <table class="table table-bordered"> <tbody> <tr ng-repeat="vnfName in vm.changeManagement.vnfNames"> - <td class="col-md-6"><span class="vnf-versions-name">{{vnfName.name}}</span></td> - <td class="col-md-3"> - <select ng-model="vnfName.version" ng-change="vm.selectVersionForVNFName(vnfName)" class="vnf-versions-select-as-text"> - <option value="" disabled="" selected="selected">Select Target Version</option> + <td class="col-md-2"><span class="vnf-versions-name">{{vnfName.name}}</span></td> + <td class="col-md-2"> + <select ng-model="vnfName.version" ng-change="vm.selectVersionForVNFName(vnfName)" class="vnf-versions-select-as-text" id="{{vnfName['invariant-id']}}-target-version-select"> + <option value="" disabled="" selected="selected">Select Target VNF Model Version</option> <option ng-repeat="version in vnfName.availableVersions">{{version.modelInfo.modelVersion}}</option> </select> </td> - <td class="col-md-3 vnf-versions-name"> + <td class="col-md-1 vnf-versions-name"> <input ng-model="vnfName.filePath" onchange="angular.element(this).scope().selectFileForVNFName(this)" type="file" id="{{vnfName['invariant-id']}}" class="vnf-files-select" /> <span class="vnf-versions-name">Select File<span class="caret"></span></span></td> </tr> @@ -58,6 +58,32 @@ <option value="" disabled>Select workflow</option> </select> </div> + <div class="form-group" ng-if="vm.isConfigUpdate()"> + <label class="control-label">Attach configuration file</label> + <div class="file-wrapper"> + <input id="config-update-input" class="file-input" type="file" ngf-select ng-model="vm.configUpdateFile" ngf-validate-async-fn="vm.uploadConfigFile($file)" name="configUpdateFile" + accept=".csv" ngf-pattern=".csv" required> </input> + <label id="config-update-label" class="file-input-label">{{vm.configUpdateFile&&vm.configUpdateFile.name||"Select File"}} </label> + <label for="config-update-input"><span class="icon-browse"></span></label> + </div> + <label id="errorLabel" class="icon-alert error" ng-if="newChangeManagement.configUpdateFile.$error.pattern">{{vm.configUpdatePatternError}}</label> + <label id="errorContentLabel" class="icon-alert error" ng-if="newChangeManagement.configUpdateFile.$error.validateAsyncFn">{{vm.configUpdateContentError}}</label> + </div> + <div ng-if="vm.shouldShowVnfInPlaceFields()"> + <div class="form-group"> + <label class="control-label">operations-timeout</label> + <input class="form-control" ng-model="vm.changeManagement.operationTimeout" name="operationTimeout" type="text" id="operations-timeout" pattern="[0-9]+" required> + </div> + <div class="form-group"> + <label class="control-label">existing-software-version</label> + <input class="form-control" ng-model="vm.changeManagement.existingSoftwareVersion" name="existingSoftwareVersion" type="text" id="existing-software-version" pattern="{{vm.softwareVersionRegex}}" required> + </div> + <div class="form-group"> + <label class="control-label">new-software-version</label> + <input class="form-control" ng-model="vm.changeManagement.newSoftwareVersion" name="newSoftwareVersion" type="text" id="new-software-version" pattern="{{vm.softwareVersionRegex}}" required> + </div> + + </div> </div> <div class="modal-footer"> <div class="pull-right"> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js deleted file mode 100644 index c8f44c715..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js +++ /dev/null @@ -1,455 +0,0 @@ -(function () { - 'use strict'; - - appDS2.controller("newSchedulerController", ["$scope", "$uibModal", "$uibModalInstance", "AaiService", "SchedulerService", "_", - "$log", "changeManagement", "$timeout", "$interval", "$filter", "VIDCONFIGURATION", "changeManagementService", newSchedulerController]); - - function newSchedulerController($scope, $uibModal, $uibModalInstance, AaiService, SchedulerService, _, $log, changeManagement, $timeout, $interval, $filter, VIDCONFIGURATION, changeManagementService) { - var vm = this; - var pollpromise; - - var init = function () { - vm.scheduler = {}; - vm.schedulingInfo = {}; - var callbackData = extractChangeManagementCallbackDataStr(changeManagement); - vm.vnfObject = changeManagement; - vm.schedulerObj = { - domain: 'ChangeManagement', - scheduleId: '', - scheduleName: 'VnfUpgrade/DWF', - userId: '', - domainData: [{ - 'WorkflowName': vm.scheduler.policy, - 'CallbackUrl': 'http://127.0.0.1:8989/scheduler/v1/loopbacktest/vid', - 'CallbackData': callbackData - }], - - schedulingInfo: { - normalDurationInSeconds: '', - additionalDurationInSeconds: '', - concurrencyLimit: '', - policyId: '', - vnfDetails: [ - { - groupId: "", - node: [], - changeWindow: [{ - startTime: '', - endTime: '' - }] - - } - ] - }, - - } - vm.schedulerObj1 = { - "domain": "ChangeManagement", - "scheduleName": "VnfUpgrade/DWF", - "userId": "su7376", - "domainData": [ - { - "WorkflowName": "HEAT Stack Software Update for vNFs", - "CallbackUrl": "http://127.0.0.1:8989/scheduler/v1/loopbacktest/vid", - "CallbackData": "testing" - } - ], - "schedulingInfo": { - "normalDurationInSeconds": 60, - "additionalDurationInSeconds": 60, - "concurrencyLimit": 60, - "policyId": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_zone_localTime.1.xml", - "vnfDetails": [ - { - "groupId": "group1", - "node": ["satmo415vbc", "satmo455vbc"], - "changeWindow": [ - { - "startTime": "2017-08-08T16:37:30.521Z", - "endTime": "2017-08-08T16:37:30.521Z" - } - ] - } - ] - } - }; - - - vm.format = 'yyyy/MM/dd'; - vm.todate = new Date(); - vm.checkboxSelection = 'false'; - vm.fromDate = ''; - vm.toDate = ''; - vm.timeSlots = []; - - vm.changeManagement = {}; - - vm.subscribers = []; - - AaiService.getSubscribers(function (response) { - vm.subscribers = response; - }); - - vm.serviceTypes = []; - AaiService.getServices(function (response) { - vm.serviceTypes = response.data.service; - }); - - changeManagementService.getWorkflows() - .then(function (response) { - vm.workflows = response.data; - }) - .catch(function (error) { - $log.error(error); - }); - - //TODO: Get the VNF names from backend dynamically - vm.vnfNames = []; - - //TODO: Get the VNF types from backend dynamically - vm.vnfTypes = []; - - AaiService.getLoggedInUserID(function (response) { - vm.userID = response.data; - }); - vm.policys = []; - - var policyName = JSON.stringify({ - policyName: "SNIRO_1710.*", - configAttributes: { - service: "PlacementOptimizationPolicy" - } - }); - SchedulerService.getPolicyInfo(policyName, function (response) { - vm.policys = response.data.entity; - }); - }; - - vm.radioSelections = function (test) { - if (vm.checkboxSelection == "true") { - vm.fromDate = ''; - vm.toDate = '' - } - } - vm.close = function () { - $uibModalInstance.close(); - }; - - - function convertToSecs(number) { - var totalSecs; - if (vm.selectedOption === 'hours') { - totalSecs = number * 3600; - - } - else if (vm.selectedOption === 'minutes') { - totalSecs = number * 60; - } else { - totalSecs = number; - } - return totalSecs; - } - - vm.submit = function () { - vm.schedulingInfo = { - scheduleId: vm.schedulerID, - approvalDateTime: '2017-08-08T16:37:30.521Z', - approvalUserId: "sy6266", - approvalStatus: 'Accepted', - approvalType: 'Tier 2' - }; - - var approvalObj = JSON.stringify(vm.schedulingInfo); - SchedulerService.getSubmitForapprovedTimeslots(approvalObj, function (response) { - if (response.status == 200) { - openConfirmationModal("Successfully Sent for Approval"); - } - - }); - }; - - vm.reject = function () { - vm.schedulingInfo = { - scheduleId: vm.schedulerID, - approvalDateTime: '2017-08-08T16:37:30.521Z', - approvalUserId: "sy6266", - approvalStatus: 'Rejected', - approvalType: 'Tier 2' - } - - var approvalObj = JSON.stringify(vm.schedulingInfo) - SchedulerService.getSubmitForapprovedTimeslots(approvalObj, function (response) { - if (response.status == 200) { - openConfirmationModal("Successfully sent for Rejection"); - } - - }); - }; - - vm.schedule = function (myForm) { - $scope.$watch('fromDate', validateDates(myForm)); - $scope.$watch('toDate', validateDates(myForm)); - if (myForm.$valid) { - sendSchedulerReq() - } - }; - - - function sendSchedulerReq() { - var changeWindow = [{ - startTime: '', - endTime: '' - }]; - vm.timeSlots = []; - var fromDate = $filter('date')(new Date(vm.fromDate), "yyyy-MM-ddTHH:mmZ", "UTC"); - var toDate = $filter('date')(new Date(vm.toDate), "yyyy-MM-ddTHH:mmZ", "UTC"); - - changeWindow[0].startTime = fromDate; - changeWindow[0].endTime = toDate; - vm.schedulerObj.userId = vm.userID; - vm.schedulerObj.domainData[0].WorkflowName = changeManagement.workflow; - vm.schedulerObj.schedulingInfo.normalDurationInSeconds = convertToSecs(vm.scheduler.duration); - vm.schedulerObj.schedulingInfo.additionalDurationInSeconds = convertToSecs(vm.scheduler.fallbackDuration); - vm.schedulerObj.schedulingInfo.concurrencyLimit = vm.scheduler.concurrency; - vm.schedulerObj.schedulingInfo.policyId = vm.scheduler.policy.policyName; - vm.schedulerObj.schedulingInfo['vnfDetails'][0].groupId = 'groupId'; - vm.schedulerObj.schedulingInfo['vnfDetails'][0].node = getVnfData(changeManagement.vnfNames); - - vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow = changeWindow; - if (vm.checkboxSelection == "true") { //When Scheduled now we remove the changeWindow - delete vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow; - } - vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow = changeWindow; - delete vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow; - - var requestScheduler = JSON.stringify(vm.schedulerObj); - console.log(requestScheduler); - SchedulerService.getStatusSchedulerId(requestScheduler, function (response) { - vm.schedulerID = response.data.uuid; - vm.isSpinnerVisible = true; - if (vm.schedulerID) { - var scheduledID = JSON.stringify({scheduleId: vm.schedulerID}); - seviceCallToGetTimeSlots(); - } - }); - } - - function seviceCallToGetTimeSlots() { - - SchedulerService.getTimeSotsForSchedulerId(vm.schedulerID, function (response) { - if (vm.checkboxSelection == "false") { - if (response.data.entity.schedule) { - var scheduleColl = JSON.parse(response.data.entity.schedule); - if (scheduleColl.length > 0) { - vm.timeSlots = scheduleColl; - vm.isSpinnerVisible = false; - hasvaluereturnd = false; - $scope.stopPoll(); - openConfirmationModal(response.data.entity.scheduleId + " Successfully Returned TimeSlots."); - } - - } - else { - if (vm.timeSlots.length == 0 && hasthresholdreached == false) { - var polltime = VIDCONFIGURATION.SCHEDULER_POLLING_INTERVAL_MSECS; - pollpromise = poll(polltime, function () { - if (vm.timeSlots.length == 0) { - hasvaluereturnd = true; - seviceCallToGetTimeSlots() - } - else { - hasvaluereturnd = false; - } - - }); - - } else { - openConfirmationModal("Timeout error.") - } - } - - } - else { - if (response.data.entity) { - vm.isSpinnerVisible = false; - openConfirmationModal(response.data.entity.scheduleId + " Successfully Ready for Schedule.") - } - } - - }); - - } - - function openConfirmationModal(jobInfo) { - var modalInstance = $uibModal.open({ - templateUrl: 'app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html', - controller: 'alertNewSchedulerController', - controllerAs: 'vm', - resolve: { - jobInfo: function () { - return jobInfo; - } - } - }); - } - - var hasvaluereturnd = true; // Flag to check - var hasthresholdreached = false; - var thresholdvalue = VIDCONFIGURATION.SCHEDULER_MAX_POLLS; // interval threshold value - - function poll(interval, callback) { - return $interval(function () { - if (hasvaluereturnd) { //check flag before start new call - callback(hasvaluereturnd); - } - - thresholdvalue = thresholdvalue - 1; //Decrease threshold value - if (thresholdvalue == 0) { - $scope.stopPoll(); // Stop $interval if it reaches to threshold - } - }, interval) - } - - -// stop interval. - $scope.stopPoll = function () { - $interval.cancel(pollpromise); - thresholdvalue = 0; //reset all flags. - hasvaluereturnd = false; - hasthresholdreached = true; - vm.isSpinnerVisible = false; - } - - function getVnfData(arrColl) { - var vnfcolletion = []; - - for (var i = 0; i < arrColl.length; i++) { - vnfcolletion.push(arrColl[i].name); - } - - return vnfcolletion - } - - function validateDates(form) { - if (vm.checkboxSelection == "false") { - - if (form.startDate.$error.invalidDate || form.endDate.$error.invalidDate) { - form.startDate.$setValidity("endBeforeStart", true); //already invalid (per validDate directive) - } else { - //depending on whether the user used the date picker or typed it, this will be different (text or date type). - //creating a new date object takes care of that. - var endDate = new Date(vm.toDate); - var startDate = new Date(vm.fromDate); - form.startDate.$setValidity("endBeforeStart", endDate >= startDate); - } - } - } - - - function extractChangeManagementCallbackDataStr(changeManagement) { - var result = {}; - - result.requestType = changeManagement.workflow; - result.requestDetails = []; - - _.forEach(changeManagement.vnfNames, function (vnf) { - - var data = { - vnfName: vnf.name, - vnfInstanceId: vnf.id, - modelInfo: { - modelType: 'vnf', - modelInvariantId: vnf.properties['model-invariant-id'], - modelVersionId: vnf.modelVersionId, - modelName: vnf.properties['vnf-name'], - modelVersion: vnf.version, - modelCustomizationName: vnf.properties['model-customization-name'], - modelCustomizationId: vnf.properties['model-customization-id'] - }, - cloudConfiguration: { - lcpCloudRegionId: vnf.availableVersions[0].cloudConfiguration.lcpCloudRegionId, - tenantId: vnf.availableVersions[0].cloudConfiguration.tenantId - }, - requestInfo: { - source: vnf.availableVersions[0].requestInfo.source, - suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback, - requestorId: vnf.availableVersions[0].requestInfo.requestorId - }, - relatedInstanceList: [], - requestParameters: { - usePreload: vnf.availableVersions[0].requestParameters.usePreload - } - }; - - var serviceInstanceId = ''; - _.forEach(vnf['service-instance-node'], function (instanceNode) { - if(instanceNode['node-type'] === 'service-instance'){ - serviceInstanceId = instanceNode.properties['service-instance-id']; - } - }); - - - _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) { - - var rel = related.relatedInstance; - - var relatedInstance = { - instanceId: serviceInstanceId, - modelInfo: { - modelType: rel.modelInfo.modelType, - modelInvariantId: rel.modelInfo.modelInvariantId, - modelVersionId: rel.modelInfo.modelVersionId, - modelName: rel.modelInfo.modelName, - modelVersion: rel.modelInfo.modelVersion, - modelCustomizationName: rel.modelInfo.modelCustomizationName, - modelCustomizationId: rel.modelInfo.modelCustomizationId - } - }; - - if (rel.vnfInstanceId) - relatedInstance.instanceId = rel.vnfInstanceId; - - data.relatedInstanceList.push({relatedInstance: relatedInstance}); - }); - - - result.requestDetails.push(data); - } - ); - - - // _.forEach(changeManagement.vnfNames, function (vnfName) { - // if (vnfName && vnfName.version) { - // if (vnfName.selectedFile) { - // vnfName.version.requestParameters.userParams = vnfName.selectedFile; - // } - // result.requestDetails.push(vnfName.version) - // } - // }); - - return JSON.stringify(result); - } - - init(); - }; - - appDS2.directive('validDate', function () { - return { - restrict: 'A', - require: 'ngModel', - link: function (scope, element, attrs, control) { - control.$parsers.push(function (viewValue) { - var newDate = model.$viewValue; - control.$setValidity("invalidDate", true); - if (typeof newDate === "object" || newDate == "") return newDate; // pass through if we clicked date from popup - if (!newDate.match(/^\d{1,2}\/\d{1,2}\/((\d{2})|(\d{4}))$/)) - control.$setValidity("invalidDate", false); - return viewValue; - }); - } - }; - }) - - -})(); - diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css deleted file mode 100644 index 8da5c55c5..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css +++ /dev/null @@ -1,145 +0,0 @@ -.btn-white { - font-family: OpenSans; - border-radius: 2px; - border: 1px solid #d8d8d8; - background-color: #ffffff; - width: 94px; - height: 30px; - color: #5a5a5a; - font-size: 13px; - font-weight: 400; - line-height: 36px; - text-align: center; -} - -.btn-primary { - font-family: OpenSans; - border-radius: 2px; - border: 1px solid #0091c8; - background-color: #009fdb; - width: 94px; - height: 30px; - color: #ffffff; - font-size: 13px; - font-weight: 400; - line-height: 36px; - text-align: center; -} - -.modal-header { - border: none!important; - padding: 15px 15px 0px 15px!important; -} - -.modal-header h3 { - font-family: OpenSans; - color: #5a5a5a; - font-size: 22px; - font-weight: 300; - line-height: 16px; - padding-bottom: 20px; - border-bottom: 3px solid #009fdb; - -} - -.modal-footer { - background-color: #eaeaea; -} - -.modal-dialog { - width: 587px; - border-radius: 8px; -} - -.modal-content { - width: 587px; - border-radius: 8px; - background-color: #ffffff; -} -.label-font{ - font-size: 1em; -} -.calender-icon{ - background-image: url(../../../../../app/fusion/external/ebz/images/Calendar.svg); - background-repeat:no-repeat; - background-position:98%; - border-radius: 6px; - border: 1px solid #888; - color: #444; - font-family: clearview_att_regular; - width: 100%; - outline: 0; - padding: 7px 10px; - text-transform: none; - z-index: 0; - height: 40px; - position: relative; - -} - -input.calender-icon:focus{ - background-image: url(../../../../../app/fusion/external/ebz/images/Calendar_blue.svg); - background-repeat:no-repeat; -} - - - -.timeslots-content{ - margin-top: 0px; - margin-bottom: 0px; - height: 10em; -} -.find-block{ - float:5em; -} -.timeslots-block{ -/* margin-top: 1em; */ - height: 85px; - } - .policy-combo{ - background-image: none; - } - - div[ng-controller=newSchedulerController] .schedulerVisible { - visibility: visible; -} -div[ng-controller=newSchedulerController] .schedulerHidden { - visibility: hidden; -} - -.table { - border: 1px solid #eaeaea; - box-sizing: border-box; - background-color: #ffffff; - box-shadow: 0px 2px 7px 0px rgba(34, 31, 31, 0.17); - font-family: OpenSans; - color: #5a5a5a; - font-size: 14px; - font-weight: 400; -} -.table>thead { - background-color: #d2d2d2; - font-family: OpenSans; - color: #191919; - font-size: 13px; - font-weight: 600; - line-height: 40px; -} - -.table-headline-row { - font-family: OpenSans; - color: #5a5a5a; - font-size: 14px; - font-weight: 600; - background-color: #eaeaea; - box-shadow: 0px 1px 1px 0px rgba(34, 31, 31, 0.19); -} - -.table-bordered{border:1px solid #eaeaea;} -.table-bordered>tbody>tr>td, -.table-bordered>tbody>tr>th, -.table-bordered>tfoot>tr>td, -.table-bordered>tfoot>tr>th, -.table-bordered>thead>tr>td, -.table-bordered>thead>tr>th{border:1px solid #eaeaea;} - diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html deleted file mode 100644 index 498ff2ec4..000000000 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html +++ /dev/null @@ -1,101 +0,0 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-scheduler/new-scheduler.css" /> -<div class="modal-header"> - <h3 class="modal-title" id="modal-title">Scheduler Change</h3> -</div> -<form name="newschedulermodalForm" ng-submit="vm.schedule(newschedulermodalForm)"> - <div class="modal-body"> - - <div class="form-group" > - <label><input type="radio" ng-model="vm.checkboxSelection" ng-change="vm.radioSelections()" value="true">Now</label> - <label><input type="radio" ng-model="vm.checkboxSelection" ng-change="vm.radioSelections()" value="false">Range</label> - </div> -<!-- <div class="form-group"> --> -<!-- <input type="radio" ng-model="checkboxSelection" value="false" ><label>Range</label> --> -<!-- </div> --> - - - <div class="form-group" > - <label class="control-label">From Date</label> - <input ng-disabled="(vm.checkboxSelection=='true')? true:false" valid-date name="startDate" ng-model="vm.fromDate" id="startDate" datetime-picker ng-required="false" hour="23" minute='59' class="calender-icon"/> - - </div> - <div class="form-group" > - <label class="control-label">To Date</label> - <input ng-disabled="(vm.checkboxSelection=='true')? true:false" valid-date name="endDate" ng-model="vm.toDate" id="endDate" datetime-picker ng-required="false" hour="23" minute='59' class="calender-icon" /> - <span ng-show="newschedulermodalForm.startDate.$error.endBeforeStart">To date must be on or after From date.</span> - <span ng-show="newschedulermodalForm.startDate.$error.invalidDate || newschedulermodalForm.endDate.$error.invalidDate">Check dates for validity</span> - <span ng-show="newschedulermodalForm.startDate.$error.required || newschedulermodalForm.endDate.$error.required">A required date is missing</span> - </div> - - <div class="form-group" > - <label>Please Select Option For Duration and FallBack</label> - - <select class="form-control" name="selecttime" data-tests-id="timeUnitSelect" ng-model="vm.selectedOption" ng-change="vm.updateMinMax()"> - <option value="hours">HOURS</option> - <option value="minutes">MINUTES</option> - <option value="seconds">SECONDS</option> - </select> - </div> - <div class="row"> - <div class="form-group col-md-6 col-xs-12"> - <label class="control-label">Duration</label> - <input type="number" style="font-size: 1em;" data-tests-id="durationInput" name="durationinput" ng-model="vm.scheduler.duration" ng-required="true"> - - </div> - <div class="form-group col-md-6 col-xs-12" > - <label class="control-label">Fallback Duration</label> - <input type="number" style="font-size: 1em;" name="fallbackinput" data-tests-id="fallbackInput" ng-model="vm.scheduler.fallbackDuration" ng-required="true"> - - - </div> - </div> - <div class="form-group"> - <label class="control-label">Concurrency Limit</label> - <input type="number" style="font-size: 1em;" name="input" data-tests-id="concurrencyLimitInput" ng-model="vm.scheduler.concurrency" min="1" max="30" ng-required="true"> - </div> - <div class="form-group"> - <label class="control-label">Policy</label> - <select class="policy-combo" ng-model="vm.scheduler.policy" id="policy" ng-options="item.policyName for item in vm.policys"> - <option value="">Select Policy</option> - </select> - </div> - <div class="form-group"> - <button type="submit" id="find" name="Find" ng-disabled="vm.isClicked" class="btn btn-primary find-block">Find</button> - <span class="spinner" ng-show="vm.isSpinnerVisible"> - <img src="app/vid/images/spinner.gif"> - </img> - - </span> - - </div> - - <div class="form-group" ng-show="(vm.checkboxSelection=='false')? true:false"> -<!-- <label class="control-label">Time Slots</label> --> -<!-- <textarea rows="10" cols="50" class="timeslots-block" ></textarea> --> - <table class="table table-bordered"> - <thead class="thead-default"> - <tr> - <th>Start Time</th> - <th>End Time</th> - </tr> - </thead> - <tbody> - - <tr class="table-headline-row" ng-repeat="timeslot in vm.timeSlots"> - <td>{{timeslot.startTime}}</td> - <td>{{timeslot.finishTime}}</td> - </tr> - </tbody> - </table> - </div> - - </div> - <div class="modal-footer"> - <div class="pull-right"> - <button type="button" id="btn" name="submit" class="btn btn-primary" ng-click="vm.submit()">Schedule</button> - <button type="button" id="btn" name="submit" class="btn btn-primary" ng-click="vm.reject()">Reject</button> - <button type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button> - </div> - </div> -</form> - diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.controller.js new file mode 100644 index 000000000..daec9b2e9 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.controller.js @@ -0,0 +1,65 @@ +(function () { + 'use strict'; + + appDS2.controller("newTestEnvironmentModalController", ["$uibModalInstance", "$uibModal", "AaiService", "TestEnvironmentsService","OwningEntityService", + "$log", "$scope", "_", "COMPONENT","$rootScope", newTestEnvironmentsModalController]); + + function newTestEnvironmentsModalController($uibModalInstance, $uibModal, AaiService, TestEnvironmentsService,OwningEntityService, $log, $scope, _, COMPONENT, $rootScope) { + var vm = this; + vm.newEnvironment = {}; + + var init = function () { + vm.newEnvironment.operationalEnvironmentType = "VNF"; + loadCategoryParameters(); + loadEcompEnvironmentsList(); + }; + + var loadEcompEnvironmentsList = function () { + TestEnvironmentsService.loadAAIestEnvironments("ECOMP") + .then(function(response) { + vm.environments = response.operationalEnvironment; + }) + .catch(function (error) { + vm.aaiConnectError = error.message; + $log.error(error); + }); + }; + + var loadCategoryParameters = function () { + OwningEntityService.getOwningEntityProperties(function(response){ + vm.environmentsTypesList = response["operational-environment-type"].map(function (x){ + return x.name;}); + vm.workloadContextList = response["workload-context"].map(function (x){ + return x.name;}); + },COMPONENT.TENANT_ISOLATION_FAMILY); + } + + + vm.setEcompEnvironment = function (selectedIndex) { + var ecompEnvironment = vm.environments[selectedIndex]; + vm.newEnvironment.ecompInstanceId = ecompEnvironment.operationalEnvironmentId; + vm.newEnvironment.ecompInstanceName = ecompEnvironment.operationalEnvironmentName; + vm.newEnvironment.tenantContext = ecompEnvironment.tenantContext; + }; + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.createEnvironment = function () { + if($scope.newTestEnvironment.$valid) { + vm.newEnvironment.workloadContext = vm.newEnvironment.operationalEnvironmentType + '_' + vm.newEnvironment.workloadContext; + var requestDetails = vm.newEnvironment; + $rootScope.$broadcast(COMPONENT.MSO_CREATE_ENVIRONMENT, { + url : COMPONENT.OPERATIONAL_ENVIRONMENT_CREATE, + requestDetails : requestDetails + }); + vm.close(); + } + }; + + + + init(); + } +})();
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.html new file mode 100644 index 000000000..cd14a76cb --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.html @@ -0,0 +1,50 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> +<div class="modal-header"> + <h3 class="modal-title" id="modal-title">New Test Environment</h3> + <span ng-click="vm.close()" class="pull-right modal-close" aria-hidden="true">×</span> +</div> +<form class="form-create" data-tests-id="test-new-environment-form" name="newTestEnvironment" ng-submit="vm.createEnvironment()"> + <div class="modal-body"> + <div class="form-group"> + <label class="control-label" for="environmentName">Environment Name</label> + <input id="environmentName" class="form-control" ng-model="vm.newEnvironment.instanceName" name="instanceName" data-tests-id="environment-name" placeholder="Enter environment name" required> + </div> + <div class="form-group"> + <label class="control-label" for="ecompInstanceId">ECOMP Environment ID</label> + <select class="form-control" ng-class="{'grayedOut': !selectedIndex, 'connect-error': vm.aaiConnectError}" ng-model="selectedIndex" name="ecompInstanceId" id="ecompInstanceId" data-tests-id="ecomp-instance-id" required ng-change="vm.setEcompEnvironment(selectedIndex)"> + <option value="" disabled selected hidden>Select environment ID</option> + <option data-tests-id="environment-id-option" class="environmentIdOption" ng-repeat="item in vm.environments" ng-value="$index">{{item.operationalEnvironmentId}}</option> + </select> + </div> + <div class="form-group"> + <label class="control-label" for="ecompInstanceName">ECOMP Environment Name</label> + <input id="ecompInstanceName" class="form-control" ng-model="vm.newEnvironment.ecompInstanceName" name="ecompInstanceName" data-tests-id="ecomp-instance-name" required disabled> + </div> + <div class="form-group"> + <label class="control-label" for="tenantContext">Select VSP</label> + <input id="tenantContext" class="form-control" ng-model="vm.newEnvironment.tenantContext" name="tenantContext" data-tests-id="tenant-context" required disabled> + </div> + <div class="form-group"> + <label class="control-label" for="operationalEnvironmentType">Environment Type</label> + <select class="form-control" ng-class="{'grayedOut': !vm.newEnvironment.operationalEnvironmentType}" ng-model="vm.newEnvironment.operationalEnvironmentType" name="operationalEnvironmentType" id="operationalEnvironmentType" data-tests-id="operational-environment-type" required> + <option value="" disabled selected hidden>Enter environment type</option> + <option data-tests-id="environment-type-option" class="environmentTypeOption" ng-repeat="item in vm.environmentsTypesList" ng-value="item">{{item}}</option> + </select> + </div> + <div class="form-group"> + <label class="control-label" for="workloadContext">Workload Context</label> + <select class="form-control" ng-class="{'grayedOut': !vm.newEnvironment.workloadContext}" ng-model="vm.newEnvironment.workloadContext" name="workloadContext" id="workloadContext" data-tests-id="workload-context" required> + <option value="" disabled selected hidden>Select workload context</option> + <option data-tests-id="workload-context-option" class="workloadContextOption" ng-repeat="item in vm.workloadContextList" ng-value="item">{{vm.newEnvironment.operationalEnvironmentType + '_' + item}}</option> + </select> + </div> + <div data-tests-id="test-new-environment-error" class="connect-error" ng-if="vm.aaiConnectError">{{vm.aaiConnectError}}</div> + </div> + <div class="modal-footer"> + <div class="pull-right"> + <button data-tests-id="submit-button" type="submit" id="submit" name="submit" class="btn btn-primary" data-ng-disabled="newTestEnvironment.$invalid">Create</button> + <button data-tests-id="cancel-button" type="button" id="cancel" name="cancel" class="btn btn-white" ng-click="vm.close()">Cancel</button> + </div> + </div> +</form> + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html index 911e86c24..59c30c54d 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html @@ -1,4 +1,4 @@ -<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/new-change-management/new-change-management.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/modal-create-new.css" /> <link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/pending-change-management/pending-change-management.css" /> <div class="modal-header"> <h3 class="modal-title" id="pending-modal-header">Pending</h3> @@ -8,5 +8,5 @@ <span id="pending-modal-content">{{vm.content}}</span> </div> <div class="modal-footer"> - <div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div> + <!--<div ng-include="'app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html'"></div>--> </div> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.css new file mode 100644 index 000000000..2c7f3a106 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.css @@ -0,0 +1,37 @@ +.modal-dialog * { + font-family: OpenSans-Regular, sans-serif; +} +.modal-dialog { + width: 540px; +} +.modal-dialog service-metadata{ + background: white; +} +.modal-dialog .modal-footer { + background: #F8F8F8; + border-radius: 0 0 8px 8px; +} +.modal-dialog .cancel-btn { + width: 120px; +} +.modal-dialog .title { + font-size: 22px; + color: #000000; +} +.modal-dialog .top { + margin: 15px 20px; + border-bottom: 3px solid #009FDB; + padding-bottom: 15px; +} +.modal-dialog .modal-x { + float: right; + margin-top: 10px; + height: 15px; + cursor:pointer; +} +.modal-dialog service-metadata label { + margin-bottom: 3px; +} +.modal-dialog service-metadata .field { + margin-top: 11px; +}
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.html new file mode 100644 index 000000000..47ed3e424 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.html @@ -0,0 +1,12 @@ +<link rel="stylesheet" type="text/css" href="app/vid/scripts/modals/service-metadata/service-metadata.css"/> +<div class="top"> + <span class="title">{{selectedMetadata[0].value}}</span> + <span class="top-btn sprite modal-x" data-ng-click="cancel()"></span> +</div> + +<div class="meatadata-modal-body" id="modal-body"> + <service-metadata service-metadata-fields="selectedMetadata"></service-metadata> +</div> +<div class="modal-footer"> + <button class="cancel-btn grey" data-tests-id="cancel" data-ng-click="cancel()">Close</button> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/OwningEntityService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/OwningEntityService.js new file mode 100644 index 000000000..ef48aa939 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/OwningEntityService.js @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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 OwningEntityService = function ($http, $log, PropertyService, UtilityService, COMPONENT) { + return { + getOwningEntityProperties: function ( successCallbackFunction, familyName) { + $log.debug("OwningEntityService:getOwningEntityProperties"); + familyName = familyName || COMPONENT.PARAMETER_STANDARDIZATION_FAMILY; + var url = COMPONENT.GET_CATEGORY_PARAMETERS+"?familyName=" + familyName+ "&r=" + Math.random(); + var config = { timeout: PropertyService.getServerResponseTimeoutMsec() }; + + $http.get(url, config) + .then(function (response) { + successCallbackFunction(response.data.categoryParameters); + }).catch(UtilityService.runHttpErrorHandler); + } + } +}; + +appDS2.factory("OwningEntityService", ["$http", "$log", "PropertyService", + "UtilityService", "COMPONENT", "FIELD", OwningEntityService]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js index a10f602bf..53a941bfb 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js @@ -21,6 +21,70 @@ "use strict";
var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q) {
+
+ function getServiceInstance(serviceInstanceIdentifier, findBy) {
+ serviceInstanceIdentifier.trim();
+
+ return $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + serviceInstanceIdentifier + "/" + findBy + "?r=" + Math.random(), {}, {
+ timeout: PropertyService.getServerResponseTimeoutMsec()
+ });
+ }
+
+ function getPnfByName(pnfName) {
+ var deferred = $q.defer();
+ var url = COMPONENT.AAI_GET_PNF_BY_NAME+ encodeURIComponent(pnfName) ;
+ var config = { timeout: PropertyService.getServerResponseTimeoutMsec() };
+
+ $http.get(url, config)
+ .success(function (response) {
+ deferred.resolve({data: response});
+ })
+ .error(function(data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+ };
+
+
+ function getGlobalCustomerIdFromServiceInstanceResponse(response) {
+ var globalCustomerId = "";
+ if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
+ var customerIndex = 5;
+ var customerIdIndex = 6;
+ var itemIndex = 0;
+
+ var item = response.data[FIELD.ID.RESULT_DATA][itemIndex];
+ var url = item[FIELD.ID.RESOURCE_LINK];
+ var urlParts = url.split("/");
+ if (urlParts[customerIndex] === FIELD.ID.CUSTOMER) {
+ globalCustomerId = urlParts[customerIdIndex];
+ }
+ }
+ return globalCustomerId;
+ }
+
+ function searchServiceInstances(query) {
+ return $http.get( COMPONENT.SEARCH_SERVICE_INSTANCES + query, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ var displayData = response.data[FIELD.ID.SERVICE_INSTANCES];
+ if (!displayData.length) {
+ displayData = [{
+ globalCustomerId : null,
+ subscriberName : null,
+ serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
+ serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
+ }];
+ }
+ return {displayData: displayData};
+ })
+ }
+
+ function getJoinedQueryString(queries) {
+ return queries.filter(function (val) {return val;}).join("&");
+ }
+
return {
getSubscriberName : function(globalCustomerId,
successCallbackFunction) {
@@ -34,16 +98,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE timeout : PropertyService
.getServerResponseTimeoutMsec()
}).then(function(response) {
- var subName = "";
+ var result = {};
if (response.data) {
- subName = response.data[FIELD.ID.SUBNAME];
+ result.subscriberName = response.data[FIELD.ID.SUBNAME];
+ result.serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS];
}
- successCallbackFunction(subName);
+ successCallbackFunction(result);
})["catch"]
(UtilityService.runHttpErrorHandler);
},
-
runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH +
@@ -86,6 +150,48 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE });
},
+ getPNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
+
+ var url = COMPONENT.AAI_GET_PNF_INSTANCE +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {}, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ successCallback(response);
+ } else {
+ errorCallback(response);
+ }
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+
+ searchServiceInstances: searchServiceInstances,
+
+ getModelVersionId: function (subscriberId, instanceId) {
+ var globalCustomerIdQuery = COMPONENT.SELECTED_SUBSCRIBER_SUB_PATH + subscriberId;
+ var serviceInstanceQuery = COMPONENT.SELECTED_SERVICE_INSTANCE_SUB_PATH + instanceId;
+
+ var query = "?" + getJoinedQueryString([globalCustomerIdQuery, serviceInstanceQuery]);
+
+ var deferred = $q.defer();
+
+ searchServiceInstances(query).then(function (response) {
+ var displayData = response.displayData;
+ if (displayData[0] && displayData[0].aaiModelVersionId) {
+ deferred.resolve(displayData[0].aaiModelVersionId);
+ } else {
+ deferred.reject(FIELD.ERROR.MODEL_VERSION_ID_MISSING);
+ }
+ }).catch(function (err) {
+ deferred.reject(err);
+ });
+
+ return deferred.promise;
+ },
getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) {
var subscriber;
@@ -124,9 +230,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }
});
} else {
- if (serviceInstanceId == []) {
- serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ];
- }
+ serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ];
}
angular.forEach(serviceInstanceId, function(subVal, subKey) {
displayData.push({
@@ -145,7 +249,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE } else {
displayData.push({
globalCustomerId : selectedSubscriber,
- subscriberName : selectedSubscriberName,
+ subscriberName : subscriberName,
serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
});
@@ -178,6 +282,26 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE });
},
+ getServiceInstance : getServiceInstance,
+ getPnfByName : getPnfByName,
+
+ getGlobalCustomerIdByInstanceIdentifier : function(serviceInstanceIdentifier, findBy) {
+ serviceInstanceIdentifier.trim();
+
+ return getServiceInstance(serviceInstanceIdentifier, findBy)
+ .then(function (response) {
+ return getGlobalCustomerIdFromServiceInstanceResponse(response);
+ });
+ },
+
+ getMultipleValueParamQueryString: function(values, paramSubPath) {
+ if (values.length) {
+ return paramSubPath + values.filter(function (val) {return val;}).join("&" + paramSubPath);
+ }
+ },
+
+ getJoinedQueryString: getJoinedQueryString,
+
getServices2 : function(successCallback, errorCallback ) {
$http.get( FIELD.ID.AAI_GET_SERVICES, {}, {
@@ -252,12 +376,6 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE var lcpCloudRegionTenants = [];
var aaiLcpCloudRegionTenants = response.data;
- lcpCloudRegionTenants.push({
- "cloudRegionId": "",
- "tenantName": FIELD.PROMPT.REGION,
- "tenantId": ""
- });
-
for (var i = 0; i < aaiLcpCloudRegionTenants.length; i++) {
lcpCloudRegionTenants.push({
"cloudRegionId": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID],
@@ -267,8 +385,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }
successCallbackFunction(lcpCloudRegionTenants);
- })["catch"]
- (UtilityService.runHttpErrorHandler);
+ }).catch(function(error) {
+ (UtilityService.runHttpErrorHandler(error.data, error.status));
+ })
},
getSubscribers : function(successCallbackFunction) {
$log
@@ -306,7 +425,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"]
(UtilityService.runHttpErrorHandler);
},
- getLoggedInUserID : function(successCallbackFunction) {
+ getLoggedInUserID : function(successCallbackFunction, catchCallbackFunction) {
$log
.debug("AaiService:getLoggedInUserID");
var url = COMPONENT.GET_USER_ID;
@@ -325,6 +444,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE successCallbackFunction([]);
}
},function(failure){console.log("failure")})["catch"]
+ if(catchCallbackFunction) {
+ catchCallbackFunction();
+ }
(UtilityService.runHttpErrorHandler);
},
getServices : function(successCallbackFunction) {
@@ -459,6 +581,8 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE return deferred.promise;
},
+
+
getSubscriberServiceTypes: function(subscriberUuid) {
var deferred = $q.defer();
$log.debug("AaiService:getSubscriberServiceTypes: subscriberUuid: " + subscriberUuid);
@@ -477,6 +601,61 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }
return deferred.promise;
+ },
+ getVnfInstancesList: function(globalSubscriberId, serviceType, modelVersionId ,modelInvariantId, cloudRegionId) {
+ var deferred = $q.defer();
+ $http.get([COMPONENT.AAI_GET_VNF_INSTANCES_LIST,
+ globalSubscriberId,
+ serviceType,
+ modelVersionId,
+ modelInvariantId,
+ cloudRegionId]
+ .join(COMPONENT.FORWARD_SLASH))
+ .success(function (response) {
+ deferred.resolve(response);
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
+ });
+ return deferred.promise;
+ },
+ getPnfInstancesList: function (globalCustomerId, serviceType, modelVersionId, modelInvariantId, cloudRegionId, equipVendor, equipModel) {
+ var deferred = $q.defer();
+ $http.get([COMPONENT.AAI_GET_PNF_INSTANCES_LIST,
+ globalCustomerId, serviceType,
+ modelVersionId, modelInvariantId,
+ cloudRegionId,
+ equipVendor, equipModel
+ ].join(COMPONENT.FORWARD_SLASH))
+ .success(function (response) {
+ deferred.resolve(response);
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
+ });
+ return deferred.promise;
+ },
+ getByUri: function(uri) {
+ var deferred = $q.defer();
+
+ $http.get(COMPONENT.AAI_GET_BY_URI + uri)
+ .success(function (response) {
+ deferred.resolve({data: []});
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
+ },
+ getConfiguration: function(configurationId) {
+ var deferred = $q.defer();
+
+ $http.get(COMPONENT.AAI_GET_CONFIGURATION + configurationId)
+ .success(function (response) {
+ deferred.resolve({data: []});
+ }).error(function (data, status, headers, config) {
+ deferred.reject({message: data, status: status});
+ });
+
+ return deferred.promise;
}
}};
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js index f2282d69a..fdab6564b 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js @@ -5,16 +5,20 @@ function changeManagementService($http, $q, COMPONENT, VIDCONFIGURATION) { this.getWorkflows = function (vnfs) { - var deferred = $q.defer(); - - $http.get(COMPONENT.GET_WORKFLOW.replace("@vnfs", vnfs)) - .success(function (response) { - deferred.resolve({data: response}); - }).error(function (data, status, headers, config) { - deferred.reject({message: data, status: status}); + var requestVnfs = _.map(vnfs, function (vnf) { + return { + UUID: vnf["modelVersionId"], + invariantUUID: vnf["invariant-id"] + }; }); - - return deferred.promise; + var requestDetails = {vnfsDetails: requestVnfs}; + return $http.post(COMPONENT.GET_WORKFLOW, requestDetails) + .success(function (response) { + return {data: response}; + }) + .catch(function (err) { + return {data: []}; + }); }; this.getMSOChangeManagements = function() { diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js index ea46dcb9b..615f25ec2 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js @@ -25,22 +25,26 @@ var ComponentService = function($log, COMPONENT, UtilityService) { var _this = this;
var componentList = [ {
- id : COMPONENT.NETWORK,
- displayName : "Network"
+ id : COMPONENT.NETWORK,
+ displayName : "Network"
}, {
- id : COMPONENT.SERVICE,
- displayName : "Service Instance"
- }, {id : COMPONENT.OLDVERSION,
- displayName : "Previous Version"
+ id : COMPONENT.SERVICE,
+ displayName : "Service Instance"
+ }, {
+ id : COMPONENT.OLDVERSION,
+ displayName : "Previous Version"
}, {
- id : COMPONENT.VNF,
- displayName : "Virtual Network Function"
+ id : COMPONENT.VNF,
+ displayName : "Virtual Network Function"
+ }, {
+ id : COMPONENT.VF_MODULE,
+ displayName : "VF Module"
}, {
- id : COMPONENT.VF_MODULE,
- displayName : "VF Module"
+ id: COMPONENT.VOLUME_GROUP,
+ displayName: "Volume Group"
}, {
- id : COMPONENT.VOLUME_GROUP,
- displayName : "Volume Group"
+ id : COMPONENT.CONFIGURATION,
+ displayName : "Port Mirroring Configuration"
} ];
var getInventoryInfo = function(suffix, inventoryItem) {
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js index e171e2856..838ab3719 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js @@ -30,345 +30,355 @@ */
var CreationService = function($log, AaiService, AsdcService, DataService,VIDCONFIGURATION,
- ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService) {
-
- var _this = this;
-
- var getAsyncOperationList = function() {
- if (DataService.getLoggedInUserId() == null)
- getLoggedInUserID();
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- return [ getSubscribers, getServices,getAicZones ];
- case COMPONENT.NETWORK:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VNF:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VF_MODULE:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VOLUME_GROUP:
- return [ getLcpCloudRegionTenantList ];
- }
- };
-
- /*
- * "getSummaryList" and "getUserProvidedList" return parameters that should
- * be displayed in the summary and user provided sections, respectively. The
- * functions are expected to return lists that are in the format needed by
- * the parameter-block directive.
- */
-
- var getSummaryList = function() {
-
- /*
- * These placeholders should be removed and their usage in
- * "getSummaryList" should be replaced by appropriate code as the
- * requirements and interfaces firm up.
- */
-
- var PLACEHOLDER_RESOURCE_DESCRIPTION = "Resource Description (PLACEHOLDER)";
- var PLACEHOLDER_SERVICE_CATEGORY = "Service Category (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_DESCRIPTION = "VF Module Description (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_LABEL = "VF Module Label (PLACEHOLDER)";
- var PLACEHOLDER_VF_MODULE_TYPE = "VF Module Type (PLACEHOLDER)";
-
- _this.parameterList = new Array();
-
- /*
- * Common fields displayed at the top of all create instance screens.
- */
- if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]==null
- || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==undefined
- || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==''){
- addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
- }
-
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- if ( !DataService.getALaCarte() ) {
- // for macro instantiation need to add the resource names under the node template list
- // this field is called modelCustomizationName in the asdc client code
- var p;
- var rlist = DataService.getResources();
- var res;
- if ( rlist != null ) {
- for (var i = 0; i < rlist.length; i++) {
- res = rlist[i];
-
- p = FIELD.NAME.RESOURCE_NAME.concat(" " + (i+1));
- addToList(p, res.name );
- p = FIELD.NAME.RESOURCE_DESCRIPTION.concat(" " + (i+1));
- addToList(p, res.description );
- }
- }
- }
- if(DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=null && DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=''){
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getModelInfo(_this.componentId)["createSubscriberName"]);
- }
- if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=null && DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=''){
- addToList(FIELD.NAME.SERVICE_TYPE, DataService
- .getModelInfo(_this.componentId)["serviceTypeName"]);
- addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
- }
- addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.SERVICE_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.SERVICE_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
- addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
- if (DataService.getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE] != "null") {
- addToList(FIELD.NAME.SERVICE_TYPE, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE]);
- addToList(FIELD.NAME.SERVICE_ROLE, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_ROLE]);
- }
-
- break;
- case COMPONENT.VF_MODULE:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- break;
- case COMPONENT.VNF:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_CUSTOMIZATION_NAME]);
- addToList(FIELD.NAME.MODEL_VNF_TYPE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_TYPE]);
- addToList(FIELD.NAME.MODEL_VNF_ROLE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_ROLE]);
- addToList(FIELD.NAME.MODEL_VNF_FUNCTION, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_FUNCTION]);
- addToList(FIELD.NAME.MODEL_VNF_CODE, DataService
- .getModelInfo(_this.componentId)[COMPONENT.VNF_CODE]);
- break;
- case COMPONENT.NETWORK:
- case COMPONENT.VOLUME_GROUP:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
- break;
- }
-
- return _this.parameterList;
- };
-
- var getUserProvidedList = function() {
- var parameterList = [];
- var isUserProvidedNaming = false;
- if ( (DataService.getModelInfo(_this.componentId).serviceEcompNaming != null)
- && (DataService.getModelInfo(_this.componentId).serviceEcompNaming === "false") ) {
- isUserProvidedNaming = true;
- }
-
- var isInTop = DataService.getHideServiceFields() || false;
- if (_this.componentId === COMPONENT.SERVICE) {
- if ( DataService.getALaCarte() ) {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
- if(!isInTop){
- parameterList = parameterList.concat([ getSubscribersParameter(),
- FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
- }
- }
- else {
- // macro
-
- if(!isInTop){
- if (isUserProvidedNaming) {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
-
- }
- parameterList = parameterList.concat([ getSubscribersParameter() ]);
- parameterList = parameterList.concat([ getServiceId(),
- FIELD.PARAMETER.SERVICE_TYPE,
- FIELD.PARAMETER.LCP_REGION,
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED,
- ]);
- parameterList = parameterList.concat([ getAICZones() ]);
-
-
- }else{
- parameterList = parameterList.concat([ getServiceId(),
- FIELD.PARAMETER.LCP_REGION,
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- }
- }
- else {
- parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- parameterList = parameterList.concat([ getServiceId(),
- getLcpRegion(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- break;
- case COMPONENT.VF_MODULE:
- parameterList = parameterList.concat([
- getLcpRegion(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED
- ]);
-
- var availableVolumeGroupList = DataService.getAvailableVolumeGroupList();
-
- if (availableVolumeGroupList && availableVolumeGroupList.length > 0) {
- var availableVolumeGroupNames = [FIELD.STATUS.NONE];
-
- for (var i = 0; i < availableVolumeGroupList.length; i++) {
- availableVolumeGroupNames.push(availableVolumeGroupList[i].instance.name);
- }
-
- parameterList.push(addOptionList(
- FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP,
- availableVolumeGroupNames));
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- parameterList = parameterList.concat([ getLcpRegion(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- }
- parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
- if(_this.componentId === COMPONENT.VF_MODULE ){
- parameterList.push({name: FIELD.NAME.SDN_C_PRELOAD,
- id: FIELD.ID.SDN_C_PRELOAD,
- type: "checkbox",
- isEnabled: true,
- isRequired: false,
- hideFieldAndLabel: true
- }
- );
- parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- type: "checkbox",
- isEnabled: true,
- isRequired: false,
- value:false
- }
- );
-
- parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
- type: "file",
- isRequired: false,
- isVisiblity: false
- }
- );
- }
-
- if( VIDCONFIGURATION.UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED && _this.componentId === COMPONENT.VOLUME_GROUP){
- parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
- type: "checkbox",
- isEnabled: true,
- isRequired: false
- }
- );
-
- parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
- id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
- type: "file",
- isRequired: false,
- isVisiblity: false
- }
- );
- }
-
- addArbitraryParameters(parameterList);
-
- return parameterList;
- };
+ ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService, OwningEntityService) {
+
+ var _this = this;
+
+ var getAsyncOperationList = function() {
+ if (DataService.getLoggedInUserId() == null) {
+ getLoggedInUserID();
+ } else {
+ UtilityService.startNextAsyncOperation();
+ }
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return [ getSubscribers, getServices, getAicZones, getOwningEntityProperties ];
+ case COMPONENT.NETWORK:
+ return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
+ case COMPONENT.VNF:
+ return [ getLcpCloudRegionTenantList, getOwningEntityProperties ];
+ case COMPONENT.VF_MODULE:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VOLUME_GROUP:
+ return [ getLcpCloudRegionTenantList ];
+ }
+ };
+
+ /*
+ * "getSummaryList" and "getUserProvidedList" return parameters that should
+ * be displayed in the summary and user provided sections, respectively. The
+ * functions are expected to return lists that are in the format needed by
+ * the parameter-block directive.
+ */
+
+ var getSummaryList = function() {
+
+ /*
+ * These placeholders should be removed and their usage in
+ * "getSummaryList" should be replaced by appropriate code as the
+ * requirements and interfaces firm up.
+ */
+
+ var PLACEHOLDER_RESOURCE_DESCRIPTION = "Resource Description (PLACEHOLDER)";
+ var PLACEHOLDER_SERVICE_CATEGORY = "Service Category (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_DESCRIPTION = "VF Module Description (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_LABEL = "VF Module Label (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_TYPE = "VF Module Type (PLACEHOLDER)";
+
+ _this.parameterList = new Array();
+
+ /*
+ * Common fields displayed at the top of all create instance screens.
+ */
+ if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]==null
+ || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==undefined
+ || DataService.getModelInfo(_this.componentId)["serviceTypeName"]==''){
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+ }
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ if ( !DataService.getALaCarte() ) {
+ // for macro instantiation need to add the resource names under the node template list
+ // this field is called modelCustomizationName in the asdc client code
+ var p;
+ var rlist = DataService.getResources();
+ var res;
+ if ( rlist != null ) {
+ for (var i = 0; i < rlist.length; i++) {
+ res = rlist[i];
+
+ p = FIELD.NAME.RESOURCE_NAME.concat(" " + (i+1));
+ addToList(p, res.name );
+ p = FIELD.NAME.RESOURCE_DESCRIPTION.concat(" " + (i+1));
+ addToList(p, res.description );
+ }
+ }
+ }
+ if(DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=null && DataService.getModelInfo(_this.componentId)["createSubscriberName"]!=''){
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getModelInfo(_this.componentId)["createSubscriberName"]);
+ }
+ if(DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=null && DataService.getModelInfo(_this.componentId)["serviceTypeName"]!=''){
+ addToList(FIELD.NAME.SERVICE_TYPE, DataService
+ .getModelInfo(_this.componentId)["serviceTypeName"]);
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+ }
+ addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.SERVICE_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.SERVICE_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
+ addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
+ if (DataService.getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE] != "null") {
+ addToList(FIELD.NAME.SERVICE_TYPE, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_TYPE]);
+ addToList(FIELD.NAME.SERVICE_ROLE, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.SERVICE_ROLE]);
+ }
+
+ break;
+ case COMPONENT.VF_MODULE:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ case COMPONENT.VNF:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_CUSTOMIZATION_NAME]);
+ addToList(FIELD.NAME.MODEL_VNF_TYPE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_TYPE]);
+ addToList(FIELD.NAME.MODEL_VNF_ROLE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_ROLE]);
+ addToList(FIELD.NAME.MODEL_VNF_FUNCTION, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_FUNCTION]);
+ addToList(FIELD.NAME.MODEL_VNF_CODE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_CODE]);
+ break;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VOLUME_GROUP:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ }
+
+ return _this.parameterList;
+ };
+
+ var getUserProvidedList = function() {
+ var parameterList = [];
+ var isUserProvidedNaming = false;
+ if ( (DataService.getModelInfo(_this.componentId).serviceEcompNaming != null)
+ && (DataService.getModelInfo(_this.componentId).serviceEcompNaming === "false") ) {
+ isUserProvidedNaming = true;
+ }
+
+ var isInTop = DataService.getHideServiceFields() || false;
+ if (_this.componentId === COMPONENT.SERVICE) {
+ if ( DataService.getALaCarte() ) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ if(!isInTop){
+ parameterList = parameterList.concat([ getSubscribersParameter(),
+ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+ else {
+ // macro
+
+ if(!isInTop){
+ if (isUserProvidedNaming) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
- var addArbitraryParameters = function(parameterList) {
- if ( DataService.getModelInfo(_this.componentId).displayInputs != null ) {
- var inputs = DataService.getModelInfo(_this.componentId).displayInputs;
- for ( var key in inputs) {
- var parameter = {
- id : key,
- type : PARAMETER.STRING,
- name : ComponentService.getFieldDisplayName(key),
- value : inputs[key][PARAMETER.DEFAULT],
- isRequired : inputs[key][PARAMETER.REQUIRED],
- description : inputs[key][PARAMETER.DESCRIPTION]
- };
- if ( DataService.getALaCarte() ) {
- parameter.name = ComponentService.getFieldDisplayName(inputs[key][PARAMETER.DISPLAY_NAME]);
- }
- switch (inputs[key][PARAMETER.TYPE]) {
- case PARAMETER.INTEGER:
- parameter.type = PARAMETER.NUMBER;
- break;
- case PARAMETER.BOOLEAN:
- parameter.type = PARAMETER.BOOLEAN;
- break;
- case PARAMETER.RANGE:
- break;
- case PARAMETER.LIST:
- parameter.type = PARAMETER.LIST;
- break;
- case PARAMETER.MAP:
- parameter.type = PARAMETER.MAP;
- break;
- }
-
- if ( UtilityService.hasContents(inputs[key][PARAMETER.CONSTRAINTS])
- && ( inputs[key][PARAMETER.CONSTRAINTS].length > 0 ) ) {
- var constraintsArray = inputs[key][PARAMETER.CONSTRAINTS];
- //console.log ("Calling addConstraintParameters for input name=" + key);
- addConstraintParameters (parameterList, constraintsArray, key, inputs, parameter);
- }
- else {
-
- parameterList.push(parameter);
- }
- }
- DataService.setArbitraryParameters (parameterList);
- }
- };
+ }
+ parameterList = parameterList.concat([ getSubscribersParameter() ]);
+ parameterList = parameterList.concat([ getServiceId(),
+ FIELD.PARAMETER.SERVICE_TYPE,
+ FIELD.PARAMETER.LCP_REGION,
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+ parameterList = parameterList.concat([ getAicZonesParameter() ]);
+
+
+ }else{
+ parameterList = parameterList.concat([ getServiceId(),
+ FIELD.PARAMETER.LCP_REGION,
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+
+ parameterList = parameterList.concat([ getProjectParameter() ]);
+ parameterList = parameterList.concat([ getOwningEntityParameter() ]);
+
+ }
+ else {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ parameterList = parameterList.concat([ getServiceId(),
+ getLcpRegionParameter(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ parameterList = parameterList.concat([ getLineOfBusinessParameter() ]);
+ parameterList = parameterList.concat([ getPlatformParameter() ]);
+
+ break;
+ case COMPONENT.VF_MODULE:
+ parameterList = parameterList.concat([
+ getLcpRegionParameter(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+
+ var availableVolumeGroupList = DataService.getAvailableVolumeGroupList();
+
+ if (availableVolumeGroupList && availableVolumeGroupList.length > 0) {
+ var availableVolumeGroupNames = [FIELD.STATUS.NONE];
+
+ for (var i = 0; i < availableVolumeGroupList.length; i++) {
+ availableVolumeGroupNames.push(availableVolumeGroupList[i].instance.name);
+ }
+
+ parameterList.push(addOptionList(
+ FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP,
+ availableVolumeGroupNames));
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ parameterList = parameterList.concat([ getLcpRegionParameter(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+ parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
+ if(_this.componentId === COMPONENT.VF_MODULE ){
+ parameterList.push({name: FIELD.NAME.SDN_C_PRELOAD,
+ id: FIELD.ID.SDN_C_PRELOAD,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false,
+ hideFieldAndLabel: true
+ }
+ );
+ parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false,
+ value:false
+ }
+ );
+
+ parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
+ type: "file",
+ isRequired: false,
+ isVisiblity: false
+ }
+ );
+ }
+
+ if( VIDCONFIGURATION.UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED && _this.componentId === COMPONENT.VOLUME_GROUP){
+ parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE,
+ type: "checkbox",
+ isEnabled: true,
+ isRequired: false
+ }
+ );
+
+ parameterList.push({name: FIELD.NAME.SUPPLEMENTORY_DATA_FILE,
+ id: FIELD.ID.SUPPLEMENTORY_DATA_FILE,
+ type: "file",
+ isRequired: false,
+ isVisiblity: false
+ }
+ );
+ }
+
+ addArbitraryParameters(parameterList);
+
+ return parameterList;
+ };
+
+ var addArbitraryParameters = function(parameterList) {
+ if ( DataService.getModelInfo(_this.componentId).displayInputs != null ) {
+ var inputs = DataService.getModelInfo(_this.componentId).displayInputs;
+ for ( var key in inputs) {
+ var parameter = {
+ id : key,
+ type : PARAMETER.STRING,
+ name : ComponentService.getFieldDisplayName(key),
+ value : inputs[key][PARAMETER.DEFAULT],
+ isRequired : inputs[key][PARAMETER.REQUIRED],
+ description : inputs[key][PARAMETER.DESCRIPTION]
+ };
+ if ( DataService.getALaCarte() ) {
+ parameter.name = ComponentService.getFieldDisplayName(inputs[key][PARAMETER.DISPLAY_NAME]);
+ }
+ switch (inputs[key][PARAMETER.TYPE]) {
+ case PARAMETER.INTEGER:
+ parameter.type = PARAMETER.NUMBER;
+ break;
+ case PARAMETER.BOOLEAN:
+ parameter.type = PARAMETER.BOOLEAN;
+ break;
+ case PARAMETER.RANGE:
+ break;
+ case PARAMETER.LIST:
+ parameter.type = PARAMETER.LIST;
+ break;
+ case PARAMETER.MAP:
+ parameter.type = PARAMETER.MAP;
+ break;
+ }
+
+ if ( UtilityService.hasContents(inputs[key][PARAMETER.CONSTRAINTS])
+ && ( inputs[key][PARAMETER.CONSTRAINTS].length > 0 ) ) {
+ var constraintsArray = inputs[key][PARAMETER.CONSTRAINTS];
+ //console.log ("Calling addConstraintParameters for input name=" + key);
+ addConstraintParameters (parameterList, constraintsArray, key, inputs, parameter);
+ }
+ else {
+
+ parameterList.push(parameter);
+ }
+ }
+ DataService.setArbitraryParameters (parameterList);
+ }
+ };
var addConstraintParameters = function(parameterList, constraintsArray, key, inputs, parameter) {
// If there are constraints and the operator is "valid_values",
@@ -485,614 +495,697 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON value : value
});
};
-
- /*
- * The "*Mso*" functions return URL and request details that can be passed
- * to the MSO controller. The request details defines the info passed as
- * part of the POST body.
- */
-
- var getMsoUrl = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- return "mso_create_nw_instance/"
- + DataService.getServiceInstanceId();
- case COMPONENT.SERVICE:
- return "mso_create_svc_instance";
- case COMPONENT.VNF:
- return "mso_create_vnf_instance/"
- + DataService.getServiceInstanceId();
- case COMPONENT.VF_MODULE:
- return "mso_create_vfmodule_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId();
- case COMPONENT.VOLUME_GROUP:
- return "mso_create_volumegroup_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId();
- }
- };
-
- var getMsoRequestDetails = function(parameterList) {
- console.log("getMsoRequestDetails invoked, parameterList="); console.log(JSON.stringify(parameterList,null,4));
- //console.log("getMsoRequestDetails invoked, DataService.getArbitraryParameters()=");
- //console.log(JSON.stringify(DataService.getArbitraryParameters(),null,4));
-
- var modelInfo = DataService.getModelInfo(_this.componentId);
- var requestorloggedInId = DataService.getLoggedInUserId();
- if (requestorloggedInId == null)
- requestorloggedInId = "";
- var isSupRollback = false;
- if (getValueFromList(FIELD.ID.SUPPRESS_ROLLBACK,parameterList) === "true") {
- isSupRollback = true;
- }
- var requestDetails = {
- requestInfo : {
- instanceName : getValueFromList(FIELD.ID.INSTANCE_NAME,
- parameterList),
- source : FIELD.ID.VID,
- suppressRollback : isSupRollback,
- requestorId: requestorloggedInId
- },
- modelInfo : {
- modelType : _this.componentId,
- modelInvariantId : modelInfo.modelInvariantId,
- modelVersionId : modelInfo.modelNameVersionId,
- modelName : modelInfo.modelName,
- modelVersion : modelInfo.modelVersion,
- modelCustomizationId: modelInfo.customizationUuid,
- modelCustomizationName : modelInfo.modelCustomizationName
- },
- requestParameters : {
- userParams : getArbitraryParameters(parameterList)
- }
- };
- if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
- // include cloud region for everything but service create alacarte
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
- }
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- requestDetails.subscriberInfo = {
- globalSubscriberId : DataService.getGlobalCustomerId(),
- subscriberName : DataService.getSubscriberName()
- };
- var isInTop = DataService.getHideServiceFields() || false;
- if(isInTop){
- requestDetails.requestParameters.subscriptionServiceType = DataService.getModelInfo(_this.componentId)["serviceTypeName"];
- }else{
- requestDetails.requestParameters.subscriptionServiceType = getValueFromList(
- FIELD.ID.SERVICE_TYPE, parameterList);
- }
- requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
- if ( !DataService.getALaCarte() ) {
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
- }
- var svcModelInfo = {
- modelType : _this.componentId,
- modelInvariantId : modelInfo.modelInvariantId,
- modelVersionId : modelInfo.modelNameVersionId,
- modelName : modelInfo.modelName,
- modelVersion : modelInfo.modelVersion
- };
- requestDetails.modelInfo = svcModelInfo;
- break;
- case COMPONENT.VNF:
-
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
- break;
- case COMPONENT.NETWORK:
- requestDetails.requestInfo.productFamilyId = getValueFromList(
- FIELD.ID.PRODUCT_FAMILY, parameterList);
-
- break;
- case COMPONENT.VF_MODULE:
- requestDetails.requestParameters.usePreload = getValueFromList(
- FIELD.ID.SDN_C_PRELOAD, parameterList);
- if(_this.componentId == COMPONENT.VF_MODULE &&(requestDetails.requestParameters.usePreload== null || requestDetails.requestParameters.usePreload === '')){
- requestDetails.requestParameters.usePreload = false;
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- break;
- }
-
- var relatedInstanceList = getRelatedInstanceList(parameterList);
-
- if (relatedInstanceList !== undefined) {
- requestDetails.relatedInstanceList = relatedInstanceList;
- }
-
- return requestDetails;
- };
-
- var getRelatedInstanceList = function(parameterList) {
- var relatedInstanceList = new Array();
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- return undefined;
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- break;
- case COMPONENT.VF_MODULE:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
- .getVnfInstanceId());
-
- var availableVolumeGroup = getValueFromList(
- FIELD.ID.AVAILABLE_VOLUME_GROUP, parameterList);
-
- if (UtilityService.hasContents(availableVolumeGroup) && availableVolumeGroup !== "None") {
- var availableVolumeGroups = DataService.getAvailableVolumeGroupList();
-
- for (var i = 0; i < availableVolumeGroups.length; i++) {
- if (availableVolumeGroups[i].instance.name == availableVolumeGroup) {
- DataService.setModelInfo(COMPONENT.VOLUME_GROUP, DataService.getModelInfo(COMPONENT.VF_MODULE));
- DataService.setVolumeGroupInstanceId(availableVolumeGroups[i].instance.object["volume-group-id"]);
- break;
- }
- }
-
- addRelatedInstance(relatedInstanceList, COMPONENT.VOLUME_GROUP,
- DataService.getVolumeGroupInstanceId());
- }
- break;
- case COMPONENT.VOLUME_GROUP:
- addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
- DataService.getServiceInstanceId());
- addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
- .getVnfInstanceId());
- break;
- }
-
- return relatedInstanceList;
- };
-
- var addRelatedInstance = function(relatedInstanceList, componentId,
- instanceId) {
- var modelInfo = DataService.getModelInfo(componentId);
- var relatedInstance;
- if (modelInfo !== undefined) {
- if (componentId === COMPONENT.SERVICE) {
- relatedInstance = {
- "instanceId" : instanceId,
- "modelInfo" : {
- "modelType" : componentId,
- "modelName" : modelInfo.modelName,
- "modelInvariantId" : modelInfo.modelInvariantId,
- "modelVersion" : modelInfo.modelVersion,
- "modelVersionId" : modelInfo.modelNameVersionId,
-
- }
- };
- }
- else {
- relatedInstance = {
- "instanceId" : instanceId,
- "modelInfo" : {
- "modelType" : componentId,
- "modelName" : modelInfo.modelName,
- "modelInvariantId" : modelInfo.modelInvariantId,
- "modelVersion" : modelInfo.modelVersion,
- "modelVersionId" : modelInfo.modelNameVersionId,
- "modelCustomizationId": modelInfo.customizationUuid,
- "modelCustomizationName": modelInfo.modelCustomizationName
- }
- }
- }
- relatedInstanceList.push({
- relatedInstance : relatedInstance
- });
- }
- };
-
- /*
- * var getArbitraryParameters = function(parameterList) { var
- * arbitraryParameters = new Object(); for (var i = 0; i <
- * parameterList.length; i++) { var parameter = parameterList[i]; switch
- * (parameter.id) { case FIELD.ID.INSTANCE_NAME: case
- * FIELD.ID.PRODUCT_FAMILY: case FIELD.ID.LCP_REGION: case
- * FIELD.ID.LCP_REGION_TEXT: case FIELD.ID.SERVICE_TYPE: case
- * FIELD.ID.TENANT: case FIELD.ID.SUPPRESS_ROLLBACK: break; default:
- * arbitraryParameters[parameter.id] = parameter.value; } } return
- * arbitraryParameters; }
- */
- var getArbitraryParameters = function(parameterList) {
- var arbitraryParameters = new Object();
- var arbitraryArray = new Array();
- for (var i = 0; i < parameterList.length; i++) {
- var parameter = parameterList[i];
- switch (parameter.id) {
- case FIELD.ID.AVAILABLE_VOLUME_GROUP:
- break;
- case FIELD.ID.INSTANCE_NAME:
- break;
- case FIELD.ID.PRODUCT_FAMILY:
- break;
- case FIELD.ID.LCP_REGION:
- break;
- case FIELD.ID.LCP_REGION_TEXT:
- break;
- case FIELD.ID.SERVICE_TYPE:
- break;
- case FIELD.ID.TENANT:
- break;
- case FIELD.ID.SUPPRESS_ROLLBACK:
- break;
- case FIELD.ID.SUBSCRIBER_NAME:
- break;
- case FIELD.ID.SDN_C_PRELOAD:
- break;
- case FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE:
- break;
- case FIELD.ID.SUPPLEMENTORY_DATA_FILE:
- arbitraryParameters = FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'];
- arbitraryArray=arbitraryParameters;
- FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value']=[];
- break;
-
- default:
- if (parameter.value != '') {
- arbitraryParameters = {
- name: parameter.id,
- value: parameter.value
- }
- arbitraryArray.push(arbitraryParameters);
- }
- }
- }
- return (arbitraryArray);
+ var setInventoryInfo = function(){
+ var inventoryItem = DataService.getInventoryItem();
+ var inventoryInfo = ComponentService.getInventoryInfo(
+ _this.componentId, inventoryItem);
}
- var getModel = function() {
- AsdcService.getModel(DataService.getModelId(), function(response) {
- DataService.setModelInfo(_this.componentId, {
- modelInvariantId : response.data.invariantUUID,
- modelNameVersionId : response.data.uuid,
- modelName : response.data.name,
- modelVersion : response.data.version,
- inputs : response.data.inputs
- });
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getSubscriptionServiceTypeList = function() {
- AaiService.getSubscriptionServiceTypeList(DataService
- .getGlobalCustomerId(), function(response) {
- DataService.setSubscriptionServiceTypeList(response);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getLoggedInUserID = function() {
- AaiService.getLoggedInUserID(function(response) {
- DataService.setLoggedInUserId(response.data);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getSubscribers = function() {
- AaiService.getSubscribers(function(response) {
- DataService.setSubscribers(response);
- UtilityService.startNextAsyncOperation();
- });
- };
- var getServices = function() {
- AaiService.getServices(function(response) {
- var serviceIdList = [];
- angular.forEach(response.data, function(value, key) {
- angular.forEach(value, function(subVal, key) {
- var newVal = {
- "id" : subVal[FIELD.ID.SERVICE_ID],
- "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION],
- "isPermitted" : subVal[FIELD.ID.IS_PERMITTED],
- };
- serviceIdList.push(newVal);
- DataService.setServiceIdList(serviceIdList);
- });
- });
-
- UtilityService.startNextAsyncOperation();
- });
- };
- var getAicZones = function() {
- AaiService.getAicZones(function(response) {
- var serviceIdList = [];
- angular.forEach(response.data, function(value, key) {
- angular.forEach(value, function(subVal, key) {
- var newVal = {
- "id" : subVal[FIELD.ID.ZONE_ID],
- "name" : subVal[FIELD.ID.ZONE_NAME],
- };
- serviceIdList.push(newVal);
- DataService.setAicZones(serviceIdList);
- });
- });
-
- UtilityService.startNextAsyncOperation();
- });
-
- };
-
-
-
- var getLcpCloudRegionTenantList = function() {
- AaiService.getLcpCloudRegionTenantList(DataService
- .getGlobalCustomerId(), DataService.getServiceType(), function(
- response) {
- DataService.setCloudRegionTenantList(response);
- UtilityService.startNextAsyncOperation();
- });
- };
+ /*
+ * The "*Mso*" functions return URL and request details that can be passed
+ * to the MSO controller. The request details defines the info passed as
+ * part of the POST body.
+ */
+
+ var getMsoUrl = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ return "mso_create_nw_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.SERVICE:
+ return "mso_create_svc_instance";
+ case COMPONENT.VNF:
+ return "mso_create_vnf_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.VF_MODULE:
+ return "mso_create_vfmodule_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ case COMPONENT.VOLUME_GROUP:
+ return "mso_create_volumegroup_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ }
+ };
+
+ var getMsoRequestDetails = function(parameterList) {
+ console.log("getMsoRequestDetails invoked, parameterList="); console.log(JSON.stringify(parameterList,null,4));
+ //console.log("getMsoRequestDetails invoked, DataService.getArbitraryParameters()=");
+ //console.log(JSON.stringify(DataService.getArbitraryParameters(),null,4));
+
+ var modelInfo = DataService.getModelInfo(_this.componentId);
+ var requestorloggedInId = DataService.getLoggedInUserId();
+ var owningEntityId = getValueFromList(FIELD.ID.OWNING_ENTITY, parameterList);
+ if (requestorloggedInId == null)
+ requestorloggedInId = "";
+ var isSupRollback = false;
+ if (getValueFromList(FIELD.ID.SUPPRESS_ROLLBACK,parameterList) === "true") {
+ isSupRollback = true;
+ }
+ var requestDetails = {
+ requestInfo : {
+ instanceName : getValueFromList(FIELD.ID.INSTANCE_NAME,
+ parameterList) || DataService.getVfModuleInstanceName(),
+ source : FIELD.ID.VID,
+ suppressRollback : isSupRollback,
+ requestorId: requestorloggedInId
+ },
+ modelInfo : {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion,
+ modelCustomizationId: modelInfo.customizationUuid,
+ modelCustomizationName : modelInfo.modelCustomizationName
+ },
+ requestParameters : {
+ userParams : getArbitraryParameters(parameterList)
+ }
+ };
+ if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
+ // include cloud region for everything but service create alacarte
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+ }
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ requestDetails.subscriberInfo = {
+ globalSubscriberId : DataService.getGlobalCustomerId(),
+ subscriberName : DataService.getSubscriberName()
+ };
+ var isInTop = DataService.getHideServiceFields() || false;
+ if(isInTop){
+ requestDetails.requestParameters.subscriptionServiceType = DataService.getModelInfo(_this.componentId)["serviceTypeName"];
+ }else{
+ requestDetails.requestParameters.subscriptionServiceType = getValueFromList(
+ FIELD.ID.SERVICE_TYPE, parameterList);
+ }
+ requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
+ if ( !DataService.getALaCarte() ) {
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ }
+ var svcModelInfo = {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion
+ };
+ requestDetails.modelInfo = svcModelInfo;
+
+ var selectedProject = getValueFromList(FIELD.ID.PROJECT, parameterList);
+
+ if (selectedProject) {
+ requestDetails.project = {
+ projectName: getValueFromList(FIELD.ID.PROJECT, parameterList)
+ };
+ }
+
+ requestDetails.owningEntity = {
+ owningEntityId: owningEntityId,
+ owningEntityName: getOwningEntityNameById(owningEntityId)
+ };
+
+ break;
+ case COMPONENT.VNF:
+
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+
+ var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
+
+ if(lineOfBusiness) {
+ var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
+
+ requestDetails.lineOfBusiness = {
+ lineOfBusinessName: lineOfBusinessNamesString
+ }
+ }
- var internalGetParametersHandler = function() {
- if (angular.isFunction(_this.getParametersHandler)) {
- _this.getParametersHandler({
- summaryList : getSummaryList(),
- userProvidedList : getUserProvidedList()
- });
- }
- };
+ requestDetails.platform = {
+ platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
+ };
- var getSubscribersParameter = function() {
- var subscribers = DataService.getSubscribers();
- var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
- if ( UtilityService.hasContents(subscribers)) {
- parameter.optionList = [];
-
- for (var i = 0; i < subscribers.length; i++) {
- parameter.optionList.push({
- id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
- name : subscribers[i][FIELD.ID.SUBNAME],
- isPermitted : subscribers[i][FIELD.ID.IS_PERMITTED]
- })
- }
- }
- return parameter;
- };
+ break;
+ case COMPONENT.NETWORK:
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ var lineOfBusiness = getValueFromList(FIELD.ID.LINE_OF_BUSINESS, parameterList);
- var getServiceId = function() {
- var serviceIdList = DataService.getServiceIdList();
- //var serviceTypeList = DataService.getSubscriptionServiceTypeList();
- var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
- parameter.optionList = new Array();
- if ( UtilityService.hasContents(serviceIdList) ) {
- // load them all
- for (var i = 0; i < serviceIdList.length; i++) {
- parameter.optionList.push({
- id : serviceIdList[i].id,
- name : serviceIdList[i].description,
- isPermitted : serviceIdList[i].isPermitted
- });
- }
- }
-
- return parameter;
- };
-
- var getAICZones = function() {
- var aicList = DataService.getAicZones();
- var parameter = FIELD.PARAMETER.AIC_ZONES;
- parameter.optionList = new Array();
- if ( UtilityService.hasContents(aicList) ) {
- // load them all
- for (var i = 0; i < aicList.length; i++) {
- parameter.optionList.push({
- id : aicList[i].id,
- name : aicList[i].name,
- isPermitted : true
-
- });
- }
- }
-
- return parameter;
- };
+ if(lineOfBusiness) {
+ var lineOfBusinessNamesString = _.map(lineOfBusiness, "name").join(", ");
+ requestDetails.lineOfBusiness = {
+ lineOfBusinessName: lineOfBusinessNamesString
+ }
+ }
+
+ requestDetails.platform = {
+ platformName: getValueFromList(FIELD.ID.PLATFORM, parameterList)
+ };
+ break;
+ case COMPONENT.VF_MODULE:
+ requestDetails.requestParameters.usePreload = getValueFromList(
+ FIELD.ID.SDN_C_PRELOAD, parameterList);
+ if(_this.componentId == COMPONENT.VF_MODULE &&(requestDetails.requestParameters.usePreload== null || requestDetails.requestParameters.usePreload === '')){
+ requestDetails.requestParameters.usePreload = false;
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ break;
+ }
+
+ var relatedInstanceList = getRelatedInstanceList(parameterList);
+
+ if (relatedInstanceList !== undefined) {
+ requestDetails.relatedInstanceList = relatedInstanceList;
+ }
+
+ return requestDetails;
+ };
+
+ var getRelatedInstanceList = function(parameterList) {
+ var relatedInstanceList = new Array();
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return undefined;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ break;
+ case COMPONENT.VF_MODULE:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+
+ var availableVolumeGroup = getValueFromList(
+ FIELD.ID.AVAILABLE_VOLUME_GROUP, parameterList);
+
+ if (UtilityService.hasContents(availableVolumeGroup) && availableVolumeGroup !== "None") {
+ var availableVolumeGroups = DataService.getAvailableVolumeGroupList();
+
+ for (var i = 0; i < availableVolumeGroups.length; i++) {
+ if (availableVolumeGroups[i].instance.name == availableVolumeGroup) {
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, DataService.getModelInfo(COMPONENT.VF_MODULE));
+ DataService.setVolumeGroupInstanceId(availableVolumeGroups[i].instance.object["volume-group-id"]);
+ break;
+ }
+ }
- var getLcpRegion = function() {
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- console.log ( "cloudRegionTenantList=");
- console.log ( JSON.stringify (cloudRegionTenantList, null, 4 ));
+ addRelatedInstance(relatedInstanceList, COMPONENT.VOLUME_GROUP,
+ DataService.getVolumeGroupInstanceId());
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+ break;
+ }
+
+ return relatedInstanceList;
+ };
+
+ var addRelatedInstance = function(relatedInstanceList, componentId,
+ instanceId) {
+ var modelInfo = DataService.getModelInfo(componentId);
+ var relatedInstance;
+ if (modelInfo !== undefined) {
+ if (componentId === COMPONENT.SERVICE) {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
- var parameter = FIELD.PARAMETER.LCP_REGION;
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- for (var j = 0; j < parameter.optionList.length; j++) {
- if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
+ }
+ };
+ }
+ else {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
+ "modelCustomizationId": modelInfo.customizationUuid,
+ "modelCustomizationName": modelInfo.modelCustomizationName
+ }
+ }
+ }
+ relatedInstanceList.push({
+ relatedInstance : relatedInstance
+ });
+ }
+ };
+
+ /*
+ * var getArbitraryParameters = function(parameterList) { var
+ * arbitraryParameters = new Object(); for (var i = 0; i <
+ * parameterList.length; i++) { var parameter = parameterList[i]; switch
+ * (parameter.id) { case FIELD.ID.INSTANCE_NAME: case
+ * FIELD.ID.PRODUCT_FAMILY: case FIELD.ID.LCP_REGION: case
+ * FIELD.ID.LCP_REGION_TEXT: case FIELD.ID.SERVICE_TYPE: case
+ * FIELD.ID.TENANT: case FIELD.ID.SUPPRESS_ROLLBACK: break; default:
+ * arbitraryParameters[parameter.id] = parameter.value; } } return
+ * arbitraryParameters; }
+ */
+ var getArbitraryParameters = function(parameterList) {
+ var arbitraryParameters = new Object();
+ var arbitraryArray = new Array();
+ for (var i = 0; i < parameterList.length; i++) {
+ var parameter = parameterList[i];
+ switch (parameter.id) {
+ case FIELD.ID.AVAILABLE_VOLUME_GROUP:
+ case FIELD.ID.INSTANCE_NAME:
+ case FIELD.ID.PRODUCT_FAMILY:
+ case FIELD.ID.LCP_REGION:
+ case FIELD.ID.LCP_REGION_TEXT:
+ case FIELD.ID.SERVICE_TYPE:
+ case FIELD.ID.TENANT:
+ case FIELD.ID.SUPPRESS_ROLLBACK:
+ case FIELD.ID.SUBSCRIBER_NAME:
+ case FIELD.ID.SDN_C_PRELOAD:
+ case FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE:
+ case FIELD.ID.OWNING_ENTITY:
+ case FIELD.ID.PLATFORM:
+ case FIELD.ID.LINE_OF_BUSINESS:
+ case FIELD.ID.PROJECT:
+ break;
+ case FIELD.ID.SUPPLEMENTORY_DATA_FILE:
+ arbitraryParameters = FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value'];
+ arbitraryArray=arbitraryParameters;
+ FIELD.PARAMETER.SUPPLEMENTORY_DATA_FILE['value']=[];
+ break;
+
+ default:
+ if (parameter.value != '') {
+ arbitraryParameters = {
+ name: parameter.id,
+ value: parameter.value
+ }
+ arbitraryArray.push(arbitraryParameters);
+ }
+ }
+ }
+ return (arbitraryArray);
+ }
+
+ var getModel = function() {
+ AsdcService.getModel(DataService.getModelId(), function(response) {
+ DataService.setModelInfo(_this.componentId, {
+ modelInvariantId : response.data.invariantUUID,
+ modelNameVersionId : response.data.uuid,
+ modelName : response.data.name,
+ modelVersion : response.data.version,
+ inputs : response.data.inputs
+ });
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscriptionServiceTypeList = function() {
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getLoggedInUserID = function() {
+ AaiService.getLoggedInUserID(function(response) {
+ DataService.setLoggedInUserId(response.data);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscribers = function() {
+ AaiService.getSubscribers(function(response) {
+ DataService.setSubscribers(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getServices = function() {
+ AaiService.getServices(function(response) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = {
+ "id" : subVal[FIELD.ID.SERVICE_ID],
+ "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION],
+ "isPermitted" : subVal[FIELD.ID.IS_PERMITTED],
+ };
+ serviceIdList.push(newVal);
+ DataService.setServiceIdList(serviceIdList);
+ });
+ });
+
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getAicZones = function() {
+ AaiService.getAicZones(function(response) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = {
+ "id" : subVal[FIELD.ID.ZONE_ID],
+ "name" : subVal[FIELD.ID.ZONE_NAME],
+ };
+ serviceIdList.push(newVal);
+ DataService.setAicZones(serviceIdList);
+ });
+ });
+
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getOwningEntityProperties = function() {
+ OwningEntityService.getOwningEntityProperties(function(owningEntityProperties) {
+ DataService.setOwningEntityProperties(owningEntityProperties);
+ UtilityService.startNextAsyncOperation();
+ });
+
+ };
+
+ var getLcpCloudRegionTenantList = function() {
+ AaiService.getLcpCloudRegionTenantList(DataService
+ .getGlobalCustomerId(), DataService.getServiceType(), function(
+ response) {
+ DataService.setCloudRegionTenantList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var internalGetParametersHandler = function() {
+ if (angular.isFunction(_this.getParametersHandler)) {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ });
+ }
+ };
+
+ var getSubscribersParameter = function() {
+ var subscribers = DataService.getSubscribers();
+ var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
+ if ( UtilityService.hasContents(subscribers)) {
+ parameter.optionList = [];
+
+ for (var i = 0; i < subscribers.length; i++) {
+ parameter.optionList.push({
+ id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
+ name : subscribers[i][FIELD.ID.SUBNAME],
+ isPermitted : subscribers[i][FIELD.ID.IS_PERMITTED]
+ })
+ }
+ }
+ return parameter;
+ };
+
+ var getServiceId = function() {
+ var serviceIdList = DataService.getServiceIdList();
+ //var serviceTypeList = DataService.getSubscriptionServiceTypeList();
+ var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
+ parameter.optionList = new Array();
+ if ( UtilityService.hasContents(serviceIdList) ) {
+ // load them all
+ for (var i = 0; i < serviceIdList.length; i++) {
+ parameter.optionList.push({
+ id : serviceIdList[i].id,
+ name : serviceIdList[i].description,
+ isPermitted : serviceIdList[i].isPermitted
+ });
+ }
+ }
+
+ return parameter;
+ };
+
+ var getAicZonesParameter = function() {
+ var aicList = DataService.getAicZones();
+ var parameter = FIELD.PARAMETER.AIC_ZONES;
+ parameter.optionList = new Array();
+ if ( UtilityService.hasContents(aicList) ) {
+ // load them all
+ for (var i = 0; i < aicList.length; i++) {
+ parameter.optionList.push({
+ id : aicList[i].id,
+ name : aicList[i].name,
+ isPermitted : true
+
+ });
+ }
+ }
+
+ return parameter;
+ };
+
+ var getProjectParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PROJECT);
+ };
+
+ var getOwningEntityParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.OWNING_ENTITY);
+ };
+
+ var getLineOfBusinessParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.LINE_OF_BUSINESS);
+ };
+
+ var getPlatformParameter = function() {
+ return getOwningEntityParameterWithOptions(FIELD.PARAMETER.PLATFORM);
+ };
+
+ var getOwningEntityNameById = function (id) {
+ var properties = DataService.getOwningEntityProperties();
+ var parameter = _.find(properties[FIELD.ID.OWNING_ENTITY], {"id": id});
+ return parameter && parameter.name;
+ };
+
+ var getOwningEntityParameterWithOptions = function(parameter) {
+ var properties = DataService.getOwningEntityProperties();
+ if (properties && properties[parameter.id]) {
+ parameter.optionList = _.map(properties[parameter.id], function(parameter) {
+ return {
+ "id" : parameter.id,
+ "name" : parameter.name,
+ "isPermitted": true
+ };
+ });
+ }
+
+ return parameter;
+ };
+
+ var getLcpRegionParameter = function() {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ console.log ( "cloudRegionTenantList=");
+ console.log ( JSON.stringify (cloudRegionTenantList, null, 4 ));
+
+ var parameter = FIELD.PARAMETER.LCP_REGION;
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ for (var j = 0; j < parameter.optionList.length; j++) {
+ if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
parameter.optionList[j].isPermitted =
- parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted;
+ parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted;
break;
}
- }
- if (j < parameter.optionList.length) {
- continue;
- }
- parameter.optionList.push({
- id : cloudRegionTenantList[i].cloudRegionId,
- isPermitted : cloudRegionTenantList[i].isPermitted
- });
- }
- }
- return parameter;
- };
-
- var getTenantList = function(cloudRegionId) {
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- var parameter = "";
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- parameter = FIELD.PARAMETER.TENANT_ENABLED;
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
- parameter.optionList.push({
- id : cloudRegionTenantList[i].tenantId,
- name : cloudRegionTenantList[i].tenantName,
+ }
+ if (j < parameter.optionList.length) {
+ continue;
+ }
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].cloudRegionId,
+ isPermitted : cloudRegionTenantList[i].isPermitted
+ });
+ }
+ }
+ return parameter;
+ };
+
+ var getTenantList = function(cloudRegionId) {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ var parameter = "";
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter = FIELD.PARAMETER.TENANT_ENABLED;
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].tenantId,
+ name : cloudRegionTenantList[i].tenantName,
isPermitted : cloudRegionTenantList[i].isPermitted
});
- }
- }
- }
- return parameter;
-
- };
-
- var addOptionList = function(parameter, optionSimpleArray) {
- var optionList = new Array();
- if (!angular.isArray(optionSimpleArray)) {
- return optionList;
- }
- for (var i = 0; i < optionSimpleArray.length; i++) {
- optionList.push({
- name : optionSimpleArray[i],
+ }
+ }
+ }
+ return parameter;
+
+ };
+
+ var addOptionList = function(parameter, optionSimpleArray) {
+ var optionList = new Array();
+ if (!angular.isArray(optionSimpleArray)) {
+ return optionList;
+ }
+ for (var i = 0; i < optionSimpleArray.length; i++) {
+ optionList.push({
+ name : optionSimpleArray[i],
isPermitted :true,
- });
- }
- parameter.optionList = optionList;
- return parameter;
- };
-
- var getValueFromList = function(id, parameterList) {
- for (var i = 0; i < parameterList.length; i++) {
- if (parameterList[i].id === id) {
- return parameterList[i].value;
- }
- }
- };
- var updateUserParameterList = function(updatedId, parameterListControl) {
- console.log ("updateUserParameterList() updatedId=" + updatedId);
- if (updatedId === FIELD.ID.PRODUCT_FAMILY && DataService.getHideServiceFields()) {
- var cloudRegionTenantList = new Array();
- AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
- DataService.setCloudRegionTenantList(cloudRegionTenantList);
- parameterListControl.updateList([ getLcpRegion() ]);
- });
- }else if (updatedId === FIELD.ID.SDN_C_PRELOAD) {
- var list = parameterListControl.getList(updatedId);
- if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
- FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED.value=true;
- parameterListControl
- .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED ]);
- }else{
- parameterListControl
- .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_UNCHECKED ]);
- }
- }else if (updatedId === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE) {
- if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
- $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').show();
- FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=true;
- parameterListControl
- .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED ]);
- }else{
- $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').hide();
- FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=false;
- parameterListControl
- .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_UNCHECKED ]);
- }
- } else if (updatedId === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
- var filePath = $('input[parameter-id="'+updatedId+'"]').val();
- var arr =filePath.split('.');
- var fileExt = arr[arr.length-1];
- if(fileExt!='' && fileExt.toLowerCase()!='json'){
- $('input[parameter-id="'+updatedId+'"]').val('');
- alert("Invalid file format. Please select *.json format file.");
- return false;
- }
- } else if (updatedId === FIELD.ID.LCP_REGION) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- parameterListControl
- .updateList([ getTenantList(list[0].value) ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
- }
- } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- DataService.setGlobalCustomerId(list[0].value);
-
- AaiService.getSubscriptionServiceTypeList(DataService
- .getGlobalCustomerId(), function(response) {
- DataService.setSubscriptionServiceTypeList(response);
- var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
- serviceTypeParameters.optionList = [];
-
- for (var i = 0; i < response.length; i++) {
- serviceTypeParameters.optionList.push({
- "id" : response[i].name,
- "name" : response[i].name,
+ });
+ }
+ parameter.optionList = optionList;
+ return parameter;
+ };
+
+ var getValueFromList = function(id, parameterList) {
+ for (var i = 0; i < parameterList.length; i++) {
+ if (parameterList[i].id === id) {
+ return parameterList[i].value;
+ }
+ }
+ };
+ var updateUserParameterList = function(updatedId, parameterListControl) {
+ console.log ("updateUserParameterList() updatedId=" + updatedId);
+ if (updatedId === FIELD.ID.PRODUCT_FAMILY && DataService.getHideServiceFields()) {
+ var cloudRegionTenantList = new Array();
+ AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
+ DataService.setCloudRegionTenantList(cloudRegionTenantList);
+ parameterListControl.updateList([ getLcpRegionParameter() ]);
+ });
+ }else if (updatedId === FIELD.ID.SDN_C_PRELOAD) {
+ var list = parameterListControl.getList(updatedId);
+ if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
+ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED.value=true;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_CHECKED ]);
+ }else{
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SDN_C_PRELOAD_UNCHECKED ]);
+ }
+ }else if (updatedId === FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE) {
+ if($('input[parameter-id="'+updatedId+'"]').is(':checked')){
+ $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').show();
+ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=true;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED ]);
+ }else{
+ $('input[parameter-id="'+FIELD.ID.SUPPLEMENTORY_DATA_FILE+'"]').closest('tr').hide();
+ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_CHECKED.value=false;
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.UPLOAD_SUPPLEMENTORY_DATA_FILE_UNCHECKED ]);
+ }
+ } else if (updatedId === FIELD.ID.SUPPLEMENTORY_DATA_FILE) {
+ var filePath = $('input[parameter-id="'+updatedId+'"]').val();
+ var arr =filePath.split('.');
+ var fileExt = arr[arr.length-1];
+ if(fileExt!='' && fileExt.toLowerCase()!='json'){
+ $('input[parameter-id="'+updatedId+'"]').val('');
+ alert("Invalid file format. Please select *.json format file.");
+ return false;
+ }
+ } else if (updatedId === FIELD.ID.LCP_REGION) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ parameterListControl
+ .updateList([ getTenantList(list[0].value) ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
+ }
+ } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ DataService.setGlobalCustomerId(list[0].value);
+
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
+ serviceTypeParameters.optionList = [];
+
+ for (var i = 0; i < response.length; i++) {
+ serviceTypeParameters.optionList.push({
+ "id" : response[i].name,
+ "name" : response[i].name,
"isPermitted" :response[i].isPermitted
});
- }
- console.log ( "updateUserParameterList: service type parameters " );
- console.log ( JSON.stringify (serviceTypeParameters, null, 4));
- parameterListControl.updateList([ serviceTypeParameters ]);
- });
-
- }
- } else if ( updatedId === FIELD.ID.SERVICE_TYPE ) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
-
- DataService.setServiceType(list[0].value);
- var cloudRegionTenantList = new Array();
- AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
- DataService.setCloudRegionTenantList(cloudRegionTenantList);
- parameterListControl.updateList([ getLcpRegion() ]);
- });
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
- }
- }
-
- };
-
- return {
- initializeComponent : function(componentId) {
- _this.componentId = ComponentService.initialize(componentId);
- },
- setHttpErrorHandler : function(httpErrorHandler) {
- _this.httpErrorHandler = httpErrorHandler;
- },
- getComponentDisplayName : ComponentService.getComponentDisplayName,
- getParameters : function(getParametersHandler) {
- _this.getParametersHandler = getParametersHandler;
- UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
- UtilityService.startAsyncOperations(getAsyncOperationList(),
- internalGetParametersHandler);
- },
- updateUserParameterList : updateUserParameterList,
- getMsoRequestDetails : getMsoRequestDetails,
- getMsoUrl : getMsoUrl
- }
+ }
+ console.log ( "updateUserParameterList: service type parameters " );
+ console.log ( JSON.stringify (serviceTypeParameters, null, 4));
+ parameterListControl.updateList([ serviceTypeParameters ]);
+ });
+
+ }
+ } else if ( updatedId === FIELD.ID.SERVICE_TYPE ) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+
+ DataService.setServiceType(list[0].value);
+ var cloudRegionTenantList = new Array();
+ AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
+ DataService.setCloudRegionTenantList(cloudRegionTenantList);
+ parameterListControl.updateList([ getLcpRegionParameter() ]);
+ });
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getParameters : function(getParametersHandler) {
+ _this.getParametersHandler = getParametersHandler;
+ UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
+ UtilityService.startAsyncOperations(getAsyncOperationList(),
+ internalGetParametersHandler);
+ },
+ updateUserParameterList : updateUserParameterList,
+ getMsoRequestDetails : getMsoRequestDetails,
+ getMsoUrl : getMsoUrl,
+ setInventoryInfo: setInventoryInfo
+ }
}
appDS2.factory("CreationService", [ "$log", "AaiService", "AsdcService",
- "DataService","VIDCONFIGURATION", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
- "UtilityService", CreationService ]);
+ "DataService","VIDCONFIGURATION", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
+ "UtilityService", "OwningEntityService", CreationService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js index 2d7fa6ca7..716854edb 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js @@ -100,6 +100,12 @@ var DataService = function($log, DataService) { getAicZones : function(){
return _this.aicZones;
},
+ setAicZoneForPNF: function(aicZone) {
+ _this.aicZone = aicZone;
+ },
+ getAicZoneForPNF : function(){
+ return _this.aicZone;
+ },
getServiceInstanceId : function() {
return _this.serviceInstanceId;
},
@@ -214,6 +220,12 @@ var DataService = function($log, DataService) { setVnfInstanceId : function(vnfInstanceId) {
_this.vnfInstanceId = vnfInstanceId;
},
+ getVfModuleInstanceName : function() {
+ return _this.vfModuleInstanceName;
+ },
+ setVfModuleInstanceName : function(vfModuleInstanceName) {
+ _this.vfModuleInstanceName = vfModuleInstanceName;
+ },
getVolumeGroupInstanceId : function() {
return _this.volumeGroupInstanceId;
},
@@ -293,8 +305,81 @@ var DataService = function($log, DataService) { },
getHideServiceFields:function(){
return _this.hideServiceFields;
- }
+ },
+ getServiceProxies:function(){
+ return _this.serviceProxies;
+ },
+ setServiceProxies:function(serviceProxies){
+ _this.serviceProxies = serviceProxies;
+ },
+ getSourceServiceProxies:function(){
+ return _this.sourceServiceProxies;
+ },
+ setSourceServiceProxies:function(sourceServiceProxies){
+ _this.sourceServiceProxies = sourceServiceProxies;
+ },
+ getCollectorServiceProxies:function(){
+ return _this.collectorServiceProxies;
+ },
+ setCollectorServiceProxies:function(collectorServiceProxies){
+ _this.collectorServiceProxies = collectorServiceProxies;
+ },
+ getConfigurationByPolicy:function() {
+ return _this.configurationByPolicy;
+ },
+ setConfigurationByPolicy:function (configurationByPolicy) {
+ _this.configurationByPolicy = configurationByPolicy;
+ },
+ getSuppressRollback:function(){
+ return _this.suppressRollback;
+ },
+ setSuppressRollback:function(suppressRollback){
+ _this.suppressRollback = suppressRollback;
+ },
+ getPortMirroningConfigFields:function(){
+ return _this.portMirroningConfigFields;
+ },
+ setPortMirroningConfigFields:function(portMirroningConfigFields){
+ _this.portMirroningConfigFields = portMirroningConfigFields;
+ },
+ getConfigurationInstanceId : function() {
+ return _this.configurationInstanceId;
+ },
+ setConfigurationInstanceId : function(configurationInstanceId) {
+ _this.configurationInstanceId = configurationInstanceId;
+ },
+ getConfigurationStatus: function () {
+ return _this.configurationStatus;
+ },
+ setConfigurationStatus: function (configurationStatus) {
+ _this.configurationStatus = configurationStatus;
+ },
+ getPortStatus: function () {
+ return _this.portStatus;
+ },
+ setPortStatus: function (portStatus) {
+ _this.portStatus = portStatus;
+ },
+ getPortId: function () {
+ return _this.portId;
+ },
+ setPortId: function (portId) {
+ _this.portId = portId;
+ },
+ getPnf: function () {
+ return _this.pnf;
+ },
+ setPnf: function (pnf) {
+ _this.pnf = pnf;
+ },
+ getOwningEntityProperties: function () {
+ return _this.owningEntityProperties;
+ },
+ setOwningEntityProperties: function (properties) {
+ _this.owningEntityProperties = properties;
+ }
+
}
-}
+};
appDS2.factory("DataService", [ "$log", DataService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js index 79282997b..90daf3550 100755..100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js @@ -1,508 +1,518 @@ -/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 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 DeletionService = function($log, AaiService, AsdcService, DataService,
- ComponentService, COMPONENT, FIELD, UtilityService) {
-
- var _this = this;
-
- var getAsyncOperationList = function() {
- if (DataService.getLoggedInUserId() == null)
- getLoggedInUserID();
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- return [ getSubscribers, getLcpCloudRegionTenantList ];
- case COMPONENT.NETWORK:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VNF:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VF_MODULE:
- return [ getLcpCloudRegionTenantList ];
- case COMPONENT.VOLUME_GROUP:
- return [ getLcpCloudRegionTenantList ];
- }
- };
-
- var getLcpCloudRegionTenantList = function() {
- //console.log ( "global customer id: " );
- //console.log ( JSON.stringify (DataService.getGlobalCustomerId()) );
-
- //console.log ( "service type: " );
- //console.log ( JSON.stringify (DataService.getServiceType()) );
-
- AaiService.getLcpCloudRegionTenantList(DataService
- .getGlobalCustomerId(), DataService.getServiceType(), function(
- response) {
- DataService.setCloudRegionTenantList(response);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getLoggedInUserID = function() {
- AaiService.getLoggedInUserID(function(response) {
- DataService.setLoggedInUserId(response.data);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var getSubscribers = function() {
- AaiService.getSubscribers(function(response) {
- DataService.setSubscribers(response);
- UtilityService.startNextAsyncOperation();
- });
- };
-
- var internalGetParametersHandler = function() {
- if (angular.isFunction(_this.getParametersHandler)) {
- if (_this.componentId == COMPONENT.SERVICE) {
- if ( DataService.getALaCarte() ) {
- _this.getParametersHandler({
- summaryList : getSummaryList(),
- userProvidedList : getUserProvidedList()
- }, true);
- }
- else {
- _this.getParametersHandler({
- summaryList : getSummaryList(),
- userProvidedList : getUserProvidedList()
- }, false);
- }
- }
- else {
- _this.getParametersHandler({
- summaryList : getSummaryList(),
- userProvidedList : getUserProvidedList()
- }, false);
- }
- }
- };
-
- var getSubscribersParameter = function() {
- var subscribers = DataService.getSubscribers();
- var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
- parameter.optionList = [];
-
- for (var i = 0; i < subscribers.length; i++) {
- parameter.optionList.push({
- id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
- name : subscribers[i][FIELD.ID.SUBNAME]
- })
- }
- return parameter;
- };
-
- var getServiceId = function() {
- var serviceIdList = DataService.getServiceIdList();
- var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
- parameter.optionList = new Array();
- for (var i = 0; i < serviceIdList.length; i++) {
- parameter.optionList.push({
- id : serviceIdList[i].id,
- name : serviceIdList[i].description
- });
- }
- return parameter;
- };
-
- var getUserProvidedList = function() {
-
- //var parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
-
- var parameterList = [];
-
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- if ( DataService.getALaCarte() ) {
- parameterList = [];
- }
- else {
- parameterList = parameterList.concat ([getLcpRegion(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- break;
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- parameterList = parameterList.concat([ //getServiceId(),
- getLcpRegion(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- break;
- case COMPONENT.VF_MODULE:
- parameterList = parameterList.concat([
- getLcpRegion(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED
- ]);
-
- break;
- case COMPONENT.VOLUME_GROUP:
- parameterList = parameterList.concat([ getLcpRegion(),
- FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
- FIELD.PARAMETER.TENANT_DISABLED ]);
- }
-
- //parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
-
- //addArbitraryParameters(parameterList);
-
- return parameterList;
- };
- var getSummaryList = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- case COMPONENT.SERVICE:
- case COMPONENT.VNF:
- case COMPONENT.VF_MODULE:
- case COMPONENT.VOLUME_GROUP:
- var summaryList = [ {
- name : FIELD.NAME.SUBSCRIBER_NAME,
- value : DataService.getSubscriberName()
- }, {
- name : FIELD.NAME.CUSTOMER_ID,
- value : DataService.getGlobalCustomerId()
- }, {
- name : FIELD.NAME.SERVICE_UUID,
- value : DataService.getServiceUuid()
- }, {
- name : FIELD.NAME.SERVICE_NAME,
- value : DataService.getServiceName()
- /* }, {
- name : FIELD.NAME.USER_SERVICE_INSTANCE_NAME,
- value : DataService.getUserServiceInstanceName()*/
- } ];
-
- _this.parameterList = new Array();
-
- addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
-
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.SERVICE_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.SERVICE_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
- addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
- break;
- case COMPONENT.VF_MODULE:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- break;
- case COMPONENT.NETWORK:
- case COMPONENT.VNF:
- case COMPONENT.VOLUME_GROUP:
- addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
- .getSubscriberName());
- addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
- .getServiceInstanceName());
- addToList(FIELD.NAME.MODEL_NAME, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
- addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
- addToList(FIELD.NAME.MODEL_VERSION, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
- addToList(FIELD.NAME.MODEL_UUID, DataService
- .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
- break;
- }
-
- /*var additionalList = ComponentService.getInventoryParameterList(
- _this.componentId, DataService.getInventoryItem());*/
- var additionalList = ComponentService.getDisplayNames(ComponentService
- .getInventoryParameterList(_this.componentId, DataService
- .getInventoryItem(), true ));
-
- return summaryList.concat(ComponentService
- .getDisplayNames(additionalList));
- }
- };
-
- var getMsoUrl = function() {
- switch (_this.componentId) {
- case COMPONENT.NETWORK:
- return "mso_delete_nw_instance/"
- + DataService.getServiceInstanceId() + "/networks/"
- + DataService.getNetworkInstanceId();
- case COMPONENT.SERVICE:
- return "mso_delete_svc_instance/"
- + DataService.getServiceInstanceId();
- case COMPONENT.VNF:
- return "mso_delete_vnf_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId();
- case COMPONENT.VF_MODULE:
- return "mso_delete_vfmodule_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId() + "/vfModules/"
- + DataService.getVfModuleInstanceId();
- case COMPONENT.VOLUME_GROUP:
- return "mso_delete_volumegroup_instance/"
- + DataService.getServiceInstanceId() + "/vnfs/"
- + DataService.getVnfInstanceId() + "/volumeGroups/"
- + DataService.getVolumeGroupInstanceId();
- }
- }
-
- var addToList = function(name, value) {
- _this.parameterList.push({
- name : name,
- value : value
- });
- };
-
- var getMsoRequestDetails = function(parameterList) {
- console.log("getMsoRequestDetails invoked");
- var inventoryInfo = ComponentService.getInventoryInfo(
- _this.componentId, DataService.getInventoryItem());
- var modelInfo = DataService.getModelInfo(_this.componentId);
- var requestorloggedInId = DataService.getLoggedInUserId();
- if (requestorloggedInId == null)
- requestorloggedInId = "";
- var requestDetails = {
- modelInfo : {
- modelType : _this.componentId,
- modelInvariantId : modelInfo.modelInvariantId,
- modelVersionId : modelInfo.modelNameVersionId,
- modelName : modelInfo.modelName,
- modelCustomizationName : modelInfo.modelCustomizationName,
- modelCustomizationId : modelInfo.customizationUuid,
- modelVersion : modelInfo.modelVersion
- },
- requestInfo : {
- source : FIELD.ID.VID,
- requestorId: requestorloggedInId
- }
- };
-
- switch (_this.componentId) {
- case COMPONENT.SERVICE:
- requestDetails.requestParameters = {
- aLaCarte : DataService.getALaCarte()
- };
- if ( !(DataService.getALaCarte()) ) {
- // for macro delete include cloud config.
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
- }
- break;
- case COMPONENT.VNF:
- console.log("getMsoRequestDetails COMPONENT.VNF");
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
-
- break;
- case COMPONENT.VF_MODULE:
- case COMPONENT.NETWORK:
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
- break;
- case COMPONENT.VOLUME_GROUP:
- var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
- if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
- lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
- parameterList);
- }
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : lcpRegion,
- tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
- };
-
- break;
- default:
- requestDetails.cloudConfiguration = {
- lcpCloudRegionId : DataService.getLcpRegion(),
- tenantId : DataService.getTenant()
- };
- }
- return requestDetails;
- }
-
- var getLcpRegion = function() {
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- var parameter = "";
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- parameter = FIELD.PARAMETER.LCP_REGION;
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- for (var j = 0; j < parameter.optionList.length; j++) {
- if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
- parameter.optionList[j].isPermitted =
- parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted;
- break;
- }
- }
- if (j < parameter.optionList.length) {
- continue;
- }
- parameter.optionList.push({
- id : cloudRegionTenantList[i].cloudRegionId,
- isPermitted : cloudRegionTenantList[i].isPermitted
-
- });
- }
- }
- return parameter;
- };
-
- var getTenantList = function(cloudRegionId) {
- var parameter = "";
- var cloudRegionTenantList = DataService.getCloudRegionTenantList();
- if ( UtilityService.hasContents (cloudRegionTenantList) ) {
- var parameter = FIELD.PARAMETER.TENANT_ENABLED;
- parameter.optionList = new Array();
- for (var i = 0; i < cloudRegionTenantList.length; i++) {
- if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
- parameter.optionList.push({
- id : cloudRegionTenantList[i].tenantId,
- name : cloudRegionTenantList[i].tenantName,
- isPermitted : cloudRegionTenantList[i].isPermitted
- });
- }
- }
- }
- return parameter;
-
- };
-
- var addOptionList = function(parameter, optionSimpleArray) {
- var optionList = new Array();
- if (!angular.isArray(optionSimpleArray)) {
- return optionList;
- }
- for (var i = 0; i < optionSimpleArray.length; i++) {
- optionList.push({
- name : optionSimpleArray[i]
- });
- }
- parameter.optionList = optionList;
- return parameter;
- };
-
- var getValueFromList = function(id, parameterList) {
- for (var i = 0; i < parameterList.length; i++) {
- if (parameterList[i].id === id) {
- return parameterList[i].value;
- }
- }
- };
-
- var updateUserParameterList = function(updatedId, parameterListControl) {
- if (updatedId === FIELD.ID.LCP_REGION) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- parameterListControl
- .updateList([ getTenantList(list[0].value) ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
- }
- if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
- }
- } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
- var list = parameterListControl.getList(updatedId);
- if (list[0].selectedIndex >= 0) {
- DataService.setGlobalCustomerId(list[0].value);
-
- AaiService.getSubscriptionServiceTypeList(DataService
- .getGlobalCustomerId(), function(response) {
- DataService.setSubscriptionServiceTypeList(response);
- var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
- serviceTypeParameters.optionList = [];
-
- for (var i = 0; i < response.length; i++) {
- serviceTypeParameters.optionList.push({
- "id" : response[i].name,
- "name" : response[i].name
- });
- }
- parameterListControl.updateList([ serviceTypeParameters ]);
- });
-
- } else {
- parameterListControl
- .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
- }
- }
- };
-
- return {
- initializeComponent : function(componentId) {
- _this.componentId = ComponentService.initialize(componentId);
- },
- getComponentDisplayName : ComponentService.getComponentDisplayName,
- getSummaryList : getSummaryList,
- getParameters : function(getParametersHandler) {
- _this.getParametersHandler = getParametersHandler;
- UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
- UtilityService.startAsyncOperations(getAsyncOperationList(),
- internalGetParametersHandler);
- },
- updateUserParameterList : updateUserParameterList,
- getMsoRequestDetails : getMsoRequestDetails,
- getMsoUrl : getMsoUrl,
- isMacro : DataService.getMacro()
- }
-}
-
-appDS2.factory("DeletionService", [ "$log", "AaiService", "AsdcService",
- "DataService", "ComponentService", "COMPONENT", "FIELD",
- "UtilityService", DeletionService ]);
+/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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 DeleteResumeService = function($log, AaiService, AsdcService, DataService, + ComponentService, COMPONENT, FIELD, UtilityService) { + + var _this = this; + + var getAsyncOperationList = function() { + if (DataService.getLoggedInUserId() == null) + getLoggedInUserID(); + switch (_this.componentId) { + case COMPONENT.SERVICE: + return [ getSubscribers, getLcpCloudRegionTenantList ]; + case COMPONENT.NETWORK: + return [ getLcpCloudRegionTenantList ]; + case COMPONENT.VNF: + return [ getLcpCloudRegionTenantList ]; + case COMPONENT.VF_MODULE: + return [ getLcpCloudRegionTenantList ]; + case COMPONENT.VOLUME_GROUP: + return [ getLcpCloudRegionTenantList ]; + case COMPONENT.CONFIGURATION: + return [ getLcpCloudRegionTenantList ]; + } + }; + + var getLcpCloudRegionTenantList = function() { + //console.log ( "global customer id: " ); + //console.log ( JSON.stringify (DataService.getGlobalCustomerId()) ); + + //console.log ( "service type: " ); + //console.log ( JSON.stringify (DataService.getServiceType()) ); + + AaiService.getLcpCloudRegionTenantList(DataService + .getGlobalCustomerId(), DataService.getServiceType(), function( + response) { + DataService.setCloudRegionTenantList(response); + UtilityService.startNextAsyncOperation(); + }); + }; + + var getLoggedInUserID = function() { + AaiService.getLoggedInUserID(function(response) { + DataService.setLoggedInUserId(response.data); + UtilityService.startNextAsyncOperation(); + }); + }; + + var getSubscribers = function() { + AaiService.getSubscribers(function(response) { + DataService.setSubscribers(response); + UtilityService.startNextAsyncOperation(); + }); + }; + + var internalGetParametersHandler = function() { + if (angular.isFunction(_this.getParametersHandler)) { + if (_this.componentId == COMPONENT.SERVICE) { + if ( DataService.getALaCarte() ) { + _this.getParametersHandler({ + summaryList : getSummaryList(), + userProvidedList : getUserProvidedList() + }, true); + } + else { + _this.getParametersHandler({ + summaryList : getSummaryList(), + userProvidedList : getUserProvidedList() + }, false); + } + } + else { + _this.getParametersHandler({ + summaryList : getSummaryList(), + userProvidedList : getUserProvidedList() + }, false); + } + } + }; + + var getSubscribersParameter = function() { + var subscribers = DataService.getSubscribers(); + var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME; + parameter.optionList = []; + + for (var i = 0; i < subscribers.length; i++) { + parameter.optionList.push({ + id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID], + name : subscribers[i][FIELD.ID.SUBNAME] + }) + } + return parameter; + }; + + var getServiceId = function() { + var serviceIdList = DataService.getServiceIdList(); + var parameter = FIELD.PARAMETER.PRODUCT_FAMILY; + parameter.optionList = new Array(); + for (var i = 0; i < serviceIdList.length; i++) { + parameter.optionList.push({ + id : serviceIdList[i].id, + name : serviceIdList[i].description + }); + } + return parameter; + }; + + var getUserProvidedList = function() { + + //var parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ]; + + var parameterList = []; + + switch (_this.componentId) { + case COMPONENT.SERVICE: + if ( DataService.getALaCarte() ) { + parameterList = []; + } + else { + parameterList = parameterList.concat ([getLcpRegion(), + FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN, + FIELD.PARAMETER.TENANT_DISABLED ]); + } + break; + case COMPONENT.NETWORK: + case COMPONENT.CONFIGURATION: + case COMPONENT.VNF: + parameterList = parameterList.concat([ //getServiceId(), + getLcpRegion(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN, + FIELD.PARAMETER.TENANT_DISABLED ]); + break; + case COMPONENT.VF_MODULE: + parameterList = parameterList.concat([ + getLcpRegion(), + FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN, + FIELD.PARAMETER.TENANT_DISABLED + ]); + + break; + case COMPONENT.VOLUME_GROUP: + parameterList = parameterList.concat([ getLcpRegion(), + FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN, + FIELD.PARAMETER.TENANT_DISABLED ]); + } + + //parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK); + + //addArbitraryParameters(parameterList); + + return parameterList; + }; + var getSummaryList = function() { + switch (_this.componentId) { + case COMPONENT.CONFIGURATION: + case COMPONENT.NETWORK: + case COMPONENT.SERVICE: + case COMPONENT.VNF: + case COMPONENT.VF_MODULE: + case COMPONENT.VOLUME_GROUP: + var summaryList = [ { + name : FIELD.NAME.SUBSCRIBER_NAME, + value : DataService.getSubscriberName() + }, { + name : FIELD.NAME.CUSTOMER_ID, + value : DataService.getGlobalCustomerId() + }, { + name : FIELD.NAME.SERVICE_UUID, + value : DataService.getServiceUuid() + }, { + name : FIELD.NAME.SERVICE_NAME, + value : DataService.getServiceName() + /* }, { + name : FIELD.NAME.USER_SERVICE_INSTANCE_NAME, + value : DataService.getUserServiceInstanceName()*/ + } ]; + + _this.parameterList = new Array(); + + addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName()); + + switch (_this.componentId) { + case COMPONENT.SERVICE: + addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]); + addToList(FIELD.NAME.SERVICE_VERSION, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]); + addToList(FIELD.NAME.SERVICE_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]); + addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService + .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]); + addToList(FIELD.NAME.SERVICE_CATEGORY, DataService + .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]); + break; + case COMPONENT.VF_MODULE: + addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService + .getSubscriberName()); + addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService + .getServiceInstanceName()); + addToList(FIELD.NAME.MODEL_NAME, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]); + addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]); + addToList(FIELD.NAME.MODEL_VERSION, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]); + addToList(FIELD.NAME.MODEL_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]); + break; + case COMPONENT.CONFIGURATION: + case COMPONENT.NETWORK: + case COMPONENT.VNF: + case COMPONENT.VOLUME_GROUP: + addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService + .getSubscriberName()); + addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService + .getServiceInstanceName()); + addToList(FIELD.NAME.MODEL_NAME, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]); + addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]); + addToList(FIELD.NAME.MODEL_VERSION, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]); + addToList(FIELD.NAME.MODEL_UUID, DataService + .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]); + break; + } + + /*var additionalList = ComponentService.getInventoryParameterList( + _this.componentId, DataService.getInventoryItem());*/ + var additionalList = ComponentService.getDisplayNames(ComponentService + .getInventoryParameterList(_this.componentId, DataService + .getInventoryItem(), true )); + + return summaryList.concat(ComponentService + .getDisplayNames(additionalList)); + } + }; + + var getMsoUrl = function() { + switch (_this.componentId) { + case COMPONENT.CONFIGURATION: + return "mso_delete_configuration/" + + DataService.getServiceInstanceId() + "/configurations/" + + DataService.getConfigurationInstanceId(); + case COMPONENT.NETWORK: + return "mso_delete_nw_instance/" + + DataService.getServiceInstanceId() + "/networks/" + + DataService.getNetworkInstanceId(); + case COMPONENT.SERVICE: + return "mso_delete_svc_instance/" + + DataService.getServiceInstanceId(); + case COMPONENT.VNF: + return "mso_delete_vnf_instance/" + + DataService.getServiceInstanceId() + "/vnfs/" + + DataService.getVnfInstanceId(); + case COMPONENT.VF_MODULE: + return "mso_delete_vfmodule_instance/" + + DataService.getServiceInstanceId() + "/vnfs/" + + DataService.getVnfInstanceId() + "/vfModules/" + + DataService.getVfModuleInstanceId(); + case COMPONENT.VOLUME_GROUP: + return "mso_delete_volumegroup_instance/" + + DataService.getServiceInstanceId() + "/vnfs/" + + DataService.getVnfInstanceId() + "/volumeGroups/" + + DataService.getVolumeGroupInstanceId(); + } + }; + + var addToList = function(name, value) { + _this.parameterList.push({ + name : name, + value : value + }); + }; + + var getMsoRequestDetails = function(parameterList) { + console.log("getMsoRequestDetails invoked"); + var inventoryInfo = ComponentService.getInventoryInfo( + _this.componentId, DataService.getInventoryItem()); + var modelInfo = DataService.getModelInfo(_this.componentId); + var requestorloggedInId = DataService.getLoggedInUserId(); + if (requestorloggedInId == null) + requestorloggedInId = ""; + var requestDetails = { + modelInfo : { + modelType : _this.componentId, + modelInvariantId : modelInfo.modelInvariantId, + modelVersionId : modelInfo.modelNameVersionId, + modelName : modelInfo.modelName, + modelCustomizationName : modelInfo.modelCustomizationName, + modelCustomizationId : modelInfo.customizationUuid, + modelVersion : modelInfo.modelVersion + }, + requestInfo : { + source : FIELD.ID.VID, + requestorId: requestorloggedInId + } + }; + + switch (_this.componentId) { + case COMPONENT.SERVICE: + requestDetails.requestParameters = { + aLaCarte : DataService.getALaCarte() + }; + if ( !(DataService.getALaCarte()) ) { + // for macro delete include cloud config. + var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList); + if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) { + lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, + parameterList); + } + requestDetails.cloudConfiguration = { + lcpCloudRegionId : lcpRegion, + tenantId : getValueFromList(FIELD.ID.TENANT, parameterList) + }; + } + break; + case COMPONENT.VNF: + case COMPONENT.CONFIGURATION: + console.log("getMsoRequestDetails COMPONENT.VNF"); + var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList); + if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) { + lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, + parameterList); + } + requestDetails.cloudConfiguration = { + lcpCloudRegionId : lcpRegion, + tenantId : getValueFromList(FIELD.ID.TENANT, parameterList) + }; + + break; + case COMPONENT.VF_MODULE: + case COMPONENT.NETWORK: + var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList); + if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) { + lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, + parameterList); + } + requestDetails.cloudConfiguration = { + lcpCloudRegionId : lcpRegion, + tenantId : getValueFromList(FIELD.ID.TENANT, parameterList) + }; + break; + case COMPONENT.VOLUME_GROUP: + var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList); + if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) { + lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, + parameterList); + } + requestDetails.cloudConfiguration = { + lcpCloudRegionId : lcpRegion, + tenantId : getValueFromList(FIELD.ID.TENANT, parameterList) + }; + + break; + default: + requestDetails.cloudConfiguration = { + lcpCloudRegionId : DataService.getLcpRegion(), + tenantId : DataService.getTenant() + }; + } + return requestDetails; + } + + var getLcpRegion = function() { + var cloudRegionTenantList = DataService.getCloudRegionTenantList(); + var parameter = ""; + if ( UtilityService.hasContents (cloudRegionTenantList) ) { + parameter = FIELD.PARAMETER.LCP_REGION; + parameter.optionList = new Array(); + for (var i = 0; i < cloudRegionTenantList.length; i++) { + for (var j = 0; j < parameter.optionList.length; j++) { + if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) { + parameter.optionList[j].isPermitted = + parameter.optionList[j].isPermitted || cloudRegionTenantList[i].isPermitted; + break; + } + } + if (j < parameter.optionList.length) { + continue; + } + parameter.optionList.push({ + id : cloudRegionTenantList[i].cloudRegionId, + isPermitted : cloudRegionTenantList[i].isPermitted + + }); + } + } + return parameter; + }; + + var getTenantList = function(cloudRegionId) { + var parameter = ""; + var cloudRegionTenantList = DataService.getCloudRegionTenantList(); + if ( UtilityService.hasContents (cloudRegionTenantList) ) { + var parameter = FIELD.PARAMETER.TENANT_ENABLED; + parameter.optionList = new Array(); + for (var i = 0; i < cloudRegionTenantList.length; i++) { + if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) { + parameter.optionList.push({ + id : cloudRegionTenantList[i].tenantId, + name : cloudRegionTenantList[i].tenantName, + isPermitted : cloudRegionTenantList[i].isPermitted + }); + } + } + } + return parameter; + + }; + + var addOptionList = function(parameter, optionSimpleArray) { + var optionList = new Array(); + if (!angular.isArray(optionSimpleArray)) { + return optionList; + } + for (var i = 0; i < optionSimpleArray.length; i++) { + optionList.push({ + name : optionSimpleArray[i] + }); + } + parameter.optionList = optionList; + return parameter; + }; + + var getValueFromList = function(id, parameterList) { + for (var i = 0; i < parameterList.length; i++) { + if (parameterList[i].id === id) { + return parameterList[i].value; + } + } + }; + + var updateUserParameterList = function(updatedId, parameterListControl) { + if (updatedId === FIELD.ID.LCP_REGION) { + var list = parameterListControl.getList(updatedId); + if (list[0].selectedIndex >= 0) { + parameterListControl + .updateList([ getTenantList(list[0].value) ]); + } else { + parameterListControl + .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]); + } + if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) { + parameterListControl + .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]); + } else { + parameterListControl + .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]); + } + } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) { + var list = parameterListControl.getList(updatedId); + if (list[0].selectedIndex >= 0) { + DataService.setGlobalCustomerId(list[0].value); + + AaiService.getSubscriptionServiceTypeList(DataService + .getGlobalCustomerId(), function(response) { + DataService.setSubscriptionServiceTypeList(response); + var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE; + serviceTypeParameters.optionList = []; + + for (var i = 0; i < response.length; i++) { + serviceTypeParameters.optionList.push({ + "id" : response[i].name, + "name" : response[i].name + }); + } + parameterListControl.updateList([ serviceTypeParameters ]); + }); + + } else { + parameterListControl + .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]); + } + } + }; + + return { + initializeComponent : function(componentId) { + _this.componentId = ComponentService.initialize(componentId); + }, + getComponentDisplayName : ComponentService.getComponentDisplayName, + getSummaryList : getSummaryList, + getParameters : function(getParametersHandler) { + _this.getParametersHandler = getParametersHandler; + UtilityService.setHttpErrorHandler(_this.httpErrorHandler); + UtilityService.startAsyncOperations(getAsyncOperationList(), + internalGetParametersHandler); + }, + updateUserParameterList : updateUserParameterList, + getMsoRequestDetails : getMsoRequestDetails, + getMsoUrl : getMsoUrl, + isMacro : DataService.getMacro() + } +} + +appDS2.factory("DeleteResumeService", [ "$log", "AaiService", "AsdcService", + "DataService", "ComponentService", "COMPONENT", "FIELD", + "UtilityService", DeleteResumeService ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js index 68c8503dc..67211d48b 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js @@ -20,7 +20,7 @@ "use strict";
-var MsoService = function($http, $log, PropertyService, AaiService, UtilityService, COMPONENT, FIELD, $q) {
+var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityService, COMPONENT, FIELD) {
var _this = this;
@@ -55,49 +55,60 @@ var MsoService = function($http, $log, PropertyService, AaiService, UtilityServi }
};
- var activateInstance = function(instance, model) {
- var deferred = $q.defer();
+ var buildPayloadForServiceActivateDeactivate = function (model, userId, aicZone) {
+ var requestDetails = {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": model.service.invariantUuid,
+ "modelVersionId": model.service.uuid,
+ "modelName": model.service.name,
+ "modelVersion": model.service.version
+ },
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": userId
+ },
+ "requestParameters": {
+ "userParams": [{
+ "name": "aic_zone",
+ "value": aicZone
+ }]
+ }
+ };
- AaiService.getLoggedInUserID(function (response) {
- var userID = response.data;
+ $log.debug("Service Activate/Deactivate payload", requestDetails);
- AaiService.getAicZoneForPNF(instance.globalCustomerId, model.service.serviceType, instance.serviceInstanceId, function (aicZone) {
+ return requestDetails;
- var requestDetails = {
- "modelInstanceId": serviceInstanceId,
- "requestDetails": {
- "modelInfo": {
- "modelType": "service",
- "modelInvariantId": model.service.invariantUuid,
- "modelVersionId": model.service.uuid,
- "modelName": model.service.name,
- "modelVersion": model.service.version
- },
- "requestInfo": {
- "source": "VID",
- "requestorId": userID
- },
- "requestParameters": {
- "userParams": {
- "name": "aic_zone",
- "value": aicZone
- }
- }
- }
- };
+ };
- console.log("requestDetails", requestDetails);
+ var activateInstance = function(requestParams) {
+ var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId, requestParams.aicZone);
- $http.post(COMPONENT.MSO_ACTIVATE_INSTANCE.replace('@serviceInstanceId', requestDetails.modelInstanceId),
- requestDetails.requestDetails)
- .success(function (response) {
- deferred.resolve({data: response});
- })
- .error(function(data, status, headers, config) {
- deferred.reject({message: data, status: status});
- });
+ return sendPostRequest(COMPONENT.MSO_ACTIVATE_INSTANCE.replace('@serviceInstanceId', requestParams.instance.serviceInstanceId),
+ requestDetails);
+ };
+
+ var deactivateInstance = function(requestParams) {
+ var requestDetails = buildPayloadForServiceActivateDeactivate(requestParams.model, requestParams.userId, requestParams.aicZone);
+
+ return sendPostRequest(COMPONENT.MSO_DEACTIVATE_INSTANCE.replace('@serviceInstanceId', requestParams.instance.serviceInstanceId),
+ requestDetails);
+ };
+
+ var sendPostRequest = function(url, requestDetails) {
+ var deferred = $q.defer();
+ if (url) {
+ $http.post(url, {
+ requestDetails: requestDetails
+ }, {
+ timeout: PropertyService.getServerResponseTimeoutMsec()
+ }).success(function (response) {
+ deferred.resolve({data: response});
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
});
- });
+ }
return deferred.promise;
};
@@ -177,9 +188,12 @@ var MsoService = function($http, $log, PropertyService, AaiService, UtilityServi getFormattedSingleGetOrchestrationRequestResponse : function (response) {
UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity);
UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status);
- checkValidStatus(response);
+ //checkValidStatus(response);
var message = "";
+ if (! (response && response.data && response.data.entity)) {
+ return message;
+ }
if ( UtilityService.hasContents (response.data.entity.request) ) {
var request = response.data.entity.request;
message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n";
@@ -201,6 +215,11 @@ var MsoService = function($http, $log, PropertyService, AaiService, UtilityServi + "\n\n";
}
}
+ else {
+ if (UtilityService.hasContents(response.data.status) && UtilityService.hasContents(response.data.entity)) {
+ message = this.getFormattedCommonResponse(response) + "\n";
+ }
+ }
return message;
},
getManualTasks : function(requestId) {
@@ -215,29 +234,37 @@ var MsoService = function($http, $log, PropertyService, AaiService, UtilityServi .catch(UtilityService.runHttpErrorHandler);
},
completeTask: function(taskId, taskToComplete) {
- $log.debug("MsoService:completeTask: taskId: "
- + taskId);
- AaiService.getLoggedInUserID(function (response) {
- var attuid = response.data;
- var source = "VID";
- var data = {
- requestDetails: {
- requestInfo: {
- source: source,
- responseValue: taskToComplete,
- requestorId: attuid
+ var promise = new Promise(function (resolve, reject) {
+ $log.debug("MsoService:completeTask: taskId: "
+ + taskId);
+ AaiService.getLoggedInUserID(function (response) {
+ var attuid = response.data;
+ var source = "VID";
+ var data = {
+ requestDetails: {
+ requestInfo: {
+ source: source,
+ responseValue: taskToComplete,
+ requestorId: attuid
+ }
}
- }
- };
+ };
- return $http.post(
- "mso/mso_post_man_task/" + taskId, data,
- {
- timeout: PropertyService
- .getServerResponseTimeoutMsec()
+ return $http.post(
+ "mso/mso_post_man_task/" + taskId, data,
+ {
+ timeout: PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function (response) {
+ resolve(response);
})
- .catch(UtilityService.runHttpErrorHandler);
+ .catch(UtilityService.runHttpErrorHandler);
+ }, function () {
+ reject();
+ });
});
+
+ return promise;
},
showResponseContentError : function(error, showFunction) {
switch (error.type) {
@@ -251,9 +278,233 @@ var MsoService = function($http, $log, PropertyService, AaiService, UtilityServi showFunction(FIELD.ERROR.SYSTEM_FAILURE);
}
},
- activateInstance: activateInstance
+ activateInstance: activateInstance,
+ deactivateInstance: deactivateInstance,
+
+
+ createConfigurationInstance: function(requestParams) {
+
+ const modelInfoOf = function (instance) {
+ const modelInfo = {
+ "modelType": "vnf",
+ "modelInvariantId": instance.properties['model-invariant-id'],
+ "modelVersionId": instance.properties['model-version-id'],
+ "modelName": instance.properties['model-name'],
+ "modelVersion": instance.properties['model-version'],
+ "modelCustomizationId": instance.properties['model-customization-id']
+ };
+
+ $log.debug("model info from instance", instance);
+ $log.debug("model info to model", modelInfo);
+
+ return modelInfo
+ };
+
+ var payload = {
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "configuration",
+ "modelInvariantId": requestParams.configurationModelInfo.modelInvariantId,
+ "modelVersionId": requestParams.configurationModelInfo.modelNameVersionId,
+ "modelName": requestParams.configurationModelInfo.modelName, // "Port Mirroring Configuration"
+ "modelVersion": requestParams.configurationModelInfo.modelVersion,
+ "modelCustomizationId": requestParams.configurationModelInfo.customizationUuid,
+ "modelCustomizationName": requestParams.configurationModelInfo.modelCustomizationName
+ },
+ "cloudConfiguration": {
+ // "tenantId": ????
+ "lcpCloudRegionId": requestParams.portMirroringConfigFields.lcpRegion.value
+ },
+ "requestInfo": {
+ "instanceName": requestParams.portMirroringConfigFields.instanceName.value,
+ "source": "VID",
+ "requestorId": requestParams.attuuid
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": requestParams.topServiceInstanceId,
+ "modelInfo": {
+ "modelType": "service", // relatedTopModelsInfo.modelType
+ "modelInvariantId": requestParams.relatedTopModelsInfo.modelInvariantId,
+ "modelVersionId": requestParams.relatedTopModelsInfo.modelNameVersionId,
+ "modelName": requestParams.relatedTopModelsInfo.modelName,
+ "modelVersion": requestParams.relatedTopModelsInfo.modelVersion
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": requestParams.portMirroringConfigFields.sourceInstance.properties['vnf-id'],
+ "instanceDirection": "source",
+ "modelInfo": modelInfoOf(requestParams.portMirroringConfigFields.sourceInstance)
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": requestParams.configurationByPolicy ?
+ requestParams.portMirroringConfigFields.destinationInstance.properties['pnfName']:
+ requestParams.portMirroringConfigFields.destinationInstance.properties['vnf-id'],
+ "instanceDirection": "destination",
+ "modelInfo":
+ requestParams.configurationByPolicy ?
+ {"modelType": "pnf"} :
+ modelInfoOf(requestParams.portMirroringConfigFields.destinationInstance)
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": []
+ }
+ }
+ };
+
+ $log.debug("payload", payload);
+
+ var deferred = $q.defer();
+ $http.post([
+ 'mso','mso_create_configuration_instance',
+ requestParams.topServiceInstanceId,
+ 'configurations',''
+ ].join(COMPONENT.FORWARD_SLASH),
+ payload)
+ .success(function (response) {
+ deferred.resolve({data : response});
+ }).error(function (data, status) {
+ deferred.reject({message: data, status: status});
+ });
+ return deferred.promise;
+ },
+
+ toggleConfigurationStatus: function(requestParams) {
+
+ var requestDetails = {
+ "modelInfo": requestParams.configurationModel,
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": requestParams.userId
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": requestParams.serviceInstanceId,
+ "modelInfo": requestParams.serviceModel
+ }
+ }],
+ "requestParameters": {
+ "userParams": []
+ }
+ };
+
+ var url;
+ switch (requestParams.configStatus) {
+ case FIELD.STATUS.AAI_CREATED:
+ case FIELD.STATUS.AAI_INACTIVE:
+ url = "mso/mso_activate_configuration/"+requestParams.serviceInstanceId+"/configurations/"+requestParams.configurationId;
+ break;
+ case FIELD.STATUS.AAI_ACTIVE:
+ url = "mso/mso_deactivate_configuration/"+requestParams.serviceInstanceId+"/configurations/"+requestParams.configurationId;
+ break;
+ }
+
+ return sendPostRequest(url, requestDetails);
+ },
+
+ togglePortStatus: function(requestParams) {
+ var requestDetails = {
+ "modelInfo": requestParams.configurationModel,
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": requestParams.userId
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": requestParams.serviceInstanceId,
+ "modelInfo": requestParams.serviceModel
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": requestParams.portId,
+ "instanceDirection": "source",
+ "modelInfo": {
+ "modelType": "connectionPoint"
+ }
+ }
+ }
+ ]
+ };
+
+ var url;
+ switch (requestParams.portStatus) {
+ case FIELD.STATUS.AAI_ENABLED:
+ url = "mso/mso_disable_port_configuration/"+requestParams.serviceInstanceId+"/configurations/"+requestParams.configurationId;
+ break;
+ case FIELD.STATUS.AAI_DISABLED:
+ url = "mso/mso_enable_port_configuration/"+requestParams.serviceInstanceId+"/configurations/"+requestParams.configurationId;
+ break;
+ }
+
+ return sendPostRequest(url, requestDetails);
+ },
+
+ buildPayloadForAssociateDissociate: function(serviceModelInfo, attuuid, instanceId, pnf) {
+ var payload = {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": serviceModelInfo.invariantUuid,
+ "modelVersionId": serviceModelInfo.uuid,
+ "modelName": serviceModelInfo.name,
+ "modelVersion": serviceModelInfo.version
+ },
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": attuuid
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceName": pnf,
+ "modelInfo": {
+ "modelType": "pnf"
+ }
+ }
+ }],
+ "requestParameters": {
+ "aLaCarte": true
+ }
+ };
+
+ $log.debug("payload", payload);
+
+ return payload;
+ },
+ associatePnf: function(requestParams) {
+
+ var payload = this.buildPayloadForAssociateDissociate(requestParams.serviceModelInfo, requestParams.attuuid, requestParams.instanceId, requestParams.pnf);
+ return sendPostRequest([
+ COMPONENT.MSO, COMPONENT.MSO_CREATE_REALATIONSHIP,
+ requestParams.instanceId,
+ ''
+ ].join(COMPONENT.FORWARD_SLASH), payload);
+ },
+ dissociatePnf: function(requestParams) {
+
+ var payload = this.buildPayloadForAssociateDissociate(requestParams.serviceModelInfo, requestParams.attuuid, requestParams.serviceInstanceId, requestParams.pnf);
+
+ return sendPostRequest([
+ COMPONENT.MSO, COMPONENT.MSO_REMOVE_RELATIONSHIP,
+ requestParams.serviceInstanceId,
+ ''
+ ].join(COMPONENT.FORWARD_SLASH), payload);
+ }
}
};
-appDS2.factory("MsoService", [ "$http", "$log", "PropertyService",
- "AaiService", "UtilityService", "COMPONENT", "FIELD", "$q", MsoService ]);
+appDS2.factory("MsoService", MsoService );
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/pnfService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/pnfService.js new file mode 100644 index 000000000..39a2e2d90 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/pnfService.js @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 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 PnfService = function ($q, AaiService) { + return { + getPnfs: function (instance) { + var deferred = $q.defer(); + + AaiService.getPNFInformationByServiceTypeAndId( + instance.globalCustomerId, + instance.serviceType, + instance.serviceInstanceId, + function (response) { + deferred.resolve(response); + }, + function (error) { + deferred.reject(error); + }); + return deferred.promise; + } + }; +}; + +appDS2.factory("PnfService", ["$q", "AaiService", PnfService]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js index 83cc4ddac..cd0c45e7d 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js @@ -22,81 +22,24 @@ var SchedulerService = function($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) { return { - - getStatusSchedulerId : function(schedulerInfo,successCallbackFunction) { - $log - .debug("SchedulerService:getSchedulerStatusAndSchedulerId"); - var url = COMPONENT.POST_CREATE_NEW_VNF_CHANGE+COMPONENT.ASSIGN + Math.random(); - - $http.post(url, schedulerInfo, - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(function(response) { - if (response.data) { - successCallbackFunction(response); - } else { - successCallbackFunction([]); - } - })["catch"] - (UtilityService.runHttpErrorHandler); - }, - - getTimeSotsForSchedulerId:function(schedulerID,successCallbackFunction){ - $log - .debug("SchedulerService:getTimeSlotsForSchedulerID"); - var url = COMPONENT.GET_TIME_SLOTS+COMPONENT.FORWARD_SLASH +schedulerID+COMPONENT.ASSIGN; - - $http.get(url, - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(function(response) { - if (response.data) { - successCallbackFunction(response); - } else { - successCallbackFunction([]); - } - })["catch"] - - (UtilityService.runHttpErrorHandler); - }, - getSubmitForapprovedTimeslots: function(ApprovedTimeSlotsObj,successCallbackFunction) { - $log - .debug("SchedulerService:getSchedulerStatusAndSchedulerId"); - var url = COMPONENT.SUBMIT_VNF_CHANGE_TIMESLOTS+COMPONENT.ASSIGN + Math.random(); - - $http.post(url, ApprovedTimeSlotsObj, - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(function(response) { - if (response.data) { - successCallbackFunction(response); - } else { - successCallbackFunction([]); - } - })["catch"] - (UtilityService.runHttpErrorHandler); - }, - getPolicyInfo:function(policyName,successCallbackFunction){ - $log - .debug("SchedulerService:getPolicyInfo"); - var url = COMPONENT.GET_POLICY +COMPONENT.ASSIGN + Math.random(); - - $http.post(url, policyName, - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(function(response) { - if (response.data) { - successCallbackFunction(response); - } else { - successCallbackFunction([]); - } - })["catch"] - (UtilityService.runHttpErrorHandler); - } + cancelScheduleRequest: function(schedulerID, successCallbackFunction, errorCallbackFunction) { + $log.debug("SchedulerService:cancelPendingBySchedulerId"); + var url = COMPONENT.CANCEL_SCHEDULE_REQUEST + COMPONENT.FORWARD_SLASH + schedulerID + COMPONENT.ASSIGN; + + $http.delete(url, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data) { + successCallbackFunction(response); + } else { + successCallbackFunction([]); + } + }).catch(function(error) { + errorCallbackFunction(error); + }); + } } } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js new file mode 100644 index 000000000..6ae675a01 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js @@ -0,0 +1,79 @@ +(function () { + 'use strict'; + + appDS2.service('TestEnvironmentsService', ['$q', '$http', '$log', 'COMPONENT', 'UtilityService', testEnvironmentsService]); + + function testEnvironmentsService($q, $http, $log, COMPONENT, UtilityService) { + this.loadAAIestEnvironments = function(type) { + var deferred = $q.defer(); + $http.get(COMPONENT.AAI_GET_TEST_ENVIRONMENTS + type) + .success(function (response) { + if(response.httpCode == 200) { + deferred.resolve({operationalEnvironment: response.t.operationalEnvironment}); + } + else { + deferred.reject({message: response.errorMessage, status: response.httpCode}); + } + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.createApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_CREATE, JSON.stringify(request.requestDetails)) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (data, status) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + } + + this.deactivateApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_DEACTIVATE + request.envId, JSON.stringify({})) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (data, status) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.activateApplicationEnv = function(request) { + var deferred = $q.defer(); + + $http.post(COMPONENT.OPERATIONAL_ENVIRONMENT_ACTIVATE + request.envId, JSON.stringify({ + "relatedInstanceId": request.relatedInstanceId + , "relatedInstanceName": request.relatedInstanceName + , "workloadContext": request.workloadContext + , "manifest": request.manifest + })) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (response, status) { + UtilityService.runHttpErrorHandler({data:response, status:status}); + }); + return deferred.promise; + }; + + this.getRequestStatus = function(requestId, successCallback) { + $http.get(COMPONENT.OPERATIONAL_ENVIRONMENT_STATUS + requestId) + .success(function(response) { + successCallback({data: response}); + } ) + .catch(UtilityService.runHttpErrorHandler); + }; + } + + +})(); + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js index 4e4d12302..8577e9930 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js @@ -67,31 +67,31 @@ var UtilityService = function($log, DataService, PARAMETER) { var _this = this;
var convertModel = function (serviceModel) {
-
- var isNewFlow = false;
-
- for (var networkCustomizationName in serviceModel.networks) {
- var networkModel = serviceModel.networks[networkCustomizationName];
- if ( networkModel.customizationUuid != null ) {
- isNewFlow = true;
- break;
- }
- }
- if ( !isNewFlow ) {
- for (var vnfCustomizationName in serviceModel.vnfs) {
- var vnfModel = serviceModel.vnfs[vnfCustomizationName];
- if ( vnfModel.customizationUuid != null ) {
- isNewFlow = true;
- break;
- }
- }
- }
- if ( isNewFlow ) {
- return (convertNewModel (serviceModel) );
- }
- else {
- return (convertOldModel (serviceModel) );
- }
+
+ var isNewFlow = false;
+
+ for (var networkCustomizationName in serviceModel.networks) {
+ var networkModel = serviceModel.networks[networkCustomizationName];
+ if ( networkModel.customizationUuid != null ) {
+ isNewFlow = true;
+ break;
+ }
+ }
+ if ( !isNewFlow ) {
+ for (var vnfCustomizationName in serviceModel.vnfs) {
+ var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+ if ( vnfModel.customizationUuid != null ) {
+ isNewFlow = true;
+ break;
+ }
+ }
+ }
+ if ( isNewFlow ) {
+ return (convertNewModel (serviceModel) );
+ }
+ else {
+ return (convertOldModel (serviceModel) );
+ }
};
var convertNewModel = function (serviceModel ) {
var completeResources = new Array();
@@ -100,6 +100,8 @@ var UtilityService = function($log, DataService, PARAMETER) { "service": serviceModel.service,
"networks": {},
"vnfs": {},
+ "pnfs": serviceModel.pnfs,
+ "serviceProxies": serviceModel.serviceProxies,
"completeDisplayInputs": {},
"isNewFlow": true
};
@@ -164,9 +166,18 @@ var UtilityService = function($log, DataService, PARAMETER) { }
}
-
- for (var vnfCustomizationName in serviceModel.vnfs) {
- var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+
+ _.forEach(serviceModel.configurations, function(element, key) {
+ element.isConfig = true;
+ });
+ _.forEach(serviceModel.pnfs, function(element, key) {
+ element.isPnf= true;
+ element.modelCustomizationName= key;
+ });
+ var mergedVnfs = Object.assign(serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
+
+ for (var vnfCustomizationName in mergedVnfs) {
+ var vnfModel = mergedVnfs[vnfCustomizationName];
var vnfCustomizationUuid = vnfModel.customizationUuid;
convertedAsdcModel.vnfs[vnfModel.customizationUuid] = {
"uuid": vnfModel.uuid,
@@ -183,8 +194,13 @@ var UtilityService = function($log, DataService, PARAMETER) { "displayInputs": {},
"properties": {},
"nfRole": "",
- "nfType": ""
- }
+ "nfType": "",
+ "sourceNodes": vnfModel.sourceNodes,
+ "collectorNodes": vnfModel.collectorNodes,
+ "isConfigurationByPolicy": vnfModel.configurationByPolicy ? vnfModel.configurationByPolicy : false,
+ "isConfig": vnfModel.isConfig ? vnfModel.isConfig : false,
+ "isPnf": vnfModel.isPnf ? vnfModel.isPnf : false
+ };
resource = {
"name": vnfModel.modelCustomizationName,
@@ -278,11 +294,11 @@ var UtilityService = function($log, DataService, PARAMETER) { convertedAsdcModel.completeDisplayInputs = completeDisplayInputs;
// Need to collect all the model customization names (node template tag) and descriptions
DataService.setResources (completeResources);
-
- console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ));
+
+ $log.debug ("convertedAsdcModel: ", convertedAsdcModel);
return (convertedAsdcModel);
};
-
+
var convertOldModel = function (serviceModel ) {
var resource = {};
@@ -290,6 +306,8 @@ var UtilityService = function($log, DataService, PARAMETER) { "service": serviceModel.service,
"networks": {},
"vnfs": {},
+ "pnfs": serviceModel.pnfs,
+ "serviceProxies": serviceModel.serviceProxies,
"completeDisplayInputs": {},
"isNewFlow": false
};
@@ -356,9 +374,18 @@ var UtilityService = function($log, DataService, PARAMETER) { convertedAsdcModel.networks[networkModel.uuid].displayInputs=networkModelDisplayInputs;
}
}
-
- for (var vnfCustomizationName in serviceModel.vnfs) {
- var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+
+ _.forEach(serviceModel.configurations, function(element, key) {
+ element.isConfig = true;
+ });
+ _.forEach(serviceModel.pnfs, function(element, key) {
+ element.isPnf= true;
+ element.modelCustomizationName= key;
+ });
+ var mergedVnfs = Object.assign(serviceModel.vnfs, serviceModel.configurations, serviceModel.pnfs);
+
+ for (var vnfCustomizationName in mergedVnfs) {
+ var vnfModel = mergedVnfs[vnfCustomizationName];
convertedAsdcModel.vnfs[vnfModel.uuid] = {
"uuid": vnfModel.uuid,
"invariantUuid": vnfModel.invariantUuid,
@@ -371,8 +398,13 @@ var UtilityService = function($log, DataService, PARAMETER) { "vfModules": {},
"volumeGroups": {},
"commands": {},
- "displayInputs": {}
- }
+ "displayInputs": {},
+ "sourceNodes": vnfModel.sourceNodes,
+ "collectorNodes": vnfModel.collectorNodes,
+ "isConfigurationByPolicy": vnfModel.configurationByPolicy ? vnfModel.configurationByPolicy : false,
+ "isConfig": vnfModel.isConfig ? vnfModel.isConfig : false,
+ "isPnf": vnfModel.isPnf ? vnfModel.isPnf : false
+ };
resource = {
"name": vnfModel.modelCustomizationName,
"description": vnfModel.description
@@ -441,203 +473,203 @@ var UtilityService = function($log, DataService, PARAMETER) { convertedAsdcModel.completeDisplayInputs = completeDisplayInputs;
// Need to collect all the model customization names (node template tag) and descriptions
DataService.setResources (completeResources);
- console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ));
+ $log.debug ("convertedAsdcModel: ", convertedAsdcModel);
return (convertedAsdcModel);
};
-
+
function hasContents(object) {
- if (object === undefined || object === null || object === "") {
- return false;
- }
- return true;
+ if (object === undefined || object === null || object === "") {
+ return false;
+ }
+ return true;
};
function isObjectEmpty(o) {
- var len = 0;
- if (hasContents(o)){
- var keys = Object.keys(o);
- len = keys.length;
- if ( len == 0 ) {
- return true;
- }
- else {
- return false;
- }
- }
- else {
- return true;
- }
+ var len = 0;
+ if (hasContents(o)){
+ var keys = Object.keys(o);
+ len = keys.length;
+ if ( len == 0 ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
};
function padZero(number) {
- if (number < 10) {
- return "0" + number;
- } else {
- return "" + number;
- }
+ if (number < 10) {
+ return "0" + number;
+ } else {
+ return "" + number;
+ }
};
var httpErrorHandler = function(response, status) {
- $log.warn("UtilityService:httpErrorHandler: response:");
- $log.warn(response);
- $log.warn("UtilityService:httpErrorHandler: status:");
- $log.warn(status);
- if (angular.isFunction(_this.httpErrorHandler)) {
- _this.httpErrorHandler(response, status);
- }
+ $log.warn("UtilityService:httpErrorHandler: response:");
+ $log.warn(response);
+ $log.warn("UtilityService:httpErrorHandler: status:");
+ $log.warn(status);
+ if (angular.isFunction(_this.httpErrorHandler)) {
+ _this.httpErrorHandler(response, status);
+ }
};
var startNextAsyncOperation = function() {
- if (_this.asyncOperations.count < _this.asyncOperations.operationList.length) {
- _this.asyncOperations.operationList[_this.asyncOperations.count++]
- ();
- } else {
- if (angular.isFunction(_this.asyncOperations.callbackFunction)) {
- _this.asyncOperations.callbackFunction();
- }
- }
+ if (_this.asyncOperations.count < _this.asyncOperations.operationList.length) {
+ _this.asyncOperations.operationList[_this.asyncOperations.count++]
+ ();
+ } else {
+ if (angular.isFunction(_this.asyncOperations.callbackFunction)) {
+ _this.asyncOperations.callbackFunction();
+ }
+ }
};
return {
- setProperties : function(properties) {
- _this.properties = properties;
- },
- getProperties : function() {
- return _this.properties;
- },
- hasContents : hasContents,
- checkUndefined : function(name, value) {
- if (value === undefined) {
- throw {
- type : "undefinedObject",
- message : "undefined object: \"" + name + "\""
- };
- }
- return value;
- },
- jsonConcat : function (o1, o2) {
- for (var key in o2) {
- o1[key] = o2[key];
- }
- return o1;
- },
- getCurrentTime : function() {
- var time = new Date();
- return padZero(time.getMonth() + 1) + "/"
- + padZero(time.getDate()) + "/"
- + (time.getFullYear() - 2000) + " "
- + padZero(time.getHours()) + ":"
- + padZero(time.getMinutes()) + ":"
- + padZero(time.getSeconds())
- },
- getHttpStatusText : function(statusCode) {
- var statusMap = {
- "200" : "OK",
- "201" : "Created",
- "202" : "Accepted",
- "400" : "Bad Request",
- "401" : "Unauthorized",
- "404" : "Not Found",
- "405" : "Method Not Allowed",
- "409" : "Locked",
- "500" : "Internal Server Error",
- "503" : "Service Unavailable",
- "504" : "Gateway Timeout"
- }
+ setProperties : function(properties) {
+ _this.properties = properties;
+ },
+ getProperties : function() {
+ return _this.properties;
+ },
+ hasContents : hasContents,
+ checkUndefined : function(name, value) {
+ if (value === undefined) {
+ throw {
+ type : "undefinedObject",
+ message : "undefined object: \"" + name + "\""
+ };
+ }
+ return value;
+ },
+ jsonConcat : function (o1, o2) {
+ for (var key in o2) {
+ o1[key] = o2[key];
+ }
+ return o1;
+ },
+ getCurrentTime : function() {
+ var time = new Date();
+ return padZero(time.getMonth() + 1) + "/"
+ + padZero(time.getDate()) + "/"
+ + (time.getFullYear() - 2000) + " "
+ + padZero(time.getHours()) + ":"
+ + padZero(time.getMinutes()) + ":"
+ + padZero(time.getSeconds())
+ },
+ getHttpStatusText : function(statusCode) {
+ var statusMap = {
+ "200" : "OK",
+ "201" : "Created",
+ "202" : "Accepted",
+ "400" : "Bad Request",
+ "401" : "Unauthorized",
+ "404" : "Not Found",
+ "405" : "Method Not Allowed",
+ "409" : "Locked",
+ "500" : "Internal Server Error",
+ "503" : "Service Unavailable",
+ "504" : "Gateway Timeout"
+ }
- if (status === undefined) {
- return "Undefined";
- }
+ if (status === undefined) {
+ return "Undefined";
+ }
- var statusText = statusMap[statusCode];
- if (statusText === undefined) {
- statusText = "Unknown";
- }
+ var statusText = statusMap[statusCode];
+ if (statusText === undefined) {
+ statusText = "Unknown";
+ }
- return statusText + " (" + statusCode + ")";
- },
- getHttpErrorMessage : function(response) {
- var data = response.data;
- if (response.status === 500 && hasContents(data.exception)) {
- var summary = "exception: " + data.exception;
- if (hasContents(data.message)) {
- summary += " message: " + data.message;
- }
- return summary;
- }
- if (response.status === 0 && response.statusText === "") {
- /*
- * This logic is somewhat "fuzzy". Potential (brainstorming)
- * enhancements if users find the message unreliable include:
- *
- * A) SERVER TIMEOUT: perhaps a newer version of Angular can
- * reliably determine timeouts.
- *
- * B) SERVER TIMEOUT: recording start / end times and using that
- * to determine if timeout occured
- *
- * C) SESSION TIMEOUT "Potentially" examine cookies, although
- * that may not be feasible if cookies are set to "httponly".
- */
- if (data === null) {
- //return "possible server timeout";
- return "VID has timed out waiting for a response. To see status, close this popup and the screen will be refreshed automatically";
- }
- if (data === "") {
- return "Possible reasons include a session timeout or a server issue. "
- + "A session timeout might be resolved by refreshing the screen and re-logging in";
- }
- }
- var summary = "";
- if (response.status !== undefined && response.status > 0) {
- summary = "status: " + response.status;
- }
- if (hasContents(response.statusText)) {
- if (summary !== "") {
- summary += " ";
- }
- summary += "message: " + response.statusText;
- }
- return summary;
- },
- setHttpErrorHandler : function(httpErrorHandler) {
- _this.httpErrorHandler = httpErrorHandler;
- },
- runHttpErrorHandler : function(response, status) {
- httpErrorHandler(response, status);
- },
- startAsyncOperations : function(operationList, callbackFunction) {
- for (var i = 0; i < operationList.length; i++) {
- if (!angular.isFunction(operationList[i])) {
- throw "UtilityService:startAsyncOperations: invalid function: index: "
- + i;
- }
- }
- _this.asyncOperations = {
- operationList : operationList,
- callbackFunction : callbackFunction,
- count : 0
- };
- startNextAsyncOperation();
- },
- startNextAsyncOperation : startNextAsyncOperation,
- stopAsyncOperations : function() {
- _this.asyncOperations.count = _this.asyncOperations.operationList.length;
- },
- isObjectEmpty : isObjectEmpty,
- convertModel : convertModel,
- convertNewModel : convertNewModel,
- convertOldModel : convertOldModel,
- arrayContains : function (a, obj) {
- var i = a.length;
- if ( i > 0 ) {
- while (i--) {
- if (a[i] === obj) {
- return true;
- }
- }
- }
- return false;
- }
- }
+ return statusText + " (" + statusCode + ")";
+ },
+ getHttpErrorMessage : function(response) {
+ var data = response.data;
+ if ((response.status >= 400 && response.status < 600) && hasContents(data.exception)) {
+ var summary = "exception: " + data.exception;
+ if (hasContents(data.message)) {
+ summary += " message: " + data.message;
+ }
+ return summary;
+ }
+ if (response.status === 0 && response.statusText === "") {
+ /*
+ * This logic is somewhat "fuzzy". Potential (brainstorming)
+ * enhancements if users find the message unreliable include:
+ *
+ * A) SERVER TIMEOUT: perhaps a newer version of Angular can
+ * reliably determine timeouts.
+ *
+ * B) SERVER TIMEOUT: recording start / end times and using that
+ * to determine if timeout occured
+ *
+ * C) SESSION TIMEOUT "Potentially" examine cookies, although
+ * that may not be feasible if cookies are set to "httponly".
+ */
+ if (data === null) {
+ //return "possible server timeout";
+ return "VID has timed out waiting for a response. To see status, close this popup and the screen will be refreshed automatically";
+ }
+ if (data === "") {
+ return "Possible reasons include a session timeout or a server issue. "
+ + "A session timeout might be resolved by refreshing the screen and re-logging in";
+ }
+ }
+ var summary = "";
+ if (response.status !== undefined && response.status > 0) {
+ summary = "status: " + response.status;
+ }
+ if (hasContents(response.statusText)) {
+ if (summary !== "") {
+ summary += " ";
+ }
+ summary += "message: " + response.statusText;
+ }
+ return summary;
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ runHttpErrorHandler : function(response, status) {
+ httpErrorHandler(response, status);
+ },
+ startAsyncOperations : function(operationList, callbackFunction) {
+ for (var i = 0; i < operationList.length; i++) {
+ if (!angular.isFunction(operationList[i])) {
+ throw "UtilityService:startAsyncOperations: invalid function: index: "
+ + i;
+ }
+ }
+ _this.asyncOperations = {
+ operationList : operationList,
+ callbackFunction : callbackFunction,
+ count : 0
+ };
+ startNextAsyncOperation();
+ },
+ startNextAsyncOperation : startNextAsyncOperation,
+ stopAsyncOperations : function() {
+ _this.asyncOperations.count = _this.asyncOperations.operationList.length;
+ },
+ isObjectEmpty : isObjectEmpty,
+ convertModel : convertModel,
+ convertNewModel : convertNewModel,
+ convertOldModel : convertOldModel,
+ arrayContains : function (a, obj) {
+ var i = a.length;
+ if ( i > 0 ) {
+ while (i--) {
+ if (a[i] === obj) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
}
//app.factory("UtilityService", UtilityService);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm index c5c5ccaa9..233bab1c8 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm @@ -39,7 +39,8 @@ <br>
Please search by the Subscriber name or enter Service Instance Id or Service Instance Name below: <br><br>
- <table>
+ <table ng-init="loadOwningEntity()">
+
<tr>
<td style="width:30%">
<div class="fn-ebz-container">
@@ -51,7 +52,7 @@ <!--<select name="selectedCustomer" ng-model="selectedCustomer">-->
<!--<option ng-repeat="item in customerList" value="{{item.globalCustomerId}}" ng-disabled="getPermitted(item)">{{item.subscriberName}}</option>-->
<!--</select>-->
- <select ng-model="selectedCustomer"
+ <select ng-model="selectedCustomer" id="selectSubscriber"
ng-options="item.globalCustomerId as item.subscriberName for item in customerList | orderBy:'subscriberName'">
<option value="">Select a subscriber</option>
</select>
@@ -60,8 +61,9 @@ class="glyphicon glyphicon-refresh"></span></a>
</div>
</td>
-
</tr>
+
+
<tr>
<td style="width:30%">
<div class="fn-ebz-container">
@@ -72,8 +74,8 @@ </div>
</td>
<td style="width:60%">
- <div class="fn-ebz-container">
- <input type="text" style="width: 350px;" name="selectedServiceInstance"
+ <div class="fn-ebz-container" style="width: 100%;">
+ <input type="text" name="selectedServiceInstance"
ng-model="selectedServiceInstance"
data-tests-id="searchForExistingInstancesText"
restrict-input="{type : selectedserviceinstancetype}"/>
@@ -81,12 +83,51 @@ </td>
</tr>
+
+ <tr>
+ <td style="width:30%">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Owning entity Name:</label>
+ </div>
+ </td>
+ <td style="width:30%" nowrap>
+ <div class="fn-ebz-container" style="width: 100%;">
+ <!--<select name="selectedCustomer" ng-model="selectedCustomer">-->
+ <!--<option ng-repeat="item in customerList" value="{{item.globalCustomerId}}" ng-disabled="getPermitted(item)">{{item.subscriberName}}</option>-->
+ <!--</select>-->
+ <multiselect id="selectOwningEntity" ng-model="selectedEntity"
+ options="owningEntities"
+ display-prop="name" id-prop="id">
+ </multiselect>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td style="width:30%">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Project Name:</label>
+ </div>
+ </td>
+ <td style="width:30%" nowrap>
+ <div class="fn-ebz-container" style="width: 100%;">
+ <!--<select name="selectedCustomer" ng-model="selectedCustomer">-->
+ <!--<option ng-repeat="item in customerList" value="{{item.globalCustomerId}}" ng-disabled="getPermitted(item)">{{item.subscriberName}}</option>-->
+ <!--</select>-->
+ <multiselect id="selectProject" ng-model="selectedProject"
+ options="projects"
+ display-prop="name" id-prop="id">
+ </multiselect>
+ </div>
+ </td>
+ </tr>
+
<tr>
<td>
<td style="width:30%">
<div>
<button type="submit" class="btn btn-primary" size="small"
- ng-click="getSubscriberDet(selectedCustomer,selectedserviceinstancetype,selectedServiceInstance);">
+ ng-click="getServiceInstancesSearchResults(selectedCustomer,selectedserviceinstancetype,selectedServiceInstance, selectedProject, selectedEntity);">
Submit
</button>
</a>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm index 16357dde9..6198cb478 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm @@ -18,52 +18,66 @@ ============LICENSE_END=========================================================
-->
-<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiGetSubs.css" />
-<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiSubDetails.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiGetSubs.css"/>
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiSubDetails.css"/>
<script src="app/vid/scripts/controller/aaiSubscriberController.js"></script>
<div ng-controller="aaiSubscriberController" ng-cloak>
- <div>
- <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
- <img src="app/vid/images/spinner.gif"></img>
- <label>Status:</label><span class="status">{{status}}</span>
- </div>
-
- <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
-
- <h2 class="heading2"><center>Create New Service Instance</center></h2>
-
- <table>
- <tr>
- <td >
- <div class="fn-ebz-container">
- <label class="fn-ebz-text-label">Subscriber Name:</label>
- </div>
- </td>
- <td style="width:80%" nowrap>
- <div class="fn-ebz-container" ng-init="autoGetSubs();">
- <select ng-model="selectedCustomer" data-tests-id="subscriberName">
- <option value="">Select Subscriber Name</option>
- <option ng-repeat="item in customerList | orderBy:'subscriberName'" ng-value="item.globalCustomerId" ng-disabled="!item.isPermitted" class="subscriberNameOption">{{item.subscriberName}}</option>
- </select>
- <a class="btn btn-primary" ng-click="refreshSubs();" ><span class="glyphicon glyphicon-refresh"></span></a>
- </div>
- </td>
-
- </tr>
- <tr>
- <td >
- </td>
- <td style="width:80%">
- <div >
- <button type="submit" class="btn btn-primary" size="small" ng-click="getServiceTypes(selectedCustomer);">Submit</button></a>
- <button type="submit" class="btn btn-primary" size="small" ng-click="cancelCreateSI()">Cancel</button></a>
- </div>
- </td>
- </tr>
- </table>
-
-
- </div>
+ <div>
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}
+ <pre>{{errorDetails | json}}</pre>
+ </font></div>
+
+ <h2 class="heading2">
+ <center>Create New Service Instance</center>
+ </h2>
+
+ <table>
+ <tr>
+ <td>
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Subscriber Name:</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container" ng-init="autoGetSubs();">
+ <select ng-model="selectedCustomer" data-tests-id="subscriberName">
+ <option value="">Select Subscriber Name</option>
+ <option ng-repeat="item in customerList | orderBy:'subscriberName'"
+ ng-value="item.globalCustomerId" ng-disabled="!item.isPermitted"
+ class="subscriberNameOption">{{item.subscriberName}}
+ </option>
+ </select>
+ <a class="btn btn-primary" ng-click="refreshSubs();"><span
+ class="glyphicon glyphicon-refresh"></span></a>
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td style="width:80%">
+ <div>
+ <button type="submit" class="btn btn-primary" size="small"
+ ng-click="getServiceTypes(selectedCustomer);">Submit
+ </button>
+ </a>
+ <button type="submit" class="btn btn-primary" size="small"
+ ng-click="cancelCreateSI()">Cancel
+ </button>
+ </a>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm index 06a53c3eb..dc9f0a425 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm @@ -31,7 +31,7 @@ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
<h2 class="heading2"><center>Create New Service Instance</center></h2>
- <table>
+ <table class="create-instance-service ">
<tr>
<td >
@@ -69,7 +69,7 @@ </td>
<td style="width:80%">
<div >
- <button type="submit" class="btn btn-primary" size="small" ng-click="getAaiServiceModels(selectedServicetype,createSubscriberName);">Submit</button></a>
+ <button type="submit" class="btn btn-primary" size="small" ng-click="getAaiServiceModels(selectedServicetype,createSubscriberName);" ng-disabled="!selectedServicetype" ng-class="{'button--inactive': !selectedServicetype}">Submit</button></a>
<button type="submit" class="btn btn-primary" size="small" ng-click="cancelCreateSIType()">Cancel</button></a>
</div>
</td>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm index 3471fcb98..686e33b05 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm @@ -27,13 +27,13 @@ <label>Status:</label><span class="status">{{status}}</span>
</div>
- <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+ <div data-tests-id="subDetailsErrMsg" ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
- <h1 class="heading1"><center>Subscriber Details for {{selectedSubscriber}} ({{selectedSubscriberName}})</center></h1>
+ <h1 class="heading1"><center>Subscriber Details for {{selectedSubscriberId}} ({{selectedSubscriberName}})</center></h1>
<br>
<div class="fn-ebz-container">
Filter:
- <input class="fn-ebz-text" type="text" ng-model="searchString" size="20" style="width: 250px;">
+ <input class="fn-ebz-text" type="text" ng-model="searchString" size="20" style="width: 250px;" data-tests-id="filter-subscriber-details">
</div>
<div ng-init="getSubDetails();">
@@ -54,13 +54,13 @@ <tr>
<td att-table-body>
<div>
- <a alt="View/Edit" ng-click="getAsdcModel(disData);" data-tests-id="{{'view/edit-test-data-id-' + disData['serviceInstanceId']}}" ng-bind="disData.isPermitted ? 'View/Edit' : 'View'"></a>
+ <a alt="View/Edit" ng-click="onViewEditClick(disData);" data-tests-id="{{'view/edit-test-data-id-' + disData['serviceInstanceId']}}" ng-bind="disData.isPermitted ? 'View/Edit' : 'View'"></a>
</div>
</td>
<td att-table-body ng-bind="disData['globalCustomerId']"></td>
- <td att-table-body ng-bind="disData['subscriberName']"></td>
+ <td att-table-body ng-bind="disData['subscriberName']" data-tests-id="{{'subscriber-name-test-data-id-' + $index}}"></td>
<td att-table-body ng-bind="disData['serviceType']"></td>
- <td att-table-body ng-bind="disData['serviceInstanceName']"></td>
+ <td att-table-body ng-bind="disData['serviceInstanceName']" data-tests-id="{{'service-name-test-data-id-' + $index}}"></td>
<td att-table-body data-tests-id="{{'instance-id-for-name-' + disData['serviceInstanceName']}}" ng-bind="disData['serviceInstanceId']"></td>
</tr>
</tbody>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm index 40bd1488c..31621cfe5 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm @@ -23,7 +23,7 @@ <div popup-window class="popupContents" ngx-show="{{popup.isVisible}}"
ng-cloak>
<div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"></div>
- <div ng-include="'app/vid/scripts/view-models/deletionDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/deleteResumeDialog.htm'"></div>
<div ng-include="'app/vid/scripts/view-models/detailsDialog.htm'"></div>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm new file mode 100644 index 000000000..6983477e1 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm @@ -0,0 +1,62 @@ +<!-- +============LICENSE_START======================================================= +VID +================================================================================ +Copyright (C) 2017 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========================================================= +--> +<link rel="stylesheet" type="text/css" href="app/vid/styles/networkNode.css"/> + +<div class="network-wrapper-config"> + <div class="head"> + <div class="title">Config {{modelName}}</div> + <div class="btn-wrapper"> + <button class="cancel-btn grey" data-tests-id="cancelButton" data-ng-click="cancel()">Cancel</button> + <button class="next-btn blue" data-tests-id="nextButton" data-ng-disabled="networkNodeForm.$invalid" data-ng-click="next()">Next</button> + </div> + </div> + + <div class="content-wrapper"> + <div class="content"> + <form name="networkNodeForm" class="form-wrapper"> + <div class="instance-field {{field.id}}" ng-repeat="(key, field) in nodeTemplateFields"> + <input id="{{field.id}}" data-tests-id="suppressRollbackInput" ng-if="key === 'suppressRollback'" type="checkbox" ng-model="field.value"/> + <label for="{{field.id}}"class="title" ng-if="key !== 'lineOfBusiness' && key !== 'platform'"> + {{field.name}} + </label> + <div class="" ng-if="key === 'instanceName'"> + <input data-tests-id="instanceNameInput" name="{{field.id}}" id="{{field.id}}" type="text" required ng-model="field.value" ng-pattern="regexInstanceName"> + <span class="error" data-ng-show="!networkNodeForm.instanceName.$error.required && networkNodeForm.instanceName.$dirty && networkNodeForm.instanceName.$invalid">{{errorMsg}}</span> + </div> + <select id="{{field.id}}" data-tests-id="regionDropDown" ng-if="key === 'lcpRegion'" required ng-model="field.value" + placeholder="Choose {{field.name}}" + data-ng-change="setTenant(field)"> + <option value="" selected>LCP region</option> + <option data-ng-disabled="!option.isPermitted" ng-repeat="option in field.optionList" + value="{{option.id}}" data-tests-id="{{'region-' + option.id}}">{{option.id}}</option> + </select> + <select id="{{field.id}}" data-tests-id="tenantDropDown" ng-if="key === 'tenant'" required ng-model="field.value" + data-ng-options="option.tenantName for option in field.optionList" placeholder="Choose {{field.name}}" + data-ng-disabled="!field.optionList || !field.optionList.length"> + <option value="" selected>Tenant name</option> + </select> + </div> + </form> + </div> + <div class="sidebar-right"> + <service-metadata title-txt="info" service-metadata-fields="serviceMetadataFields"></service-metadata> + </div> + </div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html index 0f42ec874..94a1790db 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html @@ -13,63 +13,95 @@ <input type="search" id="change-management-search" class="search-changes" ng-change="vm.searchChanges()" ng-model-options="{debounce: 300}" ng-model="vm.searchChangesTerm" placeholder="Type to search"> </div> + <span class="refresh-cm"> + Last updated at: + <span class="last-time-updated">{{ vm.lastTimeUpdated }}</span> + <i class="icon-sync" data-tests-id="refresh-cm" ng-click="vm.init()"></i> + </span> <div class="jobs-table"> <div class="row"> <div class="col-md-12"> <uib-tabset active="activeJustified" justified="true"> <uib-tab index="0" heading="Active" id="active-tab"> - <table class="table table-bordered" id="active-table"> - <thead class="thead-default"> - <tr> - <th class="col-md-5">VNF Name</th> - <th class="col-md-2">Type</th> - <th class="col-md-2">Flow</th> - <th class="col-md-2">Start time</th> - <th>Status</th> - <th></th> - </tr> - </thead> - <tbody> + <div class="table-wrapper"> + <table class="table table-bordered" data-tests-id="active-table-cm" id="active-table"> + <thead class="thead-default" ng-click="collapseInProgress=!collapseInProgress"> <tr class="table-headline-row"> - <th> + <th > + <span ng-class="{'collapse-icon':!collapseInProgress,'expand-icon':collapseInProgress }"></span> <span id="in-progress-table-head">IN PROGRESS</span> </th> <th></th> <th></th> <th></th> <th></th> - <th></th> </tr> - <tr ng-repeat="changeManagement in vm.changeManagements | changeManagementsByStatuses:{statuses: ['FAILED', 'INPROGRESS', 'PENDING']}"> + <tr ng-show="!collapseInProgress"> + <th class="col-md-5">VNF Name</th> + <th class="col-md-2">Type</th> + <th class="col-md-2">Flow</th> + <th class="col-md-2">Start time</th> + <th>Status</th> + </tr> + </thead> + <tbody ng-show="!collapseInProgress"> + + <tr data-tests-id="active-table-cm-row" ng-repeat="changeManagement in vm.changeManagements | changeManagementsByStatuses:{statuses: ['FAILED', 'IN_PROGRESS', 'PENDING']}"> <th scope="row">{{changeManagement.instanceReferences.vnfInstanceName || 'No-Instance-Name'}}</th> <td>{{changeManagement.requestScope}}</td> <td>{{changeManagement.requestType}}</td> <td>{{changeManagement.startTime}}</td> <td class="centered" ng-if="changeManagement.requestStatus.requestState == 'FAILED'"><span class="icon-x" ng-click="vm.openFailedModal({details: changeManagement.requestStatus.statusMessage, job: changeManagement})"></span></td> - <td class="centered" ng-if="changeManagement.requestStatus.requestState == 'INPROGRESS'"><span class="icon-process" ng-click="vm.openInProgressModal({details: changeManagement.requestStatus.statusMessage, job: changeManagement})"></span></td> + <td class="centered" ng-if="changeManagement.requestStatus.requestState == 'IN_PROGRESS'"><span class="icon-process" ng-click="vm.openInProgressModal({details: changeManagement.requestStatus.statusMessage, job: changeManagement})"></span></td> <td class="centered" ng-if="changeManagement.requestStatus.requestState == 'PENDING'"><span class="icon-alert" ng-click="vm.openAlertModal({details: changeManagement.requestStatus.statusMessage, job: changeManagement})"></span></td> - <td class="centered"><span class="icon-view"></span></td> </tr> - <tr class="table-headline-row"> - <th> - <span id="pending-table-head">PENDING</span> - </th> - <th></th> - <th></th> - <th></th> - <th></th> - <th></th> - </tr> - <tr ng-repeat="changeManagement in vm.pendingChangeManagements"> - <th scope="row">{{changeManagement.vnfName}}</th> - <td>{{changeManagement.scheduleRequest.scheduleName}}</td> - <td>{{changeManagement.workflow}}</td> - <td>{{changeManagement.startTime}}</td> - <td class="centered"><span class="icon-pending" ng-click="vm.openPendingModal({details: 'change management is pending in scheduler and waiting to be deployed'})"></span></td> - <td class="centered"><span class="icon-view"></span></td> + </tbody> + </table> + </div> + <div class="table-wrapper"> + <table class="table table-bordered" data-tests-id="pending-table-cm" id="pending-table"> + <thead ng-click="collapsePending=!collapsePending"> + <tr class="table-headline-row"> + <th class="col-md-6"> + <span ng-class="{'collapse-icon':!collapsePending,'expand-icon':collapsePending }"></span> + <span id="pending-table-head">PENDING</span> + </th> + + <th></th> + <th></th> + <th></th> + <th></th> + <th></th> + <th></th> + <th></th> + </tr> + <tr class="thead-default" ng-show="!collapsePending"> + <th class="col-md-2">Schedule ID</th> + <th class="col-md-2">CM ticket</th> + <th class="col-md-1">VNF name</th> + <th class="col-md-1">VNF status</th> + <th class="col-md-2">Workflow</th> + <th class="col-md-2">Start time</th> + <th class="col-md-2">Schedule status</th> + <th class="col-md-1">Status</th> + </tr> + </thead> + <tbody ng-show="!collapsePending"> + + <tr data-tests-id="pending-table-cm-row" ng-repeat="changeManagement in vm.pendingChangeManagements"> + <th scope="row">{{changeManagement.scheduleRequest.scheduleId}}</th> + <td>{{changeManagement.aotsChangeId}}</td> + <td>{{changeManagement.vnfName}}</td> + <td>{{changeManagement.status}}</td> + <td>{{changeManagement.scheduleRequest.domainData[1].value}}</td> + <td>{{changeManagement.scheduleRequest.createDateTime }}</td><!--| date:"MM/dd/yyyy HH:mm:ss"--> + <td>{{changeManagement.scheduleRequest.status}}</td> + <td class="centered"><span class="cancel-action" ng-class="{'icon-pending':changeManagement.scheduleRequest.status!=='Deleted', 'icon-deleted': changeManagement.scheduleRequest.status=='Deleted'}" + ng-click="vm.openPendingModal($event, changeManagement)"></span></td> </tr> </tbody> </table> + </div> </uib-tab> <uib-tab index="1" heading="Finished" id="finished-tab"> <table class="table table-bordered" id="finished-table"> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm index 0f694612c..da249c2cc 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm @@ -19,6 +19,8 @@ -->
<link rel="stylesheet" type="text/css" href="app/vid/styles/serviceModels.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/styles/buttons.css" />
+
<div popup-window class="popupContents" ngx-show="{{popup.isTablePopUpVisible}}" ng-cloak>
<div ng-include="'app/vid/scripts/view-models/previousVersion.htm'"/>
</div>
@@ -36,7 +38,7 @@ <br><br>
- <table>
+ <table class="create-instance-service ">
<tr>
<td >
@@ -77,7 +79,7 @@ <!-- <h1 class="heading1" style="margin-top:20px;">Browse SDC Service Models</h1> -->
<div style="margin-top:30px" ng-init="getAaiServiceModelsList();">
- <table att-table table-data="services" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <table data-tests-id="services-list" att-table table-data="services" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
<thead att-table-row type="header">
<tr>
<th att-table-header key="action">Action</th>
@@ -100,9 +102,10 @@ <td att-table-body ng-bind="service['extra-properties']['extra-property'][4]['property-value']"></td>
<td att-table-body ng-bind="service['extra-properties']['extra-property'][6]['property-value']"></td>
<td att-table-body ng-show="service['extra-properties']['extra-property'][6]['property-value'] > '1.0' ">
- <button type=button ng-click="loadPreviousVersionData(service['extra-properties']['extra-property'][6]['property-value'],service['extra-properties']['extra-property'][4]['property-value'])" att-button btn-type="primary" size="small">
+ <div class="clickable-text previous-versions-button"
+ ng-click="loadPreviousVersionData(service['extra-properties']['extra-property'][6]['property-value'],service['extra-properties']['extra-property'][4]['property-value'])">
Previous Versions
- </button>
+ </div>
</td>
<td att-table-body ng-show="service['extra-properties']['extra-property'][6]['property-value'] <= '1.0' "> </td>
</tr>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm index 4449285d2..ca13ca2b7 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm @@ -4,7 +4,7 @@ <div class="titleLine">
<img src="app/vid/images/spinner.gif"
ngx-visible="{{isSpinnerVisible}}"></img>
- <h3>Create {{componentName}} -- {{createType}}</h3>
+ <h3 data-tests-id="create-modal-title">Create {{componentName}} -- {{createType}}</h3>
</div>
<div class="error" ng-show="isErrorVisible">
@@ -33,7 +33,7 @@ <div class="buttonRow">
<button data-tests-id="confirmButton" ngx-enabled="{{isConfirmEnabled}}" att-button size="small"
ng-click="confirm();">Confirm</button>
- <button type="button" ng-click="cancel();" att-button
+ <button type="button" data-tests-id="cancelButton" ng-click="cancel();" att-button
btn-type="primary" size="small">Cancel</button>
</div>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deleteResumeDialog.htm index b4b93166b..ccd54a612 100755..100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deleteResumeDialog.htm @@ -1,70 +1,70 @@ -<!--
- ============LICENSE_START=======================================================
- VID
- ================================================================================
- Copyright (C) 2017 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=========================================================
- -->
-
-<div ng-controller="deletionDialogController">
-
- <div ng-show="isDialogVisible">
- <div class="titleLine">
- <img src="app/vid/images/spinner.gif"
- ngx-visible="{{isSpinnerVisible}}"></img>
- <h3>Delete {{componentName}}</h3>
- </div>
-
- <div class="error" ng-show="isErrorVisible">
- <img src="app/vid/images/error.png"></img>{{error}}
- </div>
-
- <parameter-block control="summaryControl"></parameter-block>
-
- <div ngx-visible="{{isDataVisible}}">
-
- <h4>
- User Provided Data (<img class="requiredIndicator"
- src="app/vid/images/asterisk.png" height='10' width='10'></img> indicates required field)
- </h4>
- <parameter-block control="userProvidedControl"
- callback="userParameterChanged(id);" editable></parameter-block>
-
- <div class="prompt">
- <p>
- Enter Data and <span>Confirm</span> to<br />Delete <span>{{componentName}}</span>
- </p>
- <p>
- <span>Cancel</span> to Return to Previous Page.<br />Data entered
- will be lost
- </p>
- </div>
- </div>
-
- <div class="buttonRow">
- <!-- <button type="button" ng-click="confirm();" att-button
- btn-type="primary" size="small" class="confirm">Confirm</button>
- <button type="button" ng-click="cancel();" att-button
- btn-type="primary" size="small">Cancel</button> --->
- <button ngx-enabled="{{isConfirmEnabled}}" att-button size="small"
- ng-click="confirm();">Confirm</button>
- <button type="button" ng-click="cancel();" att-button
- btn-type="primary" size="small">Cancel</button>
- </div>
- </div>
-
- <div ng-include="'app/vid/scripts/view-models/msoCommit.htm'"></div>
-
-</div>
+<!-- + ============LICENSE_START======================================================= + VID + ================================================================================ + Copyright (C) 2017 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========================================================= + --> + +<div ng-controller="deleteResumeDialogController"> + + <div ng-show="isDialogVisible"> + <div class="titleLine"> + <img src="app/vid/images/spinner.gif" + ngx-visible="{{isSpinnerVisible}}"></img> + <h3>{{dialogMethod}} {{componentName}}</h3> + </div> + + <div class="error" ng-show="isErrorVisible"> + <img src="app/vid/images/error.png"></img>{{error}} + </div> + + <parameter-block control="summaryControl"></parameter-block> + + <div ngx-visible="{{isDataVisible}}"> + + <h4> + User Provided Data (<img class="requiredIndicator" + src="app/vid/images/asterisk.png" height='10' width='10'></img> indicates required field) + </h4> + <parameter-block control="userProvidedControl" + callback="userParameterChanged(id);" editable></parameter-block> + + <div class="prompt"> + <p> + Enter Data and <span>Confirm</span> to<br />{{dialogMethod}} <span>{{componentName}}</span> + </p> + <p> + <span>Cancel</span> to Return to Previous Page.<br />Data entered + will be lost + </p> + </div> + </div> + + <div class="buttonRow"> + <!-- <button type="button" ng-click="confirm();" att-button + btn-type="primary" size="small" class="confirm">Confirm</button> + <button type="button" ng-click="cancel();" att-button + btn-type="primary" size="small">Cancel</button> ---> + <button data-tests-id="confirmResumeDeleteButton" ngx-enabled="{{isConfirmEnabled}}" att-button size="small" + ng-click="confirm();">Confirm</button> + <button type="button" ng-click="cancel();" att-button + btn-type="primary" size="small">Cancel</button> + </div> + </div> + + <div ng-include="'app/vid/scripts/view-models/msoCommit.htm'"></div> + +</div> diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm index 71efef1dd..0740c07ef 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm @@ -23,7 +23,7 @@ <div popup-window class="popupContents" ngx-show="{{popup.isVisible}}"
ng-cloak>
<div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"></div>
- <div ng-include="'app/vid/scripts/view-models/deletionDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/deleteResumeDialog.htm'"></div>
<div ng-include="'app/vid/scripts/view-models/detailsDialog.htm'"></div>
<div ng-include="'app/vid/scripts/view-models/statusDialog.htm'"></div>
</div>
@@ -35,7 +35,7 @@ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
- <h1 class="heading1" style="margin-top: 20px;">{{isPermitted == "true" ? "View/Edit" : "View"}} Service Instance</h1>
+ <h1 class="heading1" style="margin-top: 20px;">{{isPermitted ? "View/Edit" : "View"}} Service Instance</h1>
<a class="btn btn-primary btn-xs pull-right" ng-click="reloadRoute();" ><span class="glyphicon glyphicon-refresh"></span></a>
<br>
@@ -47,7 +47,7 @@ {{service.instance.subscriberName}}</th>
<th style="text-align: center" width="34%">SERVICE TYPE:
{{service.instance.serviceType}}</th>
- <th style="text-align: center" width="33%">SERVICE INSTANCE
+ <th data-tests-id="service-instanceId-th-id" style="text-align: center" width="33%">SERVICE INSTANCE
ID: {{service.instance.serviceInstanceId}}</th>
<tr>
<tr>
@@ -64,16 +64,16 @@ <ol ui-tree-nodes="" ng-model="service" >
<li ng-repeat="aService in [service]" ui-tree-node>
<div ui-tree-handle class="tree-node tree-node-content">
- <a class="btn btn-success btn-xs" ng-if="(aService.instance.vnfs && aService.instance.vnfs.length > 0) || (aService.instance.networks && aService.instance.networks.length > 0)" data-nodrag ng-click="this.toggle()">
+ <a class="btn btn-success btn-xs" ng-if="(aService.instance.vnfs && aService.instance.vnfs.length > 0) ||(aService.instance.pnfs && aService.instance.pnfs.length > 0) || (aService.instance.networks && aService.instance.networks.length > 0)" data-nodrag ng-click="this.toggle()">
<span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed,'glyphicon-chevron-down': !collapsed}"></span>
</a>
- SERVICE INSTANCE: {{aService.instance.name}}
- <a ng-if="((isMacro()) || (isObjectEmpty(aService.instance.vnfs) && isObjectEmpty(aService.instance.networks))) && isPermitted" data-tests-id="deleteServiceButton" class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteService(aService.instance);">
+ SERVICE INSTANCE: {{aService.instance.name}} | ORCH STATUS: {{serviceOrchestrationStatus}}
+ <a ng-if="((isMacro()) || (isObjectEmpty(aService.instance.vnfs) && isObjectEmpty(aService.instance.networks) && isObjectEmpty(aService.instance.pnfs))) && isPermitted" data-tests-id="deleteServiceButton" class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteService(aService.instance);">
<span class="glyphicon glyphicon-remove"></span>
</a>
- <div class="pull-right btn-group" ng-if="aService.convertedModel.vnfs && !isObjectEmpty(aService.convertedModel.vnfs) && !aService.convertedModel.isNewFlow && isPermitted">
+ <div class="pull-right btn-group" ng-if="(aService.convertedModel.vnfs||aService.convertedModel.vnfs) &&(!isObjectEmpty(aService.convertedModel.pnfs)||!isObjectEmpty(aService.convertedModel.pnfs)) && !aService.convertedModel.isNewFlow && isPermitted">
<button type="button" data-tests-id="addVNFButton" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- Add VNF<span class="caret"></span>
+ Add node instance<span class="caret"></span>
</button>
<ul class="dropdown-menu" ng-model="aService.convertedModel.vnfs">
<a role="menuitem" ng-repeat="(vnfUuid, vnf) in aService.convertedModel.vnfs" data-tests-id="addVNFOption-{{vnf.modelCustomizationName}}" ng-click="addVnfInstance(vnf, aService.instance.vnfs)">{{vnf.modelCustomizationName}}</a>
@@ -82,7 +82,7 @@ </div>
<div class="pull-right btn-group" ng-if="aService.convertedModel.vnfs && !isObjectEmpty(aService.convertedModel.vnfs) && aService.convertedModel.isNewFlow && isPermitted">
<button type="button" data-tests-id="addVNFButton" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- Add VNF<span class="caret"></span>
+ Add node instance<span class="caret"></span>
</button>
<ul class="dropdown-menu" ng-model="aService.convertedModel.vnfs" data-tests-id="addVnfsDropdown">
<li role="menuitem" ng-repeat="(vnfUuid, vnf) in aService.convertedModel.vnfs">
@@ -91,21 +91,24 @@ </ul>
</div>
<!-- <div class="pull-right btn-group" ng-if="aService.model.networks && !equals(aService.model.networks, {})">-->
- <div class="pull-right btn-group" ng-if="aService.convertedModel.networks && (!(isObjectEmpty(aService.convertedModel.networks)))">
+ <div class="pull-right btn-group" ng-if="aService.convertedModel.networks && (!(isObjectEmpty(aService.convertedModel.networks))) && isPermitted">
<!--<div class="pull-right btn-group" ng-if="aService.model.networks">-->
<button type="button" data-tests-id="addNetworkButton" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Add Network<span class="caret"></span>
</button>
<ul class="dropdown-menu" ng-model="aService.convertedModel.networks">
<li ng-repeat="(networkUuid, network) in aService.convertedModel.networks">
- <a ng-click="addNetworkInstance(network, aService.instance.vnfs)">{{network.modelCustomizationName}}</a>
+ <a data-tests-id="addNetworkOption-{{network.modelCustomizationName}}" ng-click="addNetworkInstance(network, aService.instance.vnfs)">{{network.modelCustomizationName}}</a>
</li>
</ul>
</div>
<a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeService(aService.instance)" style="margin-right: 8px;">
<span class="glyphicon glyphicon-info-sign"></span>
</a>
- <a data-tests-id="activateButton" class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="activateMSOInstance()" style="margin-right: 8px;">
+ <a data-tests-id="deactivateButton" ng-disabled="!isActivateDeactivateEnabled('deactivate')" class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="deactivateMSOInstance()" style="margin-right: 8px;">
+ Deactivate
+ </a>
+ <a data-tests-id="activateButton" ng-disabled="!isActivateDeactivateEnabled('activate')" class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="activateMSOInstance()" style="margin-right: 8px;">
Activate
</a>
</div>
@@ -180,7 +183,7 @@ </a>
VFMODULE: {{vfModule.name}} | TYPE: {{vfModule.nodeType}} | ORCH STATUS: {{vfModule.nodeStatus}}
<!-- -->
- <a class="pull-right btn btn-danger btn-xs" ng-if="isPermitted" data-tests-id="deleteVFModuleButton" data-nodrag ng-click="deleteVfModule(aService.instance, vfModule, vnf)">
+ <a class="pull-right btn btn-danger btn-xs" ng-if="isPermitted" data-tests-id="deleteVFModuleButton-{{vfModule.name}}" data-nodrag ng-click="deleteVfModule(aService.instance, vfModule, vnf)">
<span class="glyphicon glyphicon-remove"></span>
</a>
<div class="pull-right btn-group">
@@ -196,6 +199,12 @@ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeVfModule(aService.instance, vfModule, vnf)" style="margin-right: 8px;">
<span class="glyphicon glyphicon-info-sign"></span>
</a>
+ <div class="resume" ng-if="isPermitted&&(vfModule.nodeStatus==resumeStatus)">
+ <a data-tests-id="resumeVFModuleButton-{{vfModule.name}}" class="pull-right btn btn-success btn-xs button-margin" ng-click="resume(aService.instance, vfModule, vnf)" >
+ Resume
+ </a>
+ </div>
+
</div>
<ol ui-tree-nodes="" ng-model="vfModule.volumeGroups" ng-class="{hidden: collapsed}">
<li ng-repeat="volumeGroup in vfModule.volumeGroups" ui-tree-node>
@@ -227,6 +236,7 @@ </ol>
</li>
</ol>
+
<ol ui-tree-nodes="" ng-model="aService.instance.networks" ng-class="{hidden: collapsed}">
<li ng-repeat="network in aService.instance.networks" ui-tree-node>
<div ui-tree-handle class="tree-node tree-node-content">
@@ -244,6 +254,49 @@ </div>
</li>
</ol>
+
+
+ <ol ui-tree-nodes="" ng-model="aService.instance.configurations" ng-class="{hidden: collapsed}">
+ <li ng-repeat="configuration in aService.instance.configurations" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ <a class="btn btn-success btn-xs" ng-if="(configuration.ports && configuration.ports.length > 0)" data-nodrag ng-click="this.toggle()">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed,'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ CONFIGURATION: {{configuration.name}} | TYPE: {{configuration.nodeType}} | ORCH STATUS: {{configuration.nodeStatus}}
+
+ <a class="pull-right btn btn-danger btn-xs" ng-if="!isMacro() && isPermitted && configuration.nodeStatus === STATUS_CONSTANTS.AAI_INACTIVE" data-tests-id="deleteConfigurationButton" data-nodrag ng-click="deleteConfiguration(aService.instance, configuration)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="toggleConfigurationStatus(aService, configuration)" ng-if="isPermitted && allowConfigurationActions">
+ {{configuration.nodeStatus === STATUS_CONSTANTS.AAI_ACTIVE ? "Deactivate" : "Activate"}}
+ </a>
+ </div>
+ <ol ui-tree-nodes="" ng-model="configuration.ports" ng-class="{hidden: collapsed}">
+ <li ng-repeat="port in configuration.ports" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ PORT: {{port.portName}} | ORCH STATUS: {{port.portStatus}}
+
+ <button type="button" class="pull-right btn btn-primary btn-xs" ng-if="configuration.nodeStatus == STATUS_CONSTANTS.AAI_ACTIVE" ng-click="togglePortStatus(aService, configuration, port)">
+ {{port.portStatus === STATUS_CONSTANTS.AAI_ENABLED ? "Disable" : "Enable"}}
+ </button>
+ </div>
+ </li>
+ </ol>
+ </li>
+ </ol>
+
+ <ol id="pnfs-tree" ui-tree-nodes="" ng-model="pnfs" ng-class="{hidden: collapsed || pnf.length === 0}">
+ <li ng-repeat="pnf in pnfs" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ PNF: {{pnf}}
+
+ <a class="dissociate-pnf pull-right btn btn-primary btn-xs" data-nodrag ng-click="dissociatePnf(pnf)" style="margin-right: 8px;">
+ <span>Dissociate</span>
+ </a>
+ </div>
+ </li>
+ </ol>
</li>
</ol>
</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/messageViewer.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/messageViewer.htm new file mode 100644 index 000000000..67e9248e8 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/messageViewer.htm @@ -0,0 +1,6 @@ +<div class="message-viewer"> + <div ng-include src="icon"></div> + <div class="primaryMessage">{{ primaryMessage }}</div> + <div class="secondaryMessage">{{ secondaryMessage }}</div> + <button data-tests-id="try-again" class="btn btn-primary" ng-if="showTryAgain" ng-click="tryAgain()">TRY AGAIN</button> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm index 48268248b..25a6cf9e0 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm @@ -18,8 +18,8 @@ ============LICENSE_END=========================================================
-->
-<div ng-controller="msoCommitController" ng-show="isViewVisible">
-
+<div ng-controller="msoCommitController" ng-show="isViewVisible" >
+<div ng-if="isViewVisible">
<div class="statusLine">
<img src="app/vid/images/spinner.gif"
ngx-visible="{{isSpinnerVisible}}"> </img> <label>Status:</label><span
@@ -45,3 +45,4 @@ ng-click="close();">Close</button>
</div>
</div>
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/pnfSearchAssociation.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/pnfSearchAssociation.htm new file mode 100644 index 000000000..7c1095e6b --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/pnfSearchAssociation.htm @@ -0,0 +1,62 @@ +<!-- +============LICENSE_START======================================================= +VID +================================================================================ +Copyright (C) 2017 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========================================================= +--> +<link rel="stylesheet" type="text/css" href="app/vid/styles/networkNode.css"/> +<link rel="stylesheet" type="text/css" href="app/vid/styles/pnfSearchAssociation.css"/> +<div ng-controller="pnfSearchAssociationController" class="network-wrapper-config pnf-search-association"> + <div class="head"> + <div class="title">PNF Model: {{modelName}}</div> + <div class="btn-wrapper"> + <button class="cancel-btn grey" data-tests-id="back" data-ng-click="back()">Back</button> + <button class="create-btn blue" data-tests-id="associatePnf" data-ng-disabled="!pnfInstance" data-ng-click="associate()">Associate</button> + </div> + </div> + + <div class="content-wrapper"> + <div class="content"> + <div class="bold" >Unique name of physical network function:</div> + <div class="input-wrapper"> + <input data-tests-id="pnfName" type="search" placeholder="Enter PNF name and click Search" data-ng-model="pnfName" ></input> + <div data-tests-id="searchPnf" class="search2-icon search-input" data-ng-click="searchPnf(pnfName)" data-ng-disabled="!pnfName"></div> + </div> + <div class="result-content margin-search" data-ng-show="pnfInstance"> + <span ng-show="pnfInstance.pnfName">PNF unique name:</span> + <div data-tests-id="pnfInstancePnfName">{{pnfInstance.pnfName}}</div> + <span ng-show="pnfInstance.pnfName2" >PNF name:</span> + <div data-tests-id="pnfInstancePnfName2">{{pnfInstance.pnfName2}}</div> + <span ng-show="pnfInstance.pnfName2Source" >PNF name source:</span> + <div data-tests-id="pnfInstancePnfName2Source">{{pnfInstance.pnfName2Source}}</div> + <span ng-show="pnfInstance.pnfId">PNF ID:</span> + <div data-tests-id="pnfInstancePnfId">{{pnfInstance.pnfId}}</div> + <span ng-show="pnfInstance.equipType">Equipment type:</span> + <div data-tests-id="pnfInstanceEquipType">{{pnfInstance.equipType}}</div> + <span ng-show="pnfInstance.equipVendor">Equipment vendor:</span> + <div data-tests-id="pnfInstanceEquipVendor">{{pnfInstance.equipVendor}}</div> + <span ng-show="pnfInstance.equipModel">Equipment model:</span> + <div data-tests-id="pnfInstanceEquipModel">{{pnfInstance.equipModel}}</div> + + </div> + <div class="error-msg margin-search" data-tests-id="pnfNotFoundErrorMessage" data-ng-show="notFound">The specified PNF instance {{pnfNameNotFound}} does not exist in A&AI. <br/>Please note: A&AI is case sensitive</div> + + </div> + + <div class="sidebar-right"> + <service-metadata title-txt="SERVICE MODEL INFO" service-metadata-fields="serviceMetadataFields"></service-metadata> + </div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/search.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/search.htm new file mode 100644 index 000000000..a0b94fe4a --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/search.htm @@ -0,0 +1,5 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/search.css"/> +<div class="search-container"> + <input type="search" data-tests-id="test-search-input" class="search-input" ng-model="searchString" ng-model-options="{debounce: 300}" placeholder="Type to search"> + <div class="search-icon" ng-include src="'app/vid/images/search.svg'"></div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceMetadata.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceMetadata.htm new file mode 100644 index 000000000..27992d4a4 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceMetadata.htm @@ -0,0 +1,10 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/serviceMetadata.css"/> +<div class="header-title" ng-if="titleTxt"> + {{titleTxt}} +</div> +<div class="metadata-content"> + <div class="field" ng-repeat="field in serviceMetadataFields"> + <label>{{field.name}}</label> + <div class="value" data-tests-id="{{'info-test-data-id-' + field.name.split(' ').join('')}}">{{field.value}}</div> + </div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm index 3cba87196..17b87bfd2 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm @@ -69,8 +69,8 @@ <td att-table-body ng-bind="service['distributionStatus']"></td>
<td att-table-body ng-bind="service['lastUpdaterUserId']"></td>
<td att-table-body ng-bind="service['toscaModelUrl']"></td>
- <td att-table-body ng-show="service['version'] > '1.0' "><button type=button ng-click="loadPreviousVersionData(service['invariantUUID'],service['name'],service['version'])" att-button btn-type="primary" size="small">Previous Versions</button></td>
- <td att-table-body ng-show="service['version'] <= '1.0' "> </td>
+ <td att-table-body ng-show="service.hasPreviousVersion"><button type=button ng-click="loadPreviousVersionData(service['invariantUUID'],service['name'],service['version'])" att-button btn-type="primary" size="small">Previous Versions</button></td>
+ <td att-table-body ng-show="!service.hasPreviousVersion"> </td>
</tr>
</tbody>
</table>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm new file mode 100644 index 000000000..e2261dc11 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm @@ -0,0 +1,108 @@ +<!-- +============LICENSE_START======================================================= +VID +================================================================================ +Copyright (C) 2017 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========================================================= +--> +<link rel="stylesheet" type="text/css" href="app/vid/styles/networkNode.css"/> +<link rel="stylesheet" type="text/css" href="app/vid/styles/serviceProxyConfig.css"/> +<div class="service-wrapper-config network-wrapper-config"> + <div class="head"> + <div class="title">Config {{modelName}}</div> + <div class="btn-wrapper"> + <button class="cancel-btn grey" data-tests-id="backButton" data-ng-click="back()">Back</button> + <button class="create-btn blue" data-tests-id="createButton" data-ng-disabled="proxiesInstanceName.$invalid|| disableCreate" data-ng-click="create()">Create</button> + </div> + </div> + + <div class="content-wrapper"> + <div class="content"> + <div class="diagram"> + <div class="diagram-img"> + <div class="circle service-circle"> + <span class="text">Source<br>Service proxy</span> + </div> + <div class="dotted-line" data-ng-class="{'checked': sourceInstance, 'unchecked': !sourceInstance}"> + <span class="conn-circle sprite" data-tests-id="sourceInstanceSelectedIcon" data-ng-class="{'valid-large': sourceInstance}"></span> + </div> + <div class="circle config-circle"> + <span class="line"></span> + </div> + <div class="dotted-line" data-ng-class="{'checked': collectorInstance, 'unchecked': !collectorInstance}"> + <span class="conn-circle sprite" data-tests-id="collectorInstanceSelectedIcon" data-ng-class="{'valid-large': collectorInstance}"></span> + </div> + <div class="circle service-circle"> + <span class="text">Collector<br>Service proxy</span> + </div> + </div> + <div class="element-name-wrapper"> + <div class="element-name service" data-ng-click="openMetadataModal('sourceMetadata')"> + <span class="label-txt" data-tests-id="sourceInstanceName">{{sourceInstanceName}} <span class="info" data-tests-id="sourceInfoButton">i</span></span> + + </div> + <div class="element-name config"> + <span class="label-txt" data-tests-id="modelName">{{modelName}}</span> + </div> + <div class="element-name service" data-ng-click="openMetadataModal('collectorMetadata')"> + <span class="label-txt" data-tests-id="collectorInstanceName">{{collectorInstanceName}}<span class="info" data-tests-id="collectorInfoButton">i</span></span> + + </div> + </div> + </div> + <form name="proxiesInstanceName" class="bottom"> + <div class="wrapper-list source-vnf"> + <div class="title-txt"><b>Source</b> Service Type</div> + <select ng-model="sourceServiceType" + ng-change="onSourceServiceTypeSelected()" name="sourceServiceType" id="sourceServiceType" + ng-options="item['service-type'] disable when !(item['is-permitted']) for item in serviceTypes" + required data-tests-id="sourceServiceType"> + <option value="" disabled>Select service type</option> + </select> + + <div class="title-txt select-vnf-title">VNF providing <b>source</b> requirements</div> + <select ng-model="sourceInstance" name="source" ng-disabled="sourceInstanceList === null" required data-tests-id="sourceDropDown"> + <option value="" selected>Type/Select VNF name</option> + <option ng-repeat="option in sourceInstanceList" data-tests-id="{{'source-' + option.id}}" + value="{{option.id}}">{{option['properties']['vnf-name']}}</option> + </select> + <span class="no-results" data-tests-id="sourceNoResults" ng-show="sourceNoResults">No vnf instances found.</span> + </div> + + <div class="wrapper-list collector-{{collectorType}}"> + <div class="title-txt ng-hide-keep-block" ng-hide="collectorType==='pnf'"><b>Collector</b> Service Type</div> + <select ng-model="collectorServiceType" ng-hide="collectorType==='pnf'" class="ng-hide-keep-block" + ng-change="onCollectorServiceTypeSelected()" name="collectorServiceType" id="collectorServiceType" + ng-options="item['service-type'] disable when !(item['is-permitted']) for item in serviceTypes" + required data-tests-id="collectorServiceType"> + <option value="" disabled>Select service type</option> + </select> + + <div class="title-txt select-vnf-title">{{collectorType.toUpperCase()}} providing <b>collector</b> requirements</div> + <select ng-model="collectorInstance" name="collector" ng-disabled="collectorInstanceList === null" required data-tests-id="collectorDropDown"> + <option value="" selected>Type/Select {{collectorType.toUpperCase()}} name</option> + <option ng-repeat="option in collectorInstanceList" data-tests-id="{{'collector-' + option.id}}" + value="{{option.id}}">{{option['properties'][collectorType=='vnf' ? 'vnf-name' : 'pnfName']}}</option> + </select> + <span class="no-results" data-tests-id="collectorNoResults" ng-show="collectorNoResults">No {{collectorType}} instances found.</span> + </div> + </form> + </div> + + <div class="sidebar-right"> + <service-metadata title-txt="info" service-metadata-fields="serviceMetadataFields"></service-metadata> + </div> + </div> +</div>
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/testEnvironments.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/testEnvironments.htm new file mode 100644 index 000000000..2c445f8b8 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/testEnvironments.htm @@ -0,0 +1,82 @@ +<link rel="stylesheet" type="text/css" href="app/vid/styles/testEnvironments.css" /> +<link rel="stylesheet" type="text/css" href="app/vid/styles/buttons.css" /> +<div class="test-environments"> + <div class="header"> + <div class="header-left"> + <span data-tests-id="test-environments-headline" class="headline">Test Environments {{vm.total}}</span> + <span class="separator"></span> + <div class="button-container" ng-click="vm.createNewTestEnvironment()"> + <div class="icon-svg" data-tests-id="test-environments-new-button"> + <svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 55.47337 55.63023"><path class="icon-filling" d="M27.7367.07843A27.73669,27.73669,0,1,0,55.4734,27.81512,27.73757,27.73757,0,0,0,27.7367.07843ZM40.18824,29.6178H29.53938V40.26666a1.80267,1.80267,0,0,1-3.60535,0V29.6178H15.28516a1.80267,1.80267,0,0,1,0-3.60535H25.934V15.36359a1.80267,1.80267,0,0,1,3.60535,0V26.01245H40.18824a1.80267,1.80267,0,1,1,0,3.60535Z"/></svg> + </div> + <span class="button-text">Create New</span> + </div> + <span class="separator"></span> + </div> + <search-text data-tests-id="test-environments-search" search-string="vm.searchString"></search-text> + </div> + <div class="error-messages" ng-if="vm.emptyData || vm.connectError"> + <message-viewer data-tests-id="test-environments-no-data" primary-message="No test environment was created yet" secondary-message="create new to start testing" icon="app/vid/images/emptyData.svg" class="no-data" ng-if="vm.emptyData"> + </message-viewer> + <message-viewer data-tests-id="test-environments-error" primary-message="Something went wrong" secondary-message="{{vm.connectError}}" icon="app/vid/images/icon_noconnection.svg" try-again="vm.loadAAIestEnvironments()" class="connect-error" ng-if="vm.connectError"> + </message-viewer> + </div> + <div class="environments-table" ng-if="vm.environments.length"> + <div class="row"> + <div class="col-md-12"> + <button data-tests-id="test-environments-refresh" class="refresh" type="button" ng-click="vm.loadAAIestEnvironments()"> + <div ng-include src="'app/vid/images/refresh.svg'"></div> + </button> + </div> + </div> + + <div class="row"> + <div class="col-md-12 test-environments-table-container"> + <table data-tests-id="test-environments-table" att-table table-data="vm.environments" search-category="searchCategory" search-string="vm.searchString" class="table table-bordered" id="environments-table"> + <thead att-table-row type="header" class="thead-default"> + <tr> + <th att-table-header default-sort="A" key="operationalEnvironmentId">Environment ID</th> + <th att-table-header key="operationalEnvironmentName">Environment Name</th> + <th att-table-header key="relationshipList.relationship[0].relationshipData[0].relationshipValue">ECOMP Environment ID</th> + <th att-table-header key="relationshipList.relationship[0].relatedToProperty[0].propertyValue">ECOMP Environment Name</th> + <th att-table-header key="tenantContext">Tenant Context</th> + <th att-table-header key="operationalEnvironmentType">Environment Type</th> + <th att-table-header key="workloadContext">Workload Context</th> + <th att-table-header sortable="false">Status</th> + <th att-table-header sortable="false">Action</th> + <th att-table-header sortable="false">Attach Manifest</th> + </tr> + </thead> + <tbody att-table-row type="body" row-repeat="environment in vm.environments"> + <tr> + <td att-table-body ng-bind="environment.operationalEnvironmentId"></td> + <td att-table-body ng-bind="environment.operationalEnvironmentName"></td> + <td att-table-body ng-bind="environment.relationshipList.relationship[0].relationshipData? environment.relationshipList.relationship[0].relationshipData[0].relationshipValue: ''"></td> + <td att-table-body ng-bind="environment.relationshipList.relationship[0].relatedToProperty? environment.relationshipList.relationship[0].relatedToProperty[0].propertyValue: ''"></td> + <td att-table-body ng-bind="environment.tenantContext"></td> + <td att-table-body ng-bind="environment.operationalEnvironmentType"></td> + <td att-table-body ng-bind="environment.workloadContext"></td> + <td att-table-body ng-bind="vm.getEnvStatus(environment)" id="testEnvStatus-{{environment.operationalEnvironmentId}}"></td> + <td att-table-body> + <button id="testEnvActivate-{{environment.operationalEnvironmentId}}" type="button" class="blue envActionBtn" + ng-click="vm.onTestEnvActivateClick(environment)" ng-show="!vm.isEnvActive(environment)">Activate</button> + <button id="testEnvDeactivate-{{environment.operationalEnvironmentId}}" type="button" class="blue envActionBtn" + ng-click="vm.onTestEnvDeactivateClick(environment)" ng-show="vm.isEnvActive(environment)">Deactivate</button> + </td> + <td att-table-body> + <button id="testEnvAttach-{{environment.operationalEnvironmentId}}" class="transparent attach-button" + ng-click="vm.onTestEnvActivateClick(environment)" ng-show="vm.isEnvActive(environment)"> + <img src="app/vid/images/attach.svg"> + </button> + </td> + </tr> + </tbody> + </table> + </div> + </div> + </div> +</div> +<div popup-window class="popupContents" ngx-show="{{popup.isVisible}}" + ng-cloak> + <div ng-include="'app/vid/scripts/view-models/msoCommit.htm'"></div> +</div>
\ No newline at end of file |