From 1ba64a4a45f26e8bdb58e866e540aa58f32e2e52 Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Wed, 20 Sep 2017 14:08:19 +0300 Subject: Change management and PNF support Issue-ID: VID-44, VID-48, VID-49, VID-50, VID-51, VID-52 Change-Id: I83e940aad2e4e294a0927b546c4c08ca8e539a65 Signed-off-by: Ofir Sonsino --- .../vid/scripts/constants/componentConstants.js | 26 +- .../app/vid/scripts/constants/fieldConstants.js | 153 +++---- .../app/vid/scripts/constants/vidConfiguration.js | 10 +- .../scripts/controller/InstantiationController.js | 3 - .../scripts/controller/ServiceModelController.js | 4 +- .../webapp/app/vid/scripts/controller/VidApp.js | 5 + .../scripts/controller/aaiSubscriberController.js | 15 +- .../controller/change-management.controller.js | 138 +++++++ .../directives/angularjs-datetime-picker.js | 361 ++++++++++++++++ .../change-managements-by-statuses.filter.js | 22 + .../webapp/app/vid/scripts/filters/date.filter.js | 18 + .../alert-change-management.css | 3 + .../alert-change-management.html | 12 + .../alert-new-scheduler.controller.js | 33 ++ .../alert-new-scheduler/alert-new-scheduler.css | 3 + .../alert-new-scheduler/alert-new-scheduler.html | 12 + .../change-management-manual-tasks.controller.js | 56 +++ .../change-management-manual-tasks.html | 7 + .../failed-change-management.css | 3 + .../failed-change-management.html | 12 + .../in-progress-change-management.css | 3 + .../in-progress-change-management.html | 12 + .../new-change-management.controller.js | 369 +++++++++++++++++ .../new-change-management.css | 130 ++++++ .../new-change-management.html | 68 +++ .../new-scheduler/new-scheduler.controller.js | 455 +++++++++++++++++++++ .../scripts/modals/new-scheduler/new-scheduler.css | 145 +++++++ .../modals/new-scheduler/new-scheduler.html | 101 +++++ .../pending-change-management.css | 7 + .../pending-change-management.html | 12 + .../webapp/app/vid/scripts/services/aaiService.js | 296 +++++++++----- .../scripts/services/change-management.service.js | 76 ++++ .../app/vid/scripts/services/creationService.js | 4 +- .../webapp/app/vid/scripts/services/msoService.js | 376 ++++++++++------- .../app/vid/scripts/services/schedulerService.js | 104 +++++ .../vid/scripts/view-models/change-management.html | 112 +++++ .../app/vid/scripts/view-models/instantiate.htm | 3 + 37 files changed, 2836 insertions(+), 333 deletions(-) create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/directives/angularjs-datetime-picker.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/filters/date.filter.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css create 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/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css create 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/pending-change-management/pending-change-management.css create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js create mode 100644 vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html (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 f88ee9c3..534cee50 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 @@ -20,7 +20,9 @@ "use strict"; -appDS2.constant("COMPONENT", (function() { +appDS2 + .constant("_", window._) + .constant("COMPONENT", (function() { return { A_LA_CARTE : "a la carte", CLOUD_REGION_ID : "cloudRegionID", @@ -95,16 +97,30 @@ appDS2.constant("COMPONENT", (function() { VPN_ID_1 : "1a2b3c4d5e6f", // PATHS + GET_WORKFLOW: "change-management/workflow?vnfs=@vnfs", + GET_MSO_WORKFLOWS: "change-management/mso", + GET_SCHEDULER_CHANGE_MANAGEMENTS: "change-management/scheduler", ASSIGN : "?r=", AAI_GET_SERVICE_INSTANCE_PATH : "aai_get_service_instance/", AAI_GET_SERVICES : "aai_get_services", AAI_GET_AIC_ZONES :"aai_get_aic_zones", + AAI_GET_AIC_ZONE_FOR_PNF :"aai_get_aic_zone_for_pnf/@globalCustomerId/@serviceType/@serviceInstanceId", 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_VNF_INFO : "aai_get_vnf_information", ASDC_GETMODEL_PATH : "asdc/getModel/", CREATE_INSTANCE_PATH : "/models/services/createInstance", + //1710 scheduler contants + POST_CREATE_NEW_VNF_CHANGE:"post_create_new_vnf_change", + GET_POLICY:"get_policy", + 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", @@ -116,6 +132,7 @@ appDS2.constant("COMPONENT", (function() { 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=", @@ -154,6 +171,13 @@ appDS2.constant("COMPONENT", (function() { "vfmodule" : "VF Module", "vnf" : "VNF", "volumegroup" : "Volume Group" + }, + + MANUAL_TASKS: { + "retry": "retry", + "rollback": "rollback", + "abort": "abort", + "skip": "skip" } }; 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 9d337fa1..9e3f44cc 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 @@ -31,7 +31,7 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { LCP_REGION: "lcpRegion", LCP_REGION_TEXT: "lcpRegionText", PRODUCT_FAMILY: "productFamily", - AIC_ZONES : "aic_zone", + AIC_ZONES: "aic_zone", SERVICE_TYPE: "serviceType", SERVICE_ROLE: "serviceRole", SUBSCRIBER_NAME: "subscriberName", @@ -127,8 +127,8 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { SDN_C_PRELOAD: "sdncPreload", UPLOAD_SUPPLEMENTORY_DATA_FILE: "uploadSupplementoryDataFile", SUPPLEMENTORY_DATA_FILE: "supplementoryDataFile", - ZONE_ID:"zone-id", - ZONE_NAME:"zone-name", + ZONE_ID: "zone-id", + ZONE_NAME: "zone-name", }; @@ -140,57 +140,58 @@ 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", + 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_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" + 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" }; /* @@ -267,29 +268,29 @@ appDS2.factory("FIELD", ["PARAMETER", function (PARAMETER) { } var ERROR = { - AAI : "A&AI failure - see log below for details", - AAI_ERROR : "A&AI Error", - AAI_FETCHING_CUST_DATA : "Failed to fetch customer data from A&AI: Response Code: ", - FETCHING_SERVICE_TYPES : "Failed to fetch service types from A&AI: Response Code: ", - FETCHING_SERVICES : "Failed to fetch services from A&AI: Response Code: ", - FETCHING_SERVICE_INSTANCE_DATA : "Failed to fetch service instance data from A&AI: Response Code: ", - INVALID_INSTANCE_NAME : "Invalid instance name: ", - INSTANCE_NAME_VALIDATE : "The instance name must contain only alphanumeric or \"_-.\" characters, and must start with an alphabetic character", - INVALID_LIST : "Invalid list parameter: ", - INVALID_MAP : "Invalid map parameter: ", - LIST_VALIDATE : "A list parameter value must have the following syntax: '[,\.\.\.,]'", - MAP_VALIDATE : "A map parameter value must have the following syntax: '{ : , \.\.\., : }'", - MAX_POLLS_EXCEEDED : "Maximum number of poll attempts exceeded", - MISSING_DATA : "Missing data", - MODEL_VERSION_ID_MISSING : "Error: model-version-id is not populated in A&AI", - MSO : "MSO failure - see log below for details", - NO_MATCHING_MODEL : "No matching model found matching the persona Model Id = ", - NO_MATCHING_MODEL_AAI : "No matching model found matching the A&AI model version ID = ", - SELECT : "Please select a subscriber or enter a service instance", - SERVICE_INST_DNE : "That service instance does not exist. Please try again.", - SYSTEM_FAILURE : "System failure", - INVALID_DATA_FORMAT : 'Invalid data format.Please check your file content whether it is not in json or not.', - MISSING_FILE : 'Please Select JSON File.', + AAI: "A&AI failure - see log below for details", + AAI_ERROR: "A&AI Error", + AAI_FETCHING_CUST_DATA: "Failed to fetch customer data from A&AI: Response Code: ", + FETCHING_SERVICE_TYPES: "Failed to fetch service types from A&AI: Response Code: ", + FETCHING_SERVICES: "Failed to fetch services from A&AI: Response Code: ", + FETCHING_SERVICE_INSTANCE_DATA: "Failed to fetch service instance data from A&AI: Response Code: ", + INVALID_INSTANCE_NAME: "Invalid instance name: ", + INSTANCE_NAME_VALIDATE: "The instance name must contain only alphanumeric or \"_-.\" characters, and must start with an alphabetic character", + INVALID_LIST: "Invalid list parameter: ", + INVALID_MAP: "Invalid map parameter: ", + LIST_VALIDATE: "A list parameter value must have the following syntax: '[,\.\.\.,]'", + MAP_VALIDATE: "A map parameter value must have the following syntax: '{ : , \.\.\., : }'", + MAX_POLLS_EXCEEDED: "Maximum number of poll attempts exceeded", + MISSING_DATA: "Missing data", + MODEL_VERSION_ID_MISSING: "Error: model-version-id is not populated in A&AI", + MSO: "MSO failure - see log below for details", + NO_MATCHING_MODEL: "No matching model found matching the persona Model Id = ", + NO_MATCHING_MODEL_AAI: "No matching model found matching the A&AI model version ID = ", + SELECT: "Please select a subscriber or enter a service instance", + SERVICE_INST_DNE: "That service instance does not exist. Please try again.", + SYSTEM_FAILURE: "System failure", + INVALID_DATA_FORMAT: 'Invalid data format.Please check your file content whether it is not in json or not.', + MISSING_FILE: 'Please Select JSON 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 4341a4ca..ee33875b 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 @@ -84,6 +84,10 @@ appDS2.constant("VIDCONFIGURATION", (function() { * Number of msecs that VID will wait between MSO polls. */ var MSO_POLLING_INTERVAL_MSECS = 10000; + + var SCHEDULER_POLLING_INTERVAL_MSECS = 10000; + + var SCHEDULER_MAX_POLLS = 10; /* * List of all service model invariant UUIDs that need macro instantiation. * Example: @@ -91,14 +95,16 @@ appDS2.constant("VIDCONFIGURATION", (function() { * */ var COMPONENT_LIST_NAMED_QUERY_ID = "0367193e-c785-4d5f-9cb8-7bc89dc9ddb7"; - var MACRO_SERVICES = ["93150ffa-00c6-4ea0-85f2-3536ca46ebd2", + var MACRO_SERVICES = ["c9514b73-3dfe-4d7e-9146-b318d48655d9", "93150ffa-00c6-4ea0-85f2-3536ca46ebd2", "2b54297f-72e7-4a94-b451-72df88d0be0b", "d27e42cf-087e-4d31-88ac-6c4b7585f800", - "ec0c4bab-c272-4dab-b087-875031bb0c9f","0311f998-9268-4fd6-bbba-afff15087b72"]; + "ec0c4bab-c272-4dab-b087-875031bb0c9f","0311f998-9268-4fd6-bbba-afff15087b72","43596836-ae36-4608-a987-6608ede10dac","306caa85-74c7-48a9-aa22-7e3a564b957a"]; return { ASDC_MODEL_STATUS : ASDC_MODEL_STATUS, MSO_MAX_POLLS : MSO_MAX_POLLS, MSO_POLLING_INTERVAL_MSECS : MSO_POLLING_INTERVAL_MSECS, + SCHEDULER_MAX_POLLS : SCHEDULER_MAX_POLLS, + SCHEDULER_POLLING_INTERVAL_MSECS : SCHEDULER_POLLING_INTERVAL_MSECS, VNF_STATUS_CHECK_ENABLED : VNF_STATUS_CHECK_ENABLED, VNF_VALID_STATUS_LIST : vnfValidStatusList, UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED : UPLOAD_SUPPLEMENTARY_STATUS_CHECK_ENABLED, 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 b0fcb11e..f0653f68 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 @@ -352,9 +352,6 @@ $scope.deleteVnf = function(serviceObject, vnf) { - - debugger; - console.log("Removing VNF " + vnf.name); var serviceInstance = serviceObject.object; 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 731c2f2e..a0030889 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 @@ -39,8 +39,8 @@ $http.get(pathQuery) .then(function successCallback(response) { $scope.services = []; - if (angular.isArray(response.data.services)) { - wholeData = response.data.services; + if (angular.isArray(response.data)) { + wholeData = response.data; $scope.services = $scope.filterDataWithHigerVersion(wholeData); $scope.viewPerPage=10; $scope.totalPage=$scope.services.length/$scope.viewPerPage; 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 dcde2ecc..b611def4 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 @@ -47,6 +47,11 @@ 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('/instantiate', { controller: 'InstantiationController', templateUrl: 'app/vid/scripts/view-models/instantiate.htm' 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 84d27a23..6bf16c34 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", - function (COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, VIDCONFIGURATION, UtilityService, vidService, AaiService) { +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) { $scope.showVnfDetails = function (vnf) { console.log("showVnfDetails"); @@ -901,6 +901,17 @@ appDS2.controller("aaiSubscriberController", ["COMPONENT", "FIELD", "PARAMETER", $scope.currentPage--; } + $scope.activateMSOInstance = function() { + MsoService.activateInstance($scope.service.instance, $scope.service.model) + .then(function(response) { + alert("Activation succeeded"); + }) + .catch(function (error) { + $log.error(error); + }); + ; + }; + $scope.nextPage = function () { $scope.currentPage++; } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js new file mode 100644 index 00000000..662b10ec --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/change-management.controller.js @@ -0,0 +1,138 @@ +(function () { + 'use strict'; + + appDS2.controller("changeManagementController", ["$uibModal", "changeManagementService", "_", "$log", changeManagementController]); + + function changeManagementController($uibModal, changeManagementService, _, $log) { + var vm = this; + + var init = function() { + loadMSOChangeManagements(); + loadSchedulerChangeManagements(); + }; + + var loadMSOChangeManagements = function() { + changeManagementService.getMSOChangeManagements() + .then(function(response) { + vm.changeManagements = response.data; + }) + .catch(function (error) { + $log.error(error); + }); + }; + + var loadSchedulerChangeManagements = function() { + changeManagementService.getSchedulerChangeManagements() + .then(function(response) { + vm.pendingChangeManagements = response.data; + _.forEach(vm.pendingChangeManagements, function(changeManagement) { + var callbackData = _.filter(changeManagement.scheduleRequest.domainData, {name: "CallbackData"}); + if(callbackData) { + var parsedModel = {}; + try { + parsedModel = JSON.parse(callbackData[0].value); + } catch(exception) { + $log.error(exception); + } + + changeManagement.workflow = parsedModel.requestType || 'No workflow'; + } + }); + }) + .catch(function(error) { + $log.error(error); + }); + }; + + vm.createNewChange = function() { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/new-change-management/new-change-management.html', + controller: 'newChangeManagementModalController', + controllerAs: 'vm', + resolve: {} + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the new change management modal.", result); + }); + }; + + vm.openScheduler = function() { + console.log("function for opening the scheduler app") + }; + + vm.searchChanges = function() { + console.log("function for searching changes: " + vm.searchChangesTerm) + }; + + vm.openFailedModal = function(jobInfo) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/failed-change-management/failed-change-management.html', + controller: 'changeManagementManualTasksController', + controllerAs: 'vm', + resolve: { + jobInfo: function () { + return jobInfo; + } + } + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the failed change management modal.", result); + }); + }; + + vm.openInProgressModal = function(jobInfo) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html', + controller: 'changeManagementManualTasksController', + controllerAs: 'vm', + resolve: { + jobInfo: function () { + return jobInfo; + } + } + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the in progress change management modal.", result); + }); + }; + + vm.openAlertModal = function(jobInfo) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/alert-change-management/alert-change-management.html', + controller: 'changeManagementManualTasksController', + controllerAs: 'vm', + resolve: { + jobInfo: function () { + return jobInfo; + } + } + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the alert change management modal.", result); + }); + }; + + vm.openPendingModal = function(jobInfo) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/pending-change-management/pending-change-management.html', + controller: 'changeManagementManualTasksController', + controllerAs: 'vm', + resolve: { + jobInfo: function () { + return jobInfo; + } + } + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the pending change management modal.", result); + }); + }; + + init(); + } +})(); \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/angularjs-datetime-picker.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/angularjs-datetime-picker.js new file mode 100644 index 00000000..b80b4cda --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/angularjs-datetime-picker.js @@ -0,0 +1,361 @@ + + 'use strict'; + + + + var getTimezoneOffset = function(date) { + (typeof date == 'string') && (date = new Date(date)); + var jan = new Date(date.getFullYear(), 0, 1); + var jul = new Date(date.getFullYear(), 6, 1); + var stdTimezoneOffset = Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); + var isDST = date.getTimezoneOffset() < stdTimezoneOffset; + var offset = isDST ? stdTimezoneOffset - 60 : stdTimezoneOffset; + var diff = offset >=0 ? '-' : '+'; + return diff + + ("0"+ (offset / 60)).slice(-2) + ':' + + ("0"+ (offset % 60)).slice(-2); + }; + + var DatetimePicker = function($compile, $document, $controller){ + var datetimePickerCtrl = $controller('DatetimePickerCtrl'); //directive controller + return { + open: function(options) { + datetimePickerCtrl.openDatetimePicker(options); + }, + close: function() { + datetimePickerCtrl.closeDatetimePicker(); + } + }; + }; + DatetimePicker.$inject = ['$compile', '$document', '$controller']; + appDS2.factory('DatetimePicker', DatetimePicker); + + var DatetimePickerCtrl = function($compile, $document) { + var datetimePickerEl; + var _this = this; + var removeEl = function(el) { + el && el.remove(); + $document[0].body.removeEventListener('click', _this.closeDatetimePicker); + }; + + this.openDatetimePicker = function(options) { + this.closeDatetimePicker(); + var div = angular.element('
'); + options.dateFormat && div.attr('date-format', options.dateFormat); + options.ngModel && div.attr('ng-model', options.ngModel); + options.year && div.attr('year', parseInt(options.year)); + options.month && div.attr('month', parseInt(options.month)); + options.day && div.attr('day', parseInt(options.day)); + options.hour && div.attr('hour', parseInt(options.hour)); + options.minute && div.attr('minute', parseInt(options.minute)); + if (options.dateOnly === '' || options.dateOnly === true) { + div.attr('date-only', 'true'); + } + if (options.closeOnSelect === 'false') { + div.attr('close-on-select', 'false'); + } + + var triggerEl = options.triggerEl; + options.scope = options.scope || angular.element(triggerEl).scope(); + datetimePickerEl = $compile(div)(options.scope)[0]; + datetimePickerEl.triggerEl = options.triggerEl; + + $document[0].body.appendChild(datetimePickerEl); + + //show datetimePicker below triggerEl + var bcr = triggerEl.getBoundingClientRect(); + + + options.scope.$apply(); + + var datePickerElBcr = datetimePickerEl.getBoundingClientRect(); + + datetimePickerEl.style.position='absolute'; + if(bcr.width > datePickerElBcr.width){ + datetimePickerEl.style.left= (bcr.left + bcr.width - datePickerElBcr.width + window.scrollX) + 'px'; + } else { + datetimePickerEl.style.left= (bcr.left + window.scrollX) + 'px'; + } + + if (bcr.top < 300 || window.innerHeight - bcr.bottom > 300) { + datetimePickerEl.style.top = (bcr.bottom + window.scrollY) + 'px'; + } else { + datetimePickerEl.style.top = (bcr.top - datePickerElBcr.height + window.scrollY) + 'px'; + } + + $document[0].body.addEventListener('click', this.closeDatetimePicker); + }; + + this.closeDatetimePicker = function(evt) { + var target = evt && evt.target; + var popupEl = $document[0].querySelector('div[datetime-picker-popup]'); + if (evt && target) { + if (target.hasAttribute('datetime-picker')) { // element with datetimePicker behaviour + // do nothing + } else if (popupEl && popupEl.contains(target)) { // datetimePicker itself + // do nothing + } else { + removeEl(popupEl); + } + } else { + removeEl(popupEl); + } + } + }; + DatetimePickerCtrl.$inject = ['$compile', '$document']; + appDS2.controller('DatetimePickerCtrl', DatetimePickerCtrl); + + var tmpl = [ + '
' , + '
', + ' ', + ' {{months[mv.month].shortName}} {{mv.year}}', + ' ', + '
', + '
', + '
{{::dayOfWeek.firstLetter}}
', + '
{{::day}}
', + '
', + ' {{::day}}', + '
', + '
{{::day}}
', + '
', + '
', + ' {{("0"+inputHour).slice(-2)}} : {{("0"+inputMinute).slice(-2)}}
', + ' ', + ' ', + '
', + '
'].join("\n"); + + var datetimePickerPopup = function($locale, dateFilter){ + var days, months, daysOfWeek, firstDayOfWeek; + + var initVars = function() { + days =[], months=[]; daysOfWeek=[], firstDayOfWeek=0; + for (var i = 1; i <= 31; i++) { + days.push(i); + } + + for (var i = 0; i < 12; i++) { //jshint ignore:line + months.push({ + fullName: $locale.DATETIME_FORMATS.MONTH[i], + shortName: $locale.DATETIME_FORMATS.SHORTMONTH[i] + }); + } + + for (var i = 0; i < 7; i++) { //jshint ignore:line + var day = $locale.DATETIME_FORMATS.DAY[(i + firstDayOfWeek) % 7]; + + daysOfWeek.push({ + fullName: day, + firstLetter: day.substr(0, 1) + }); + } + firstDayOfWeek = 0; + }; + + var getMonthView = function(year, month) { + if (month>11) { + year++; + } else if (month < 0) { + year--; + } + month = (month + 12) % 12; + var firstDayOfMonth = new Date(year, month, 1), + lastDayOfMonth = new Date(year, month + 1, 0), + lastDayOfPreviousMonth = new Date(year, month, 0), + daysInMonth = lastDayOfMonth.getDate(), + daysInLastMonth = lastDayOfPreviousMonth.getDate(), + dayOfWeek = firstDayOfMonth.getDay(), + leadingDays = (dayOfWeek - firstDayOfWeek + 7) % 7 || 7, // Ensure there are always leading days to give context + trailingDays = days.slice(0, 6 * 7 - (leadingDays + daysInMonth)); + if (trailingDays.length > 7) { + trailingDays = trailingDays.slice(0, trailingDays.length-7); + } + + return { + year: year, + month: month, + days: days.slice(0, daysInMonth), + leadingDays: days.slice(- leadingDays - (31 - daysInLastMonth), daysInLastMonth), + trailingDays: trailingDays + }; + }; + + var linkFunc = function(scope, element, attrs, ctrl) { //jshint ignore:line + initVars(); //initialize days, months, daysOfWeek, and firstDayOfWeek; + var dateFormat = attrs.dateFormat || 'short'; + scope.months = months; + scope.daysOfWeek = daysOfWeek; + scope.inputHour; + scope.inputMinute; + + if (scope.dateOnly === true){ + element[0].querySelector('#adp-time').style.display = 'none'; + } + + scope.$applyAsync( function() { + ctrl.triggerEl = angular.element(element[0].triggerEl); + if (attrs.ngModel) { // need to parse date string + var dateStr = ''+ctrl.triggerEl.scope().$eval(attrs.ngModel); + if (dateStr) { + if (!dateStr.match(/[0-9]{2}:/)) { // if no time is given, add 00:00:00 at the end + dateStr += " 00:00:00"; + } + dateStr = dateStr.replace(/([0-9]{2}-[0-9]{2})-([0-9]{4})/,'$2-$1'); //mm-dd-yyyy to yyyy-mm-dd + dateStr = dateStr.replace(/([\/-][0-9]{2,4})\ ([0-9]{2}\:[0-9]{2}\:)/,'$1T$2'); //reformat for FF + dateStr = dateStr.replace(/EDT|EST|CDT|CST|MDT|PDT|PST|UT|GMT/g,''); //remove timezone + dateStr = dateStr.replace(/\s*\(\)\s*/,''); //remove timezone + dateStr = dateStr.replace(/[\-\+][0-9]{2}:?[0-9]{2}$/,''); //remove timezone + dateStr += getTimezoneOffset(dateStr); + var d = new Date(dateStr); + scope.selectedDate = new Date( + d.getFullYear(), + d.getMonth(), + d.getDate(), + d.getHours(), + d.getMinutes(), + d.getSeconds() + ); + } + } + + if (!scope.selectedDate || isNaN(scope.selectedDate.getTime())) { // no predefined date + var today = new Date(); + var year = scope.year || today.getFullYear(); + var month = scope.month ? (scope.month-1) : today.getMonth(); + var day = scope.day || today.getDate(); + var hour = scope.hour || today.getHours(); + var minute = scope.minute || today.getMinutes(); + scope.selectedDate = new Date(year, month, day, hour, minute, 0); + } + scope.inputHour = scope.selectedDate.getHours(); + scope.inputMinute = scope.selectedDate.getMinutes(); + + // Default to current year and month + scope.mv = getMonthView(scope.selectedDate.getFullYear(), scope.selectedDate.getMonth()); + scope.today = dateFilter(new Date(), 'yyyy-M-d'); + if (scope.mv.year == scope.selectedDate.getFullYear() && scope.mv.month == scope.selectedDate.getMonth()) { + scope.selectedDay = scope.selectedDate.getDate(); + } else { + scope.selectedDay = null; + } + }); + +/* disable previous months.not current months + scope.addMonth = function (amount) { + var today = new Date(); + if((amount==-1) && (scope.mv.month==today.getMonth())){ + + + } + else{ + + scope.mv = getMonthView(scope.mv.year, scope.mv.month + amount); + } + };*/ + + scope.addMonth = function (amount) { + scope.mv = getMonthView(scope.mv.year, scope.mv.month + amount); + }; + + scope.setDate = function (evt) { + + var target = angular.element(evt.target)[0]; + if (target.className.indexOf('selectable') !== -1) { + scope.updateNgModel(parseInt(target.innerHTML)); + if (scope.closeOnSelect !== false) { + ctrl.closeDatetimePicker(); + } + } + }; + + scope.updateNgModel = function(day) { + day = day ? day : scope.selectedDate.getDate(); + scope.selectedDate = new Date( + scope.mv.year, scope.mv.month, day, scope.inputHour, scope.inputMinute, 0 + ); + scope.selectedDay = scope.selectedDate.getDate(); + if (attrs.ngModel) { + //console.log('attrs.ngModel',attrs.ngModel); + var elScope = ctrl.triggerEl.scope(), dateValue; + if (elScope.$eval(attrs.ngModel) && elScope.$eval(attrs.ngModel).constructor.name === 'Date') { + dateValue = new Date(dateFilter(scope.selectedDate, dateFormat)); + } else { + dateValue = dateFilter(scope.selectedDate, dateFormat); + } + elScope.$eval(attrs.ngModel + '= date', {date: dateValue}); // this line for have the date in the format of mm/dd/yyyy + // elScope.$eval(attrs.ngModel + '= date', {date: scope.selectedDate});// this line in the format of Thu Jul 20 2017 23:59:00 GMT-0400 (Eastern Daylight Time) + } + }; + + scope.$on('$destroy', ctrl.closeDatetimePicker); + }; + + return { + restrict: 'A', + template: tmpl, + controller: 'DatetimePickerCtrl', + replace: true, + scope: { + year: '=', + month: '=', + day: '=', + hour: '=', + minute: '=', + dateOnly: '=', + closeOnSelect: '=', + futureOnly:'=' + }, + link: linkFunc + }; + }; + datetimePickerPopup.$inject = ['$locale', 'dateFilter']; + appDS2.directive('datetimePickerPopup', datetimePickerPopup); + + var datetimePicker = function($parse, DatetimePicker) { + return { + // An ngModel is required to get the controller argument + require: 'ngModel', + link: function(scope, element, attrs, ctrl) { + // Attach validation watcher + scope.$watch(attrs.ngModel, function(value) { + if( !value || value == '' ){ + return; + } + // The value has already been cleaned by the above code + var date = new Date(value); + ctrl.$setValidity('date', !date? false : true); + var now = new Date(); + if( attrs.hasOwnProperty('futureOnly') ){ + ctrl.$setValidity('future-only', date < now? false : true); + } + }); + + element[0].addEventListener('click', function() { + DatetimePicker.open({ + triggerEl: element[0], + dateFormat: attrs.dateFormat, + ngModel: attrs.ngModel, + year: attrs.year, + month: attrs.month, + day: attrs.day, + hour: attrs.hour, + minute: attrs.minute, + dateOnly: attrs.dateOnly, + futureOnly: attrs.futureOnly, + closeOnSelect: attrs.closeOnSelect + }); + }); + } + }; + }; + datetimePicker.$inject=['$parse', 'DatetimePicker']; + appDS2.directive('datetimePicker', datetimePicker); + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js new file mode 100644 index 00000000..6f0ae2c6 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/filters/change-managements-by-statuses.filter.js @@ -0,0 +1,22 @@ +(function () { + 'use strict'; + appDS2.filter('changeManagementsByStatuses', [changeManagementsByStatuses]); + + function changeManagementsByStatuses () { + return function(changeManagements, metadata) { + var result = []; + if(changeManagements && metadata && metadata.statuses) { + angular.forEach(changeManagements, function(changeManagement) { + angular.forEach(metadata.statuses, function(status) { + if(changeManagement.requestStatus.requestState === status) { + result.push(changeManagement); + return; + } + }); + }); + } + + return result; + } + } +})(); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/filters/date.filter.js b/vid-app-common/src/main/webapp/app/vid/scripts/filters/date.filter.js new file mode 100644 index 00000000..3b2eb183 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/filters/date.filter.js @@ -0,0 +1,18 @@ +(function () { + 'use strict'; + appDS2.filter('vidDate', ['$filter', vidDate]); + + function vidDate($filter) { + var suffixes = ["th", "st", "nd", "rd"]; + return function(input, format) { + if(input) { + var dtfilter = $filter('date')(input, format); + var day = parseInt($filter('date')(input, 'dd')); + var relevantDigits = (day < 30) ? day % 20 : day % 30; + var suffix = (relevantDigits <= 3) ? suffixes[relevantDigits] : suffixes[0]; + return dtfilter.replace('oo', suffix); + } + return input; + }; + } +})(); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.css new file mode 100644 index 00000000..316c2e46 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.css @@ -0,0 +1,3 @@ +.modal-header h3 { + border-bottom: 3px solid #ffb81c; +} \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html new file mode 100644 index 00000000..bdc95c98 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-change-management/alert-change-management.html @@ -0,0 +1,12 @@ + + + + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js new file mode 100644 index 00000000..2c5eabed --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.controller.js @@ -0,0 +1,33 @@ +(function () { + 'use strict'; + + appDS2.controller("alertNewSchedulerController", ["$uibModalInstance", "jobInfo", "MsoService", "COMPONENT", + "$log", alertNewSchedulerController]); + + function alertNewSchedulerController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log) { + var vm = this; + + vm.manualTasks = []; + vm.MANUAL_TASKS = COMPONENT.MANUAL_TASKS; + var init = function() { + if (jobInfo) { + vm.content = jobInfo; + } else { + vm.content = "Successfully"; + } + + + + }; + + + + + + vm.close = function () { + $uibModalInstance.close(); + }; + + init(); + } +})(); \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css new file mode 100644 index 00000000..316c2e46 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.css @@ -0,0 +1,3 @@ +.modal-header h3 { + border-bottom: 3px solid #ffb81c; +} \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html new file mode 100644 index 00000000..e6255cf3 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js new file mode 100644 index 00000000..91bac569 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.controller.js @@ -0,0 +1,56 @@ +(function () { + 'use strict'; + + appDS2.controller("changeManagementManualTasksController", ["$uibModalInstance", "jobInfo", "MsoService", "COMPONENT", + "$log", changeManagementManualTasksController]); + + function changeManagementManualTasksController($uibModalInstance, jobInfo, MsoService, COMPONENT, $log) { + var vm = this; + + vm.manualTasks = []; + vm.MANUAL_TASKS = COMPONENT.MANUAL_TASKS; + var init = function() { + if (jobInfo && jobInfo.details) { + vm.content = jobInfo.details; + } else { + vm.content = "The VNF change alerted due to unknown reason."; + } + + loadAvailableTasks(jobInfo.job.requestId); + + }; + + function loadAvailableTasks(requestId) { + MsoService.getManualTasks(requestId) + .then(function(response) { + vm.task = response.data[0]; + vm.manualTasks = vm.task && vm.task.validResponses; + }) + .catch(function(error) { + $log.error(error); + }); + } + + vm.completeTask = function(task) { + MsoService.completeTask(vm.task.taskId, task) + .then(function(response) { + vm.manualTasks = response.data; + $uibModalInstance.close(task + " action completed successfully."); + }) + .catch(function(error) { + $uibModalInstance.close(task + " action failed."); + $log.error(error); + }); + }; + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.isTaskAvailable = function(task) { + return vm.manualTasks.includes(task); + }; + + init(); + } +})(); \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html new file mode 100644 index 00000000..68739415 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/change-management-manual-tasks-controller/change-management-manual-tasks.html @@ -0,0 +1,7 @@ +
+ +
+ diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.css new file mode 100644 index 00000000..fb4a06c7 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.css @@ -0,0 +1,3 @@ +.modal-header h3 { + border-bottom: 3px solid #cf2a2a; +} \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html new file mode 100644 index 00000000..0deaf93d --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/failed-change-management/failed-change-management.html @@ -0,0 +1,12 @@ + + + + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css new file mode 100644 index 00000000..02a0df47 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.css @@ -0,0 +1,3 @@ +.modal-header h3 { + border-bottom: 3px solid #4ca90c; +} \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html new file mode 100644 index 00000000..9b40db2a --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/in-progress-modal-management/in-progress-change-management.html @@ -0,0 +1,12 @@ + + + + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js new file mode 100644 index 00000000..14ca43b5 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -0,0 +1,369 @@ +(function () { + 'use strict'; + + appDS2.controller("newChangeManagementModalController", ["$uibModalInstance", "$uibModal", "AaiService", "changeManagementService", + "$log", "$scope", "_", newChangeManagementModalController]); + + function newChangeManagementModalController($uibModalInstance, $uibModal, AaiService, changeManagementService, $log, $scope, _) { + var vm = this; + + var init = function () { + vm.changeManagement = {}; + + loadServicesCatalog(); + registerVNFNamesWatcher(); + vm.loadSubscribers(); + }; + + var loadServicesCatalog = function () { + changeManagementService.getAllSDCServices() + .then(function (response) { + vm.SDCServicesCatalog = response.data; + }) + .catch(function (error) { + $log.error(error); + }) + }; + + var registerVNFNamesWatcher = function () { + $scope.$watch('vm.changeManagement.vnfNames', function (newVal, oldVal) { + if (!oldVal || newVal && newVal.length > oldVal.length) { //JUST THE LAST ONE ADDED + var newVNFName = _.last(vm.changeManagement.vnfNames); + if (oldVal) { + vm.changeManagement.vnfNames = oldVal; + vm.changeManagement.vnfNames.push(newVNFName); + } + if (newVNFName && newVNFName["service-instance-node"]) { + var availableVersions = []; + var services = _.filter(vm.SDCServicesCatalog.services, + {"invariantUUID": newVNFName["service-instance-node"][0].properties["model-invariant-id"]}); + + _.each(services, function (service) { + changeManagementService.getSDCService(service.uuid) + .then(function (response) { + _.each(response.data.vnfs, function (vnf) { + if (newVNFName["invariant-id"] === vnf.invariantUuid) { + availableVersions.push(extractVNFModel(vnf, response.data.service, newVNFName)); + } + }); + var versions = _.uniqBy(availableVersions, ['modelInfo.modelVersion']); + newVNFName.availableVersions = _.uniq(versions, response.data.service, true); + }).catch(function (error) { + $log.error(error); + }); + }); + } + } + }, true); + }; + + var extractVNFModel = function (csarVNF, sdcService, selectionVNF) { + var versionCsarData = { + vnfInstanceId: "", + vnfName: csarVNF.name, + modelInfo: { + modelType: "vnf", + modelInvariantId: csarVNF.invariantUuid, + modelVersionId: selectionVNF.modelVersionId, + modelName: csarVNF.name, + modelVersion: csarVNF.version, + modelCustomizationName: csarVNF.modelCustomizationName, + modelCustomizationId: csarVNF.customizationUuid + }, + cloudConfiguration: { + lcpCloudRegionId: "mdt1", + tenantId: "88a6ca3ee0394ade9403f075db23167e" + }, + requestInfo: { + source: "VID", + suppressRollback: false, + requestorId: "az2016" + }, + relatedInstanceList: [ + { + relatedInstance: { + instanceId: selectionVNF["service-instance-node"]["0"].properties['service-instance-id'], + modelInfo: { + modelType: "service", + modelInvariantId: selectionVNF["service-instance-node"]["0"].properties['model-invariant-id'], + modelVersionId: selectionVNF.modelVersionId, + modelName: sdcService.name, + modelVersion: sdcService.version, + modelCustomizationName: selectionVNF["service-instance-node"]["0"].properties['model-customization-name'], //TODO: Missing + modelCustomizationId: selectionVNF["service-instance-node"]["0"].properties['model-customization-id'] + } + } + } + ], + requestParameters: { + usePreload: true + } + }; + + return versionCsarData; + }; + + vm.close = function () { + $uibModalInstance.close(); + }; + + vm.schedule = function () { + $uibModalInstance.close(vm.changeManagement); + + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/new-scheduler/new-scheduler.html', + controller: 'newSchedulerController', + controllerAs: 'vm', + resolve: { + changeManagement: function () { + return vm.changeManagement; + } + } + }); + + modalInstance.result.then(function (result) { + console.log("This is the result of the new change management modal.", result); + }) + }; + + vm.loadSubscribers = function () { + vm.subscribers = []; + AaiService.getSubscribers(function (response) { + vm.subscribers = response; + }); + }; + + vm.loadServiceTypes = function () { + vm.serviceTypes = []; + + AaiService.getSubscriberServiceTypes(vm.changeManagement.subscriberId) + .then(function (response) { + vm.serviceTypes = response.data; + }) + .catch(function (error) { + $log.error(error); + }); + }; + + vm.loadVNFTypes = function () { + vm.vnfTypes = []; + vm.vnfTypesTemp = []; + vm.serviceInstances = []; + + var instances = vm.changeManagement.serviceType["service-instances"]["service-instance"]; + // var promiseArrOfGetVnfs = preparePromiseArrOfGetVnfs(instances); + + vm.vnfs = []; + + AaiService.getVnfsByCustomerIdAndServiceType( + vm.changeManagement.subscriberId, + vm.changeManagement.serviceType["service-type"] + ).then(function (response) { + var vnfsData = response.data.results; + if (vnfsData) { + for (var i = 0; i < vnfsData.length; i++) { + if (vnfsData[i]) { + const nodeType = vnfsData[i]['node-type']; + if (nodeType === "generic-vnf") { + _.forEach(vnfsData[i]['related-to'], function (node) { + if (node['node-type'] === 'vserver') { + vm.vnfs.push(vnfsData[i]); + } + }) + } else if (nodeType === "service-instance") { + vm.serviceInstances.push(vnfsData[i]); + } + } + } + + vm.vnfs = _.flattenDeep( + _.remove(vm.vnfs, function (vnf) { + var nfRole = vnf.properties['nf-role']; + if (nfRole !== undefined) { + return nfRole !== 'null' && nfRole !== ''; + } + }) + ); + + var filteredVnfs = _.uniqBy(vm.vnfs, function (vnf) { + return vnf.properties['nf-role']; + }); + + _.forEach(filteredVnfs, function (vnf) { + vm.vnfTypes.push(vnf.properties['nf-role']) + }); + } + } + ); + }; + + vm.loadVNFVersions = function () { + vm.fromVNFVersions = []; + vm.serviceInstancesToGetVersions = []; + var versions = []; + _.forEach(vm.vnfs, function (vnf) { + if (vnf.properties['nf-role'] === vm.changeManagement['vnfType']) { + + vm.serviceInstancesToGetVersions.push(vnf); + + versions.push(vnf.properties["model-invariant-id"]); + + + } + }); + + AaiService.getVnfVersionsByInvariantId(versions).then(function (response) { + if (response.data) { + var key = response.data.model["0"]["model-invariant-id"]; + var value = response.data.model["0"]["model-vers"]["model-ver"]["0"]["model-version"]; + var element = {"key": key, "value": value}; + vm.fromVNFVersions.push(element); + } + //TODO promise all and call the new api to get the versions. + // vm.fromVNFVersions.push(response.data.model["0"]["model-vers"]["model-ver"]["0"]["model-version"]); + // if(vm.serviceInstancesToGetVersions.length > 0){ + // + // var promiseArrOfGetVnfs = preparePromiseArrOfGetVersions('a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb'); + // + // Promise.all(promiseArrOfGetVnfs).then(function (allData) { + // vm.vnfs = _.flattenDeep(_.without(allData, null)); + // var filteredVnfs = _.sortedUniqBy(vm.vnfs, function (vnf) { + // return vnf.properties.vnfType; + // }); + // + // _.forEach(filteredVnfs, function (vnf) { + // vm.vnfTypes.push(vnf.properties.vnfType) + // }); + // + // }).catch(function (error) { + // $log(error); + // }); + // } + }) + // debugger; + + }; + + // function preparePromiseArrOfGetVersions(serviceInstances) { + // var promiseArr = []; + // for (var i = 0; i < serviceInstances.length; i++) { + // var modelInvariantId = serviceInstances[i].properties["model-invariant-id"]; + // promiseArr.push( + // getVnfs(modelInvariantId) + // ); + // } + // return promiseArr; + // } + + function getVnfs(modelInvariantId) { + return new Promise(function (resolve, reject) { + AaiService.getVnfVersionsByInvariantId(modelInvariantId) + .then(function (response) { + if (response.data.httpCode !== null && + response.data.httpCode === 200) { + var vnfsData = response.data.t.results; + for (var i = 0; i < vnfsData.length; i++) { + if (vnfsData[i]) { + if (vnfsData[i].nodeType === "generic-vnf") { + resolve(vnfsData[i]); + } else if (vnfsData[i].nodeType === "service-instance") { + vm.serviceInstances.push(vnfsData[i]); + } + } + } + resolve(null); + } + resolve(null); + }) + .catch(function (error) { + reject(error); + }); + }); + } + + vm.loadVNFNames = function () { + vm.vnfNames = []; + + _.forEach(vm.vnfs, function (vnf) { + + if (vnf.properties['nf-role'] === vm.changeManagement.vnfType) { + var vServer = {}; + + _.forEach(vnf['related-to'], function (node) { + if (node['node-type'] === 'vserver') { + vServer = extractLcpRegionIdAndTenantId(node.url); + } + }); + + vm.vnfNames.push({ + "id": vnf.properties["vnf-id"], + "name": vnf.properties["vnf-name"], + "invariant-id": vnf.properties["model-invariant-id"], + "service-instance-node": _.filter(vm.serviceInstances, {id: vnf["related-to"][0].id}), + "modelVersionId": vnf.properties["model-version-id"], + "properties": vnf.properties, + 'cloudConfiguration': vServer, + "relatedTo": vnf['related-to'] + }); + } + }); + }; + + function extractLcpRegionIdAndTenantId(url) { + + var cloudConfiguration = { + lcpCloudRegionId: '', + tenantId: '' + }; + + var splitedUrlByDash = _.split(url, '/', 100); + + cloudConfiguration.lcpCloudRegionId = splitedUrlByDash[7]; + cloudConfiguration.tenantId = splitedUrlByDash[10]; + + return cloudConfiguration; + }; + + vm.loadWorkFlows = function () { + var vnfs = []; + angular.forEach(vm.changeManagement.vnfNames, function (vnfName) { + vnfs.push(vnfName.name) + }); + + //TODO: When we'll have the mappings, use the backend call to get the workflows + // changeManagementService.getWorkflows(vnfs) + // .then(function(response) { + // vm.workflows = response.data; + // }) + // .catch(function(error) { + // $log.error(error); + // }); + + vm.workflows = ["Update", "Replace"]; + }; + + //Must be $scope because we bind to the onchange of the html (cannot attached to vm variable). + $scope.selectFileForVNFName = function (fileInput) { + if (fileInput && fileInput.id) { + var vnfName = _.filter(vm.changeManagement.vnfNames, {"invariant-id": fileInput.id}); + var file = fileInput.files[0]; + var fileReader = new FileReader(); + fileReader.onload = function (load) { + try { + var lines = load.target.result; + vnfName[0].selectedFile = JSON.parse(lines); + } catch (error) { + $log.error(error); + } + }; + fileReader.readAsText(file); + } + }; + + vm.selectVersionForVNFName = function (vnfName) { + console.log("Will add version for selected vnf name: " + vnfName.name); + }; + + init(); + } +})(); \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css new file mode 100644 index 00000000..9d270987 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css @@ -0,0 +1,130 @@ +.btn-white { + font-family: "Open Sans"; + border-radius: 2px; + border: 1px solid #d8d8d8; + background-color: #ffffff; + width: 94px; + height: 30px; + color: #5a5a5a; + font-size: 13px; + font-weight: 400; + line-height: 36px; + text-align: center; + padding: 4px 12px !important; +} + +.btn-primary { + font-family: "Open Sans"; + border-radius: 2px; + border: 1px solid #0091c8; + background-color: #009fdb; + width: 94px; + height: 30px; + color: #ffffff; + font-size: 13px; + font-weight: 400; + line-height: 36px; + text-align: center; + padding: 4px 12px !important; +} + +.modal-header { + border: none!important; + padding: 15px 15px 0px 15px!important; +} + +.modal-header h3 { + font-family: "Open Sans"; + color: #191919; + font-size: 22px; + font-weight: 300; + line-height: 16px; + padding-bottom: 20px; + border-bottom: 3px solid #009fdb; + +} + +.control-label { + font-family: "Open Sans"; + color: #5a5a5a; + font-size: 13px; + font-weight: 400; +} + +.modal-footer { + background-color: #eaeaea; +} + +.modal-dialog { + width: 587px; + border-radius: 8px; +} + +.modal-content { + width: 587px; + border-radius: 8px; + background-color: #ffffff; +} + +button.dropdown-toggle { + text-align: left; +} + +button[disabled].dropdown-toggle { + opacity: 1; + cursor: not-allowed; + background-color: #eee; + border: 1px solid #aaa; + color: #a0a0a0; +} + +multiselect[disabled] { + cursor: not-allowed; +} + +a.item-unselected:before { + font-family: "icomoon"!important; + content: "\e90c"; + color: #4ca90c; +} + +.modal-close { + margin: -40px 5px 0 0; + color: #5a5a5a; + font-size: 20px; + cursor: pointer; +} + +.vnf-versions-container .table { + position: relative; + background-color: #f8f8f8; + background-clip: padding-box; + border-radius: 6px; + outline: 0; +} + +.vnf-versions-name { + padding-top: 6px; + font-family: "Open Sans"; + position: absolute; +} + +.vnf-versions-select-as-text { + font-family: "Open Sans"; + appearance: none; + -webkit-appearance: none; + -moz-appearance: none; + border: none; + overflow:hidden; + background-color: #f8f8f8; + height: 31px; +} + +.vnf-files-select { + z-index: 999; + opacity: 0.0; + position: absolute; + width: 23%; + cursor: pointer; + height:100%; +} diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html new file mode 100644 index 00000000..71c7eb33 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html @@ -0,0 +1,68 @@ + + +
+ + +
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js new file mode 100644 index 00000000..c8f44c71 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.controller.js @@ -0,0 +1,455 @@ +(function () { + 'use strict'; + + appDS2.controller("newSchedulerController", ["$scope", "$uibModal", "$uibModalInstance", "AaiService", "SchedulerService", "_", + "$log", "changeManagement", "$timeout", "$interval", "$filter", "VIDCONFIGURATION", "changeManagementService", newSchedulerController]); + + function newSchedulerController($scope, $uibModal, $uibModalInstance, AaiService, SchedulerService, _, $log, changeManagement, $timeout, $interval, $filter, VIDCONFIGURATION, changeManagementService) { + var vm = this; + var pollpromise; + + var init = function () { + vm.scheduler = {}; + vm.schedulingInfo = {}; + var callbackData = extractChangeManagementCallbackDataStr(changeManagement); + vm.vnfObject = changeManagement; + vm.schedulerObj = { + domain: 'ChangeManagement', + scheduleId: '', + scheduleName: 'VnfUpgrade/DWF', + userId: '', + domainData: [{ + 'WorkflowName': vm.scheduler.policy, + 'CallbackUrl': 'http://127.0.0.1:8989/scheduler/v1/loopbacktest/vid', + 'CallbackData': callbackData + }], + + schedulingInfo: { + normalDurationInSeconds: '', + additionalDurationInSeconds: '', + concurrencyLimit: '', + policyId: '', + vnfDetails: [ + { + groupId: "", + node: [], + changeWindow: [{ + startTime: '', + endTime: '' + }] + + } + ] + }, + + } + vm.schedulerObj1 = { + "domain": "ChangeManagement", + "scheduleName": "VnfUpgrade/DWF", + "userId": "su7376", + "domainData": [ + { + "WorkflowName": "HEAT Stack Software Update for vNFs", + "CallbackUrl": "http://127.0.0.1:8989/scheduler/v1/loopbacktest/vid", + "CallbackData": "testing" + } + ], + "schedulingInfo": { + "normalDurationInSeconds": 60, + "additionalDurationInSeconds": 60, + "concurrencyLimit": 60, + "policyId": "SNIRO_CM_1707.Config_MS_Demo_TimeLimitAndVerticalTopology_zone_localTime.1.xml", + "vnfDetails": [ + { + "groupId": "group1", + "node": ["satmo415vbc", "satmo455vbc"], + "changeWindow": [ + { + "startTime": "2017-08-08T16:37:30.521Z", + "endTime": "2017-08-08T16:37:30.521Z" + } + ] + } + ] + } + }; + + + vm.format = 'yyyy/MM/dd'; + vm.todate = new Date(); + vm.checkboxSelection = 'false'; + vm.fromDate = ''; + vm.toDate = ''; + vm.timeSlots = []; + + vm.changeManagement = {}; + + vm.subscribers = []; + + AaiService.getSubscribers(function (response) { + vm.subscribers = response; + }); + + vm.serviceTypes = []; + AaiService.getServices(function (response) { + vm.serviceTypes = response.data.service; + }); + + changeManagementService.getWorkflows() + .then(function (response) { + vm.workflows = response.data; + }) + .catch(function (error) { + $log.error(error); + }); + + //TODO: Get the VNF names from backend dynamically + vm.vnfNames = []; + + //TODO: Get the VNF types from backend dynamically + vm.vnfTypes = []; + + AaiService.getLoggedInUserID(function (response) { + vm.userID = response.data; + }); + vm.policys = []; + + var policyName = JSON.stringify({ + policyName: "SNIRO_1710.*", + configAttributes: { + service: "PlacementOptimizationPolicy" + } + }); + SchedulerService.getPolicyInfo(policyName, function (response) { + vm.policys = response.data.entity; + }); + }; + + vm.radioSelections = function (test) { + if (vm.checkboxSelection == "true") { + vm.fromDate = ''; + vm.toDate = '' + } + } + vm.close = function () { + $uibModalInstance.close(); + }; + + + function convertToSecs(number) { + var totalSecs; + if (vm.selectedOption === 'hours') { + totalSecs = number * 3600; + + } + else if (vm.selectedOption === 'minutes') { + totalSecs = number * 60; + } else { + totalSecs = number; + } + return totalSecs; + } + + vm.submit = function () { + vm.schedulingInfo = { + scheduleId: vm.schedulerID, + approvalDateTime: '2017-08-08T16:37:30.521Z', + approvalUserId: "sy6266", + approvalStatus: 'Accepted', + approvalType: 'Tier 2' + }; + + var approvalObj = JSON.stringify(vm.schedulingInfo); + SchedulerService.getSubmitForapprovedTimeslots(approvalObj, function (response) { + if (response.status == 200) { + openConfirmationModal("Successfully Sent for Approval"); + } + + }); + }; + + vm.reject = function () { + vm.schedulingInfo = { + scheduleId: vm.schedulerID, + approvalDateTime: '2017-08-08T16:37:30.521Z', + approvalUserId: "sy6266", + approvalStatus: 'Rejected', + approvalType: 'Tier 2' + } + + var approvalObj = JSON.stringify(vm.schedulingInfo) + SchedulerService.getSubmitForapprovedTimeslots(approvalObj, function (response) { + if (response.status == 200) { + openConfirmationModal("Successfully sent for Rejection"); + } + + }); + }; + + vm.schedule = function (myForm) { + $scope.$watch('fromDate', validateDates(myForm)); + $scope.$watch('toDate', validateDates(myForm)); + if (myForm.$valid) { + sendSchedulerReq() + } + }; + + + function sendSchedulerReq() { + var changeWindow = [{ + startTime: '', + endTime: '' + }]; + vm.timeSlots = []; + var fromDate = $filter('date')(new Date(vm.fromDate), "yyyy-MM-ddTHH:mmZ", "UTC"); + var toDate = $filter('date')(new Date(vm.toDate), "yyyy-MM-ddTHH:mmZ", "UTC"); + + changeWindow[0].startTime = fromDate; + changeWindow[0].endTime = toDate; + vm.schedulerObj.userId = vm.userID; + vm.schedulerObj.domainData[0].WorkflowName = changeManagement.workflow; + vm.schedulerObj.schedulingInfo.normalDurationInSeconds = convertToSecs(vm.scheduler.duration); + vm.schedulerObj.schedulingInfo.additionalDurationInSeconds = convertToSecs(vm.scheduler.fallbackDuration); + vm.schedulerObj.schedulingInfo.concurrencyLimit = vm.scheduler.concurrency; + vm.schedulerObj.schedulingInfo.policyId = vm.scheduler.policy.policyName; + vm.schedulerObj.schedulingInfo['vnfDetails'][0].groupId = 'groupId'; + vm.schedulerObj.schedulingInfo['vnfDetails'][0].node = getVnfData(changeManagement.vnfNames); + + vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow = changeWindow; + if (vm.checkboxSelection == "true") { //When Scheduled now we remove the changeWindow + delete vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow; + } + vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow = changeWindow; + delete vm.schedulerObj.schedulingInfo['vnfDetails'][0].changeWindow; + + var requestScheduler = JSON.stringify(vm.schedulerObj); + console.log(requestScheduler); + SchedulerService.getStatusSchedulerId(requestScheduler, function (response) { + vm.schedulerID = response.data.uuid; + vm.isSpinnerVisible = true; + if (vm.schedulerID) { + var scheduledID = JSON.stringify({scheduleId: vm.schedulerID}); + seviceCallToGetTimeSlots(); + } + }); + } + + function seviceCallToGetTimeSlots() { + + SchedulerService.getTimeSotsForSchedulerId(vm.schedulerID, function (response) { + if (vm.checkboxSelection == "false") { + if (response.data.entity.schedule) { + var scheduleColl = JSON.parse(response.data.entity.schedule); + if (scheduleColl.length > 0) { + vm.timeSlots = scheduleColl; + vm.isSpinnerVisible = false; + hasvaluereturnd = false; + $scope.stopPoll(); + openConfirmationModal(response.data.entity.scheduleId + " Successfully Returned TimeSlots."); + } + + } + else { + if (vm.timeSlots.length == 0 && hasthresholdreached == false) { + var polltime = VIDCONFIGURATION.SCHEDULER_POLLING_INTERVAL_MSECS; + pollpromise = poll(polltime, function () { + if (vm.timeSlots.length == 0) { + hasvaluereturnd = true; + seviceCallToGetTimeSlots() + } + else { + hasvaluereturnd = false; + } + + }); + + } else { + openConfirmationModal("Timeout error.") + } + } + + } + else { + if (response.data.entity) { + vm.isSpinnerVisible = false; + openConfirmationModal(response.data.entity.scheduleId + " Successfully Ready for Schedule.") + } + } + + }); + + } + + function openConfirmationModal(jobInfo) { + var modalInstance = $uibModal.open({ + templateUrl: 'app/vid/scripts/modals/alert-new-scheduler/alert-new-scheduler.html', + controller: 'alertNewSchedulerController', + controllerAs: 'vm', + resolve: { + jobInfo: function () { + return jobInfo; + } + } + }); + } + + var hasvaluereturnd = true; // Flag to check + var hasthresholdreached = false; + var thresholdvalue = VIDCONFIGURATION.SCHEDULER_MAX_POLLS; // interval threshold value + + function poll(interval, callback) { + return $interval(function () { + if (hasvaluereturnd) { //check flag before start new call + callback(hasvaluereturnd); + } + + thresholdvalue = thresholdvalue - 1; //Decrease threshold value + if (thresholdvalue == 0) { + $scope.stopPoll(); // Stop $interval if it reaches to threshold + } + }, interval) + } + + +// stop interval. + $scope.stopPoll = function () { + $interval.cancel(pollpromise); + thresholdvalue = 0; //reset all flags. + hasvaluereturnd = false; + hasthresholdreached = true; + vm.isSpinnerVisible = false; + } + + function getVnfData(arrColl) { + var vnfcolletion = []; + + for (var i = 0; i < arrColl.length; i++) { + vnfcolletion.push(arrColl[i].name); + } + + return vnfcolletion + } + + function validateDates(form) { + if (vm.checkboxSelection == "false") { + + if (form.startDate.$error.invalidDate || form.endDate.$error.invalidDate) { + form.startDate.$setValidity("endBeforeStart", true); //already invalid (per validDate directive) + } else { + //depending on whether the user used the date picker or typed it, this will be different (text or date type). + //creating a new date object takes care of that. + var endDate = new Date(vm.toDate); + var startDate = new Date(vm.fromDate); + form.startDate.$setValidity("endBeforeStart", endDate >= startDate); + } + } + } + + + function extractChangeManagementCallbackDataStr(changeManagement) { + var result = {}; + + result.requestType = changeManagement.workflow; + result.requestDetails = []; + + _.forEach(changeManagement.vnfNames, function (vnf) { + + var data = { + vnfName: vnf.name, + vnfInstanceId: vnf.id, + modelInfo: { + modelType: 'vnf', + modelInvariantId: vnf.properties['model-invariant-id'], + modelVersionId: vnf.modelVersionId, + modelName: vnf.properties['vnf-name'], + modelVersion: vnf.version, + modelCustomizationName: vnf.properties['model-customization-name'], + modelCustomizationId: vnf.properties['model-customization-id'] + }, + cloudConfiguration: { + lcpCloudRegionId: vnf.availableVersions[0].cloudConfiguration.lcpCloudRegionId, + tenantId: vnf.availableVersions[0].cloudConfiguration.tenantId + }, + requestInfo: { + source: vnf.availableVersions[0].requestInfo.source, + suppressRollback: vnf.availableVersions[0].requestInfo.suppressRollback, + requestorId: vnf.availableVersions[0].requestInfo.requestorId + }, + relatedInstanceList: [], + requestParameters: { + usePreload: vnf.availableVersions[0].requestParameters.usePreload + } + }; + + var serviceInstanceId = ''; + _.forEach(vnf['service-instance-node'], function (instanceNode) { + if(instanceNode['node-type'] === 'service-instance'){ + serviceInstanceId = instanceNode.properties['service-instance-id']; + } + }); + + + _.forEach(vnf.availableVersions[0].relatedInstanceList, function (related) { + + var rel = related.relatedInstance; + + var relatedInstance = { + instanceId: serviceInstanceId, + modelInfo: { + modelType: rel.modelInfo.modelType, + modelInvariantId: rel.modelInfo.modelInvariantId, + modelVersionId: rel.modelInfo.modelVersionId, + modelName: rel.modelInfo.modelName, + modelVersion: rel.modelInfo.modelVersion, + modelCustomizationName: rel.modelInfo.modelCustomizationName, + modelCustomizationId: rel.modelInfo.modelCustomizationId + } + }; + + if (rel.vnfInstanceId) + relatedInstance.instanceId = rel.vnfInstanceId; + + data.relatedInstanceList.push({relatedInstance: relatedInstance}); + }); + + + result.requestDetails.push(data); + } + ); + + + // _.forEach(changeManagement.vnfNames, function (vnfName) { + // if (vnfName && vnfName.version) { + // if (vnfName.selectedFile) { + // vnfName.version.requestParameters.userParams = vnfName.selectedFile; + // } + // result.requestDetails.push(vnfName.version) + // } + // }); + + return JSON.stringify(result); + } + + init(); + }; + + appDS2.directive('validDate', function () { + return { + restrict: 'A', + require: 'ngModel', + link: function (scope, element, attrs, control) { + control.$parsers.push(function (viewValue) { + var newDate = model.$viewValue; + control.$setValidity("invalidDate", true); + if (typeof newDate === "object" || newDate == "") return newDate; // pass through if we clicked date from popup + if (!newDate.match(/^\d{1,2}\/\d{1,2}\/((\d{2})|(\d{4}))$/)) + control.$setValidity("invalidDate", false); + return viewValue; + }); + } + }; + }) + + +})(); + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css new file mode 100644 index 00000000..8da5c55c --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.css @@ -0,0 +1,145 @@ +.btn-white { + font-family: OpenSans; + border-radius: 2px; + border: 1px solid #d8d8d8; + background-color: #ffffff; + width: 94px; + height: 30px; + color: #5a5a5a; + font-size: 13px; + font-weight: 400; + line-height: 36px; + text-align: center; +} + +.btn-primary { + font-family: OpenSans; + border-radius: 2px; + border: 1px solid #0091c8; + background-color: #009fdb; + width: 94px; + height: 30px; + color: #ffffff; + font-size: 13px; + font-weight: 400; + line-height: 36px; + text-align: center; +} + +.modal-header { + border: none!important; + padding: 15px 15px 0px 15px!important; +} + +.modal-header h3 { + font-family: OpenSans; + color: #5a5a5a; + font-size: 22px; + font-weight: 300; + line-height: 16px; + padding-bottom: 20px; + border-bottom: 3px solid #009fdb; + +} + +.modal-footer { + background-color: #eaeaea; +} + +.modal-dialog { + width: 587px; + border-radius: 8px; +} + +.modal-content { + width: 587px; + border-radius: 8px; + background-color: #ffffff; +} +.label-font{ + font-size: 1em; +} +.calender-icon{ + background-image: url(../../../../../app/fusion/external/ebz/images/Calendar.svg); + background-repeat:no-repeat; + background-position:98%; + border-radius: 6px; + border: 1px solid #888; + color: #444; + font-family: clearview_att_regular; + width: 100%; + outline: 0; + padding: 7px 10px; + text-transform: none; + z-index: 0; + height: 40px; + position: relative; + +} + +input.calender-icon:focus{ + background-image: url(../../../../../app/fusion/external/ebz/images/Calendar_blue.svg); + background-repeat:no-repeat; +} + + + +.timeslots-content{ + margin-top: 0px; + margin-bottom: 0px; + height: 10em; +} +.find-block{ + float:5em; +} +.timeslots-block{ +/* margin-top: 1em; */ + height: 85px; + } + .policy-combo{ + background-image: none; + } + + div[ng-controller=newSchedulerController] .schedulerVisible { + visibility: visible; +} +div[ng-controller=newSchedulerController] .schedulerHidden { + visibility: hidden; +} + +.table { + border: 1px solid #eaeaea; + box-sizing: border-box; + background-color: #ffffff; + box-shadow: 0px 2px 7px 0px rgba(34, 31, 31, 0.17); + font-family: OpenSans; + color: #5a5a5a; + font-size: 14px; + font-weight: 400; +} +.table>thead { + background-color: #d2d2d2; + font-family: OpenSans; + color: #191919; + font-size: 13px; + font-weight: 600; + line-height: 40px; +} + +.table-headline-row { + font-family: OpenSans; + color: #5a5a5a; + font-size: 14px; + font-weight: 600; + background-color: #eaeaea; + box-shadow: 0px 1px 1px 0px rgba(34, 31, 31, 0.19); +} + +.table-bordered{border:1px solid #eaeaea;} +.table-bordered>tbody>tr>td, +.table-bordered>tbody>tr>th, +.table-bordered>tfoot>tr>td, +.table-bordered>tfoot>tr>th, +.table-bordered>thead>tr>td, +.table-bordered>thead>tr>th{border:1px solid #eaeaea;} + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html new file mode 100644 index 00000000..498ff2ec --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-scheduler/new-scheduler.html @@ -0,0 +1,101 @@ + + +
+ + +
+ diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.css new file mode 100644 index 00000000..d545a5cd --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.css @@ -0,0 +1,7 @@ +.modal-header h3 { + border-bottom: 3px solid #00aeef; +} + +.btn-primary { + padding: 4px 9px !important; +} \ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html new file mode 100644 index 00000000..911e86c2 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/pending-change-management/pending-change-management.html @@ -0,0 +1,12 @@ + + + + + diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js index 09c70eb5..a10f602b 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js @@ -20,9 +20,9 @@ "use strict"; -var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) { +var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONENT, FIELD, $q) { return { - getSubscriberName: function (globalCustomerId, + getSubscriberName : function(globalCustomerId, successCallbackFunction) { $log .debug("AaiService:getSubscriberName: globalCustomerId: " @@ -31,9 +31,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE COMPONENT.AAI_SUB_DETAILS_PATH + globalCustomerId + COMPONENT.ASSIGN + Math.random(), { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { var subName = ""; if (response.data) { subName = response.data[FIELD.ID.SUBNAME]; @@ -44,7 +44,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }, - runNamedQuery: function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { + runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH + COMPONENT.FORWARD_SLASH + encodeURIComponent(namedQueryId) + @@ -52,30 +52,54 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId); $http.get(url, {}, { - timeout: PropertyService.getServerResponseTimeoutMsec() - }).then(function (response) { + + + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(function(response) { if (response.data != null) { successCallback(response); } else { errorCallback(response); } - }, function (response) { + }, function(response) { errorCallback(response); }); }, - getSubDetails: function (selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) { + getVNFInformationByServiceTypeAndId : function (globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) { + + var url = COMPONENT.AAI_GET_VNF_INFO + + COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) + + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) + + COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId); + $http.get(url, {}, { + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data != null) { + successCallback(response); + } else { + errorCallback(response); + } + }, function(response) { + errorCallback(response); + }); + }, + + + getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) { var subscriber; var displayData; - $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, { - timeout: PropertyService.getServerResponseTimeoutMsec() - }).then(function (response) { + $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {}, { + + + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(function(response) { displayData = []; subscriber = response.data; var subscriberName = subscriber[FIELD.ID.SUBNAME]; if (subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) { - angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function (serviceSubscription, key) { + angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) { var serviceInstanceId = []; var serviceType = ""; if (serviceSubscription[FIELD.ID.SERVICETYPE] != null) { @@ -84,10 +108,9 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE serviceType = FIELD.PROMPT.NO_SERVICE_SUB; } if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) { - angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function (instValue, instKey) { + angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) { // put them together, i guess - var inst = { - "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID], + var inst = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID], "aaiModelInvariantId": instValue[FIELD.ID.MODEL_INVAR_ID], "aaiModelVersionId": instValue[FIELD.ID.MODEL_VERSION_ID], "serviceInstanceName": instValue[FIELD.ID.SERVICE_INSTANCE_NAME] @@ -102,111 +125,109 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE }); } else { if (serviceInstanceId == []) { - serviceInstanceId = [FIELD.PROMPT.NO_SERVICE_INSTANCE]; + serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ]; } } - angular.forEach(serviceInstanceId, function (subVal, subKey) { + angular.forEach(serviceInstanceId, function(subVal, subKey) { displayData.push({ - globalCustomerId: selectedSubscriber, - subscriberName: subscriberName, - serviceType: serviceType, - serviceInstanceId: subVal.serviceInstanceId, - aaiModelInvariantId: subVal.aaiModelInvariantId, - aaiModelVersionId: subVal.aaiModelVersionId, - serviceInstanceName: subVal.serviceInstanceName, + globalCustomerId : selectedSubscriber, + subscriberName : subscriberName, + serviceType : serviceType, + serviceInstanceId : subVal.serviceInstanceId, + aaiModelInvariantId : subVal.aaiModelInvariantId, + aaiModelVersionId + : subVal.aaiModelVersionId, + serviceInstanceName : subVal.serviceInstanceName, isPermitted: serviceSubscription[FIELD.ID.IS_PERMITTED] }); }); }); } else { displayData.push({ - globalCustomerId: selectedSubscriber, - subscriberName: selectedSubscriberName, - serviceType: FIELD.PROMPT.NO_SERVICE_SUB, - serviceInstanceId: FIELD.PROMPT.NO_SERVICE_INSTANCE + globalCustomerId : selectedSubscriber, + subscriberName : selectedSubscriberName, + serviceType : FIELD.PROMPT.NO_SERVICE_SUB, + serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE }); } successCallback(displayData, subscriberName); - }, function (response) { - errorCallback(response); - }); + }, function(response) { + errorCallback(response);}); }, - getSubList: function (successCallback, errorCallback) { - $http.get(FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, { - timeout: PropertyService.getServerResponseTimeoutMsec() - }).then(function (response) { + getSubList : function(successCallback, errorCallback ) { + + $http.get( FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {}, { + + + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(function(response) { var customerList = []; if (response.data.customer != null) { - angular.forEach(response.data.customer, function (subVal, subKey) { - var cust = { - "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], - "subscriberName": subVal[FIELD.ID.SUBNAME], - "isPermitted": subVal[FIELD.ID.IS_PERMITTED], - }; + angular.forEach(response.data.customer, function(subVal, subKey) { + var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME], + "isPermitted": subVal[FIELD.ID.IS_PERMITTED], }; customerList.push(cust); }); successCallback(customerList); } else { errorCallback(response); } - }, function (response) { + },function(response) { errorCallback(response); }); }, - getServices2: function (successCallback, errorCallback) { + getServices2 : function(successCallback, errorCallback ) { - $http.get(FIELD.ID.AAI_GET_SERVICES, {}, { - timeout: PropertyService.getServerResponseTimeoutMsec() - }).then(function (response) { + $http.get( FIELD.ID.AAI_GET_SERVICES, {}, { + + + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(function(response) { var customerList = []; if (response.data != null) { var serviceIdList = []; - angular.forEach(response.data, function (value, key) { - angular.forEach(value, function (subVal, key) { - var newVal = { - "id": subVal[FIELD.ID.SERVICE_ID], - "description": subVal[FIELD.ID.SERVICE_DESCRIPTION], + angular.forEach(response.data, function(value, key) { + angular.forEach(value, function(subVal, key) { + var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] , "isPermitted" : subVal[FIELD.ID.IS_PERMITTED] - }; - serviceIdList.push(newVal); + };serviceIdList.push(newVal); }); }); successCallback(serviceIdList); } else { errorCallback(response); } - }, function (response) { + },function(response) { errorCallback(response); }); }, - getSubscriptionServiceTypeList: function (globalCustomerId, + getSubscriptionServiceTypeList : function(globalCustomerId, successCallbackFunction) { $log .debug("AaiService:getSubscriptionServiceTypeList: globalCustomerId: " + globalCustomerId); - if (UtilityService.hasContents(globalCustomerId)) { + if ( UtilityService.hasContents(globalCustomerId) ) { $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + globalCustomerId + COMPONENT.ASSIGN + Math.random(), { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data && response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS]) { var serviceTypes = []; var serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]; for (var i = 0; i < serviceSubscriptions.length; i++) { serviceTypes.push({ - "name": serviceSubscriptions[i][FIELD.ID.SERVICETYPE], + "name":serviceSubscriptions[i][FIELD.ID.SERVICETYPE], "isPermitted": serviceSubscriptions[i][FIELD.ID.IS_PERMITTED], "id": i - }); - } + });} successCallbackFunction(serviceTypes); } else { successCallbackFunction([]); @@ -215,19 +236,19 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE (UtilityService.runHttpErrorHandler); } }, - getLcpCloudRegionTenantList: function (globalCustomerId, serviceType, + getLcpCloudRegionTenantList : function(globalCustomerId, serviceType, successCallbackFunction) { $log .debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: " + globalCustomerId); - var url = COMPONENT.AAI_GET_TENANTS + var url = COMPONENT.AAI_GET_TENANTS + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { var lcpCloudRegionTenants = []; var aaiLcpCloudRegionTenants = response.data; @@ -242,24 +263,23 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE "cloudRegionId": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID], "tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME], "tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID], - "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED] - }); + "isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED]}); } successCallbackFunction(lcpCloudRegionTenants); })["catch"] (UtilityService.runHttpErrorHandler); }, - getSubscribers: function (successCallbackFunction) { + getSubscribers : function(successCallbackFunction) { $log .debug("AaiService:getSubscribers"); - var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random(); + var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response.data.customer); } else { @@ -268,16 +288,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getProvOptionsFromSystemProp: function (successCallbackFunction) { + getProvOptionsFromSystemProp : function(successCallbackFunction) { $log .debug("AaiService:getProvOptionsFromSystemProp"); - var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH; + var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH; $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response); } else { @@ -286,28 +306,31 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getLoggedInUserID: function (successCallbackFunction) { + getLoggedInUserID : function(successCallbackFunction) { $log .debug("AaiService:getLoggedInUserID"); var url = COMPONENT.GET_USER_ID; $http.get(url, { - timeout: PropertyService + transformResponse: [function (data) { + return data; + }], + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response); } else { successCallbackFunction([]); } - })["catch"] + },function(failure){console.log("failure")})["catch"] (UtilityService.runHttpErrorHandler); }, - getServices: function (successCallbackFunction) { + getServices : function(successCallbackFunction) { $log .debug("AaiService:getServices"); - var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random(); $http.get(url, { @@ -326,31 +349,46 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE getAicZones: function (successCallbackFunction) { $log .debug("getAicZones:getAicZones"); - var url = COMPONENT.AAI_GET_AIC_ZONES + COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_AIC_ZONES +COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response); } else { successCallbackFunction([]); } })["catch"] - (UtilityService.runHttpErrorHandler); - }, - getServiceModels: function (globalCustomerId, serviceType, successCallbackFunction) { + (UtilityService.runHttpErrorHandler);}, + getAicZoneForPNF: function (globalCustomerId,serviceType,serviceInstanceId,successCallbackFunction) { + $log + .debug("getAicZones:getAicZones"); + var url = COMPONENT.AAI_GET_AIC_ZONE_FOR_PNF + .replace('@serviceInstanceId', serviceInstanceId) + .replace('@globalCustomerId', globalCustomerId) + .replace('@serviceType', serviceType); + $http.get(url, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + successCallbackFunction(response.data); + })["catch"] + (UtilityService.runHttpErrorHandler);}, + + getServiceModels : function(globalCustomerId,serviceType,successCallbackFunction) { $log .debug("AaiService:getServices"); - var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH+globalCustomerId+ COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response); } else { @@ -359,16 +397,16 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE })["catch"] (UtilityService.runHttpErrorHandler); }, - getServiceModelsByServiceType: function (namedQueryId, globalCustomerId, serviceType, successCallbackFunction) { + getServiceModelsByServiceType : function(namedQueryId,globalCustomerId,serviceType,successCallbackFunction) { $log .debug("AaiService:getServiceModelsByServiceType"); - var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE + COMPONENT.FORWARD_SLASH + namedQueryId + COMPONENT.FORWARD_SLASH + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random(); + var url = COMPONENT.AAI_GET_SERVICES_BY_TYPE+COMPONENT.FORWARD_SLASH+namedQueryId+COMPONENT.FORWARD_SLASH+globalCustomerId+COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random(); $http.get(url, { - timeout: PropertyService + timeout : PropertyService .getServerResponseTimeoutMsec() - }).then(function (response) { + }).then(function(response) { if (response.data) { successCallbackFunction(response); } else { @@ -376,9 +414,71 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE } })["catch"] (UtilityService.runHttpErrorHandler); + }, + + getVnfsByCustomerIdAndServiceType: function(globalSubscriberId, serviceType){ + var deferred = $q.defer(); + + if (UtilityService.hasContents(globalSubscriberId) && + UtilityService.hasContents(serviceType) ) { + + $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + globalSubscriberId + COMPONENT.FORWARD_SLASH + + serviceType ) + .success(function (response) { + if(response) { + deferred.resolve({data: response}); + } else { + deferred.resolve({data: []}); + } + }).error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } + + return deferred.promise; + }, + + getVnfVersionsByInvariantId: function(modelInvariantId){ + var deferred = $q.defer(); + + if (UtilityService.hasContents(modelInvariantId)) { + var body = {"versions" : modelInvariantId} + $http.post(( COMPONENT.AAI_GET_VERSION_BY_INVARIANT_ID),body) + + .success(function (response) { + if(response) { + deferred.resolve({data: response}); + } else { + deferred.resolve({data: []}); + } + }).error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } + + return deferred.promise; + }, + + getSubscriberServiceTypes: function(subscriberUuid) { + var deferred = $q.defer(); + $log.debug("AaiService:getSubscriberServiceTypes: subscriberUuid: " + subscriberUuid); + + if (UtilityService.hasContents(subscriberUuid)) { + $http.get(COMPONENT.AAI_SUB_DETAILS_PATH + subscriberUuid + COMPONENT.ASSIGN + Math.random()) + .success(function (response) { + if(response && [FIELD.ID.SERVICE_SUBSCRIPTIONS]) { + deferred.resolve({data: response[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION]}); + } else { + deferred.resolve({data: []}); + } + }).error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + } + + return deferred.promise; } - } -} + }}; appDS2.factory("AaiService", ["$http", "$log", "PropertyService", - "UtilityService", "COMPONENT", "FIELD", AaiService]); + "UtilityService", "COMPONENT", "FIELD", "$q", AaiService]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js new file mode 100644 index 00000000..f2282d69 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/change-management.service.js @@ -0,0 +1,76 @@ +(function () { + 'use strict'; + + appDS2.service('changeManagementService', ['$http', '$q', 'COMPONENT', 'VIDCONFIGURATION', changeManagementService]); + + function changeManagementService($http, $q, COMPONENT, VIDCONFIGURATION) { + this.getWorkflows = function (vnfs) { + var deferred = $q.defer(); + + $http.get(COMPONENT.GET_WORKFLOW.replace("@vnfs", vnfs)) + .success(function (response) { + deferred.resolve({data: response}); + }).error(function (data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getMSOChangeManagements = function() { + var deferred = $q.defer(); + + $http.get(COMPONENT.GET_MSO_WORKFLOWS) + .success(function (response) { + deferred.resolve({data: response}); + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getAllSDCServices = function () { + var deferred = $q.defer(); + + $http.get(COMPONENT.SERVICES_DIST_STATUS_PATH + VIDCONFIGURATION.ASDC_MODEL_STATUS) + .success(function (response) { + deferred.resolve({data: response}); + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getSDCService = function(uuid) { + var deferred = $q.defer(); + + $http.get(COMPONENT.SERVICES_PATH + uuid) + .success(function (response) { + deferred.resolve({data: response}); + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + + this.getSchedulerChangeManagements = function(){ + var deferred = $q.defer(); + + $http.get(COMPONENT.GET_SCHEDULER_CHANGE_MANAGEMENTS) + .success(function (response) { + deferred.resolve({data: response}); + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + + return deferred.promise; + }; + } +})(); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js index 9309ce6c..e171e285 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js @@ -274,7 +274,6 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON } parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK); if(_this.componentId === COMPONENT.VF_MODULE ){ - if(DataService.getSubscriberName() === FIELD.NAME.MOBILITY){ parameterList.push({name: FIELD.NAME.SDN_C_PRELOAD, id: FIELD.ID.SDN_C_PRELOAD, type: "checkbox", @@ -283,7 +282,6 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON hideFieldAndLabel: true } ); - } parameterList.push({name: FIELD.NAME.UPLOAD_SUPPLEMENTORY_DATA_FILE, id: FIELD.ID.UPLOAD_SUPPLEMENTORY_DATA_FILE, type: "checkbox", @@ -602,7 +600,7 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON requestDetails.requestParameters.usePreload = getValueFromList( FIELD.ID.SDN_C_PRELOAD, parameterList); if(_this.componentId == COMPONENT.VF_MODULE &&(requestDetails.requestParameters.usePreload== null || requestDetails.requestParameters.usePreload === '')){ - requestDetails.requestParameters.usePreload = true; + requestDetails.requestParameters.usePreload = false; } break; case COMPONENT.VOLUME_GROUP: diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js index 864abe67..68c8503d 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js @@ -20,156 +20,240 @@ "use strict"; -var MsoService = function($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) { +var MsoService = function($http, $log, PropertyService, AaiService, UtilityService, COMPONENT, FIELD, $q) { - var _this = this; + var _this = this; /* * Common function to handle both create and delete instance requests */ - var requestInstanceUpdate = function(request, successCallbackFunction) { - $log.debug("MsoService:requestInstanceUpdate: request:"); - $log.debug(request); - $http.post( "mso/" + request.url, { - requestDetails : request.requestDetails - }, { - timeout : PropertyService.getServerResponseTimeoutMsec() - }).then(successCallbackFunction)["catch"] - (UtilityService.runHttpErrorHandler); - } - - var checkValidStatus = function(response) { - if (response.data.status < 200 || response.data.status > 202) { - throw { - type : FIELD.ID.MSO_FAILURE - } - } - } - - var addListEntry = function(name, value) { - var entry = '"' + name + '": '; - if (value === undefined) { - return entry + "undefined"; - } else { - return entry + '"' + value + '"'; - } - } - - return { - createInstance : requestInstanceUpdate, - deleteInstance : requestInstanceUpdate, - getOrchestrationRequest : function(requestId, successCallbackFunction) { - $log.debug("MsoService:getOrchestrationRequest: requestId: " - + requestId); - $http.get( - "mso/mso_get_orch_req/" - + requestId + "?r=" + Math.random(), - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(successCallbackFunction)["catch"] - (UtilityService.runHttpErrorHandler); - }, - getOrchestrationRequests : function(filterString, - successCallbackFunction) { - $log.debug("MsoService:getOrchestrationRequests: filterString: " - + filterString); - $http.get( - "mso/mso_get_orch_reqs/" - + encodeURIComponent(filterString) + "?r=" - + Math.random(), - { - timeout : PropertyService - .getServerResponseTimeoutMsec() - }).then(successCallbackFunction)["catch"] - (UtilityService.runHttpErrorHandler); - }, - getFormattedCommonResponse : function(response) { - return UtilityService.getCurrentTime() + " HTTP Status: " - + UtilityService.getHttpStatusText(response.data.status) - + "\n" + angular.toJson(response.data.entity, true) - - }, - checkValidStatus : checkValidStatus, - getFormattedGetOrchestrationRequestsResponse : function(response) { - UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity); - UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status); - checkValidStatus(response); - - var list = response.data.entity.requestList - UtilityService.checkUndefined(FIELD.ID.REQUEST_LIST, list); - - var message = ""; - - for (var i = 0; i < list.length; i++) { - var request = list[i].request; - message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType) - + ",\n"; - var status = request.requestStatus; - if (status === undefined) { - message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n"; - } else { - message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp) - + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState) - + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_STATUS, - status.statusMessage) - + ",\n"; - message += addListEntry(FIELD.ID.PERCENT_PROGRESS, - status.percentProgress) - + "\n"; - } - if (i < (list.length - 1)) { - message += "\n"; - } - } - return message; - }, - getFormattedSingleGetOrchestrationRequestResponse : function (response) { - UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity); - UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status); - checkValidStatus(response); - - var message = ""; - if ( UtilityService.hasContents (response.data.entity.request) ) { - var request = response.data.entity.request; - message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType) - + ",\n"; - var status = request.requestStatus; - if (status === undefined) { - message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n"; - } else { - message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp) - + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState) - + ",\n"; - message += addListEntry(FIELD.ID.REQUEST_STATUS, - status.statusMessage) - + ",\n"; - message += addListEntry(FIELD.ID.PERCENT_PROGRESS, - status.percentProgress) - + "\n\n"; - } - } - return message; - }, - showResponseContentError : function(error, showFunction) { - switch (error.type) { - case "undefinedObject": - showFunction(FIELD.ERROR.SYSTEM_FAILURE, error.message); - break; - case "msoFailure": - showFunction(FIELD.ERROR.MSO, "") - break; - default: - showFunction(FIELD.ERROR.SYSTEM_FAILURE); - } - } - } -} + var requestInstanceUpdate = function(request, successCallbackFunction) { + $log.debug("MsoService:requestInstanceUpdate: request:"); + $log.debug(request); + $http.post( "mso/" + request.url, { + requestDetails : request.requestDetails + }, { + timeout : PropertyService.getServerResponseTimeoutMsec() + }).then(successCallbackFunction)["catch"] + (UtilityService.runHttpErrorHandler); + } + + var checkValidStatus = function(response) { + if (response.data.status < 200 || response.data.status > 202) { + throw { + type : FIELD.ID.MSO_FAILURE + } + } + }; + + var addListEntry = function(name, value) { + var entry = '"' + name + '": '; + if (value === undefined) { + return entry + "undefined"; + } else { + return entry + '"' + value + '"'; + } + }; + + var activateInstance = function(instance, model) { + var deferred = $q.defer(); + + AaiService.getLoggedInUserID(function (response) { + var userID = response.data; + + AaiService.getAicZoneForPNF(instance.globalCustomerId, model.service.serviceType, instance.serviceInstanceId, function (aicZone) { + + var requestDetails = { + "modelInstanceId": serviceInstanceId, + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": model.service.invariantUuid, + "modelVersionId": model.service.uuid, + "modelName": model.service.name, + "modelVersion": model.service.version + }, + "requestInfo": { + "source": "VID", + "requestorId": userID + }, + "requestParameters": { + "userParams": { + "name": "aic_zone", + "value": aicZone + } + } + } + }; + + console.log("requestDetails", requestDetails); + + $http.post(COMPONENT.MSO_ACTIVATE_INSTANCE.replace('@serviceInstanceId', requestDetails.modelInstanceId), + requestDetails.requestDetails) + .success(function (response) { + deferred.resolve({data: response}); + }) + .error(function(data, status, headers, config) { + deferred.reject({message: data, status: status}); + }); + }); + }); + + return deferred.promise; + }; + + return { + createInstance : requestInstanceUpdate, + deleteInstance : requestInstanceUpdate, + getOrchestrationRequest : function(requestId, successCallbackFunction) { + $log.debug("MsoService:getOrchestrationRequest: requestId: " + + requestId); + $http.get( + "mso/mso_get_orch_req/" + + requestId + "?r=" + Math.random(), + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(successCallbackFunction)["catch"] + (UtilityService.runHttpErrorHandler); + }, + getOrchestrationRequests : function(filterString, + successCallbackFunction) { + $log.debug("MsoService:getOrchestrationRequests: filterString: " + + filterString); + $http.get( + "mso/mso_get_orch_reqs/" + + encodeURIComponent(filterString) + "?r=" + + Math.random(), + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(successCallbackFunction)["catch"] + (UtilityService.runHttpErrorHandler); + }, + getFormattedCommonResponse : function(response) { + return UtilityService.getCurrentTime() + " HTTP Status: " + + UtilityService.getHttpStatusText(response.data.status) + + "\n" + angular.toJson(response.data.entity, true) + + }, + checkValidStatus : checkValidStatus, + getFormattedGetOrchestrationRequestsResponse : function(response) { + UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity); + UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status); + checkValidStatus(response); + + var list = response.data.entity.requestList + UtilityService.checkUndefined(FIELD.ID.REQUEST_LIST, list); + + var message = ""; + + for (var i = 0; i < list.length; i++) { + var request = list[i].request; + message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType) + + ",\n"; + var status = request.requestStatus; + if (status === undefined) { + message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n"; + } else { + message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp) + + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState) + + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_STATUS, + status.statusMessage) + + ",\n"; + message += addListEntry(FIELD.ID.PERCENT_PROGRESS, + status.percentProgress) + + "\n"; + } + if (i < (list.length - 1)) { + message += "\n"; + } + } + return message; + }, + getFormattedSingleGetOrchestrationRequestResponse : function (response) { + UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity); + UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status); + checkValidStatus(response); + + var message = ""; + if ( UtilityService.hasContents (response.data.entity.request) ) { + var request = response.data.entity.request; + message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType) + + ",\n"; + var status = request.requestStatus; + if (status === undefined) { + message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n"; + } else { + message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp) + + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState) + + ",\n"; + message += addListEntry(FIELD.ID.REQUEST_STATUS, + status.statusMessage) + + ",\n"; + message += addListEntry(FIELD.ID.PERCENT_PROGRESS, + status.percentProgress) + + "\n\n"; + } + } + return message; + }, + getManualTasks : function(requestId) { + $log.debug("MsoService:getManualTasks: requestId: " + + requestId); + return $http.get( + "mso/mso_get_man_task/" + requestId, + { + timeout: PropertyService + .getServerResponseTimeoutMsec() + }) + .catch(UtilityService.runHttpErrorHandler); + }, + completeTask: function(taskId, taskToComplete) { + $log.debug("MsoService:completeTask: taskId: " + + taskId); + AaiService.getLoggedInUserID(function (response) { + var attuid = response.data; + var source = "VID"; + var data = { + requestDetails: { + requestInfo: { + source: source, + responseValue: taskToComplete, + requestorId: attuid + } + } + }; + + return $http.post( + "mso/mso_post_man_task/" + taskId, data, + { + timeout: PropertyService + .getServerResponseTimeoutMsec() + }) + .catch(UtilityService.runHttpErrorHandler); + }); + }, + showResponseContentError : function(error, showFunction) { + switch (error.type) { + case "undefinedObject": + showFunction(FIELD.ERROR.SYSTEM_FAILURE, error.message); + break; + case "msoFailure": + showFunction(FIELD.ERROR.MSO, "") + break; + default: + showFunction(FIELD.ERROR.SYSTEM_FAILURE); + } + }, + activateInstance: activateInstance + } +}; appDS2.factory("MsoService", [ "$http", "$log", "PropertyService", - "UtilityService", "COMPONENT", "FIELD", MsoService ]); + "AaiService", "UtilityService", "COMPONENT", "FIELD", "$q", MsoService ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js new file mode 100644 index 00000000..83cc4dda --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/schedulerService.js @@ -0,0 +1,104 @@ +/*- + * ============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 SchedulerService = function($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) { + return { + + getStatusSchedulerId : function(schedulerInfo,successCallbackFunction) { + $log + .debug("SchedulerService:getSchedulerStatusAndSchedulerId"); + var url = COMPONENT.POST_CREATE_NEW_VNF_CHANGE+COMPONENT.ASSIGN + Math.random(); + + $http.post(url, schedulerInfo, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data) { + successCallbackFunction(response); + } else { + successCallbackFunction([]); + } + })["catch"] + (UtilityService.runHttpErrorHandler); + }, + + getTimeSotsForSchedulerId:function(schedulerID,successCallbackFunction){ + $log + .debug("SchedulerService:getTimeSlotsForSchedulerID"); + var url = COMPONENT.GET_TIME_SLOTS+COMPONENT.FORWARD_SLASH +schedulerID+COMPONENT.ASSIGN; + + $http.get(url, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data) { + successCallbackFunction(response); + } else { + successCallbackFunction([]); + } + })["catch"] + + (UtilityService.runHttpErrorHandler); + }, + getSubmitForapprovedTimeslots: function(ApprovedTimeSlotsObj,successCallbackFunction) { + $log + .debug("SchedulerService:getSchedulerStatusAndSchedulerId"); + var url = COMPONENT.SUBMIT_VNF_CHANGE_TIMESLOTS+COMPONENT.ASSIGN + Math.random(); + + $http.post(url, ApprovedTimeSlotsObj, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data) { + successCallbackFunction(response); + } else { + successCallbackFunction([]); + } + })["catch"] + (UtilityService.runHttpErrorHandler); + }, + getPolicyInfo:function(policyName,successCallbackFunction){ + $log + .debug("SchedulerService:getPolicyInfo"); + var url = COMPONENT.GET_POLICY +COMPONENT.ASSIGN + Math.random(); + + $http.post(url, policyName, + { + timeout : PropertyService + .getServerResponseTimeoutMsec() + }).then(function(response) { + if (response.data) { + successCallbackFunction(response); + } else { + successCallbackFunction([]); + } + })["catch"] + (UtilityService.runHttpErrorHandler); + } + } +} + +appDS2.factory("SchedulerService", ["$http", "$log", "PropertyService", + "UtilityService", "COMPONENT", "FIELD", SchedulerService]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html new file mode 100644 index 00000000..0f42ec87 --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/change-management.html @@ -0,0 +1,112 @@ + + +
+
+ VNF Changes + +
+
+ +
+ New +
+ + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VNF NameTypeFlowStart timeStatus
+ IN PROGRESS +
{{changeManagement.instanceReferences.vnfInstanceName || 'No-Instance-Name'}}{{changeManagement.requestScope}}{{changeManagement.requestType}}{{changeManagement.startTime}}
+ PENDING +
{{changeManagement.vnfName}}{{changeManagement.scheduleRequest.scheduleName}}{{changeManagement.workflow}}{{changeManagement.startTime}}
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
VNF NameTypeFlowStart timeStatus
+ FINISHED +
{{changeManagement.instanceReferences.vnfInstanceName || 'No-Instance-Name'}}{{changeManagement.requestScope}}{{changeManagement.requestType}}{{changeManagement.startTime}}
+
+
+
+
+
+
\ No newline at end of file diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm index 27622ff6..71efef1d 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm @@ -105,6 +105,9 @@ + + Activate +
  1. -- cgit 1.2.3-korg