From 1cfb08779ea0e00be69e072a940b3063e049fe6b Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 31 Jan 2018 17:19:00 +0200 Subject: org.onap migration Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino --- .../vid/scripts/constants/componentConstants.js | 90 +- .../app/vid/scripts/constants/fieldConstants.js | 171 +- .../vid/scripts/constants/parameterConstants.js | 1 + .../webapp/app/vid/scripts/constants/version.json | 1 + .../app/vid/scripts/constants/vidConfiguration.js | 15 +- .../scripts/controller/AddNetworkNodeController.js | 78 + .../scripts/controller/InstantiationController.js | 438 +++-- .../scripts/controller/ServiceModelController.js | 83 +- .../controller/ServiceProxyConfigController.js | 342 ++++ .../webapp/app/vid/scripts/controller/VidApp.js | 29 +- .../scripts/controller/aaiSubscriberController.js | 892 +++++---- .../controller/change-management.controller.js | 75 +- .../controller/deleteResumeDialogController.js | 148 ++ .../scripts/controller/deletionDialogController.js | 123 -- .../vid/scripts/controller/msoCommitController.js | 46 +- .../scripts/controller/msoCommitModalController.js | 237 +++ .../controller/pnfSearchAssociationController.js | 138 ++ .../controller/testEnvironmentsController.js | 102 + .../app/vid/scripts/directives/messageViewer.js | 17 + .../scripts/directives/parameterBlockDirective.js | 43 +- .../directives/parameterBlockDirective.js.orig | 507 ----- .../vid/scripts/directives/progressBarDirective.js | 2 +- .../webapp/app/vid/scripts/directives/search.js | 11 + .../app/vid/scripts/directives/serviceMetadata.js | 34 + .../alert-change-management.html | 2 +- .../modals/alert-modal/alert-modal.controller.js | 33 + .../vid/scripts/modals/alert-modal/alert-modal.css | 15 + .../scripts/modals/alert-modal/alert-modal.html | 15 + .../alert-new-scheduler.controller.js | 33 - .../alert-new-scheduler/alert-new-scheduler.css | 3 - .../alert-new-scheduler/alert-new-scheduler.html | 12 - .../attach-test-env-manifest.controller.js | 58 + .../attach-test-env-manifest.css | 109 ++ .../attach-test-env-manifest.html | 26 + .../cancel-pending-workflow.controller.js | 29 + .../cancel-pending-workflow.css | 16 + .../cancel-pending-workflow.html | 14 + .../failed-change-management.html | 2 +- .../in-progress-change-management.html | 2 +- .../vid/scripts/modals/mso-commit/mso-commit.css | 6 + .../vid/scripts/modals/mso-commit/mso-commit.html | 48 + .../new-change-management.controller.js | 224 ++- .../new-change-management.css | 130 -- .../new-change-management.html | 54 +- .../new-scheduler/new-scheduler.controller.js | 455 ----- .../scripts/modals/new-scheduler/new-scheduler.css | 145 -- .../modals/new-scheduler/new-scheduler.html | 101 - .../new-test-environment.controller.js | 65 + .../new-test-environment/new-test-environment.html | 50 + .../pending-change-management.html | 4 +- .../modals/service-metadata/service-metadata.css | 37 + .../modals/service-metadata/service-metadata.html | 12 + .../vid/scripts/services/OwningEntityService.js | 40 + .../webapp/app/vid/scripts/services/aaiService.js | 213 ++- .../scripts/services/change-management.service.js | 22 +- .../app/vid/scripts/services/componentService.js | 28 +- .../app/vid/scripts/services/creationService.js | 1949 ++++++++++---------- .../webapp/app/vid/scripts/services/dataService.js | 89 +- .../vid/scripts/services/deleteResumeService.js | 518 ++++++ .../app/vid/scripts/services/deletionService.js | 508 ----- .../webapp/app/vid/scripts/services/msoService.js | 373 +++- .../webapp/app/vid/scripts/services/pnfService.js | 43 + .../app/vid/scripts/services/schedulerService.js | 93 +- .../scripts/services/testEnvironmentsService.js | 79 + .../app/vid/scripts/services/utilityService.js | 464 ++--- .../app/vid/scripts/view-models/aaiGetSubs.htm | 53 +- .../scripts/view-models/aaiGetSubscriberList.htm | 102 +- .../vid/scripts/view-models/aaiServiceTypes.htm | 4 +- .../app/vid/scripts/view-models/aaiSubDetails.htm | 12 +- .../app/vid/scripts/view-models/aaiSubViewEdit.htm | 2 +- .../app/vid/scripts/view-models/addNetworkNode.htm | 62 + .../vid/scripts/view-models/change-management.html | 100 +- .../view-models/createInstanceServiceModels.htm | 11 +- .../app/vid/scripts/view-models/creationDialog.htm | 4 +- .../vid/scripts/view-models/deleteResumeDialog.htm | 70 + .../app/vid/scripts/view-models/deletionDialog.htm | 70 - .../app/vid/scripts/view-models/instantiate.htm | 79 +- .../app/vid/scripts/view-models/messageViewer.htm | 6 + .../app/vid/scripts/view-models/msoCommit.htm | 5 +- .../scripts/view-models/pnfSearchAssociation.htm | 62 + .../webapp/app/vid/scripts/view-models/search.htm | 5 + .../vid/scripts/view-models/serviceMetadata.htm | 10 + .../app/vid/scripts/view-models/serviceModels.htm | 4 +- .../vid/scripts/view-models/serviceProxyConfig.htm | 108 ++ .../vid/scripts/view-models/testEnvironments.htm | 82 + 85 files changed, 6304 insertions(+), 4289 deletions(-) create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/constants/version.json create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/deleteResumeDialogController.js delete mode 100755 vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitModalController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/pnfSearchAssociationController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/testEnvironmentsController.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/directives/messageViewer.js delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js.orig create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/directives/search.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/directives/serviceMetadata.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-modal/alert-modal.html delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/attach-test-env-manifest/attach-test-env-manifest.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/cancel-pending-workflow/cancel-pending-workflow.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/mso-commit/mso-commit.html delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css delete mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-test-environment/new-test-environment.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/service-metadata/service-metadata.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/OwningEntityService.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js delete mode 100755 vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/pnfService.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/testEnvironmentsService.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/deleteResumeDialog.htm delete mode 100755 vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/messageViewer.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/pnfSearchAssociation.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/search.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceMetadata.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceProxyConfig.htm create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/testEnvironments.htm (limited to 'vid-app-common/src/main/webapp/app/vid/scripts') 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 534cee50..fa9ff1c7 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 9e3f44cc..d7f429a6 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 693186af..785f3cab 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 00000000..5e843e91 --- /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 6ed410a8..0b69ed55 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 00000000..458da3f7 --- /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 f0653f68..f1dc384c 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 8844d40a..967a3900 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=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;iparseFloat(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 00000000..6e7ad50c --- /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 b611def4..6129fd96 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 a86c1b1b..d58b83f6 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=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 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 00000000..22a20abf --- /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 00000000..f5c3a0e0 --- /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 00000000..8ff67fac --- /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 e57b43ec..d36b3823 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) + ""; break; + case PARAMETER.MULTI_SELECT: + return ''; + 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 += ""; - } } 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 0e937826..00000000 --- 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 = "" - + getNameHtml(parameter) + ""; - if (editable === undefined) { - if (UtilityService.hasContents(parameter.value)) { - html += "" + parameter.value; - } else { - html += ""; - } - } else { - html += "" + getValueHtml(parameter); - } - html += ""; - 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 = ""; - } - 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 = "{: ,\.\.\.,: }"; - } - - if ( parameter.type === PARAMETER.LIST ) { - textInputPrompt = "[,\.\.\.,]"; - } - - switch (parameter.type) { - case PARAMETER.BOOLEAN: - if (parameter.value) { - return "" + "" - + ""; - + ""; - }else{ - return "" + "" - + "" - + ""; - } - break; - case PARAMETER.CHECKBOX: - if (parameter.value) { - return ""; - }else{ - return ""; - } - break; - case PARAMETER.FILE: - return ""; - break; - case PARAMETER.NUMBER: - var value=parameter.value; - var parameterSpec = ""; - } else { - //integer - return ""; - }*/ - return (parameterSpec); - break; - case PARAMETER.SELECT: - if (UtilityService.hasContents(parameter.prompt)) { - attributeString += " prompt='" + parameter.prompt + "'"; - } - return "" + getOptionListHtml(parameter) - + ""; - 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 = ""; - 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 += ""; - } - } - - 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 += ""; - } - else { - html += ""; - } - } - 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 += ""; - } - } - - 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 = ""; - else { - html = ""; - } - } - else { - if(isPermitted) - html = ""; - else { - html = ""; - } - } - 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 : "
", - 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 ed71436b..76585f4b 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 00000000..05ae1211 --- /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 00000000..1c15f703 --- /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 bdc95c98..60596f49 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 @@ - +