diff options
Diffstat (limited to 'vid/src/main/webapp/app/vid/scripts/controller')
13 files changed, 0 insertions, 3187 deletions
diff --git a/vid/src/main/webapp/app/vid/scripts/controller/InstantiationController.js b/vid/src/main/webapp/app/vid/scripts/controller/InstantiationController.js deleted file mode 100644 index fb9baa4b8..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/InstantiationController.js +++ /dev/null @@ -1,1028 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -/** - * The Instantiation (or View/Edit) Controller controls the instantiation/removal of - * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups) - */ -(function () { - "use strict"; - - app.requires.push('ui.tree'); - - app.controller("InstantiationController", function ($scope, $route, $location, $timeout, COMPONENT, DataService, PropertyService, UtilityService, $http, vidService) { - - $scope.popup = new Object(); - $scope.defaultBaseUrl = ""; - $scope.responseTimeoutMsec = 60000; - $scope.properties = UtilityService.getProperties(); - $scope.init = function() { - - /* - * These 2 statements should be included in non-test code. - */ - // takes a default value, retrieves the prop value from the file system and sets it - var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(1000); - PropertyService.setMsoMaxPollingIntervalMsec(msecs); - - // takes a default value, retrieves the prop value from the file system and sets it - var polls = PropertyService.retrieveMsoMaxPolls(7); - PropertyService.setMsoMaxPolls(polls); - - //PropertyService.setMsoBaseUrl("testmso"); - PropertyService.setServerResponseTimeoutMsec(10000); - - /* - * Common parameters that shows an example of how the view edit screen - * is expected to pass some common service instance values to the - * popups. - */ - -// DataService.setSubscriberName("Mobility"); -// DataService.setGlobalCustomerId("CUSTID12345") -// DataService.setServiceType("Mobility Type 1"); -// DataService.setServiceInstanceName("Example Service Instance Name"); -// DataService.setServiceName("Mobility Service 1"); -// DataService.setServiceInstanceId("mmsc-test-service-instance"); -// DataService.setServiceUuid("XXXX-YYYY-ZZZZ"); -// DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - } - - //PropertyService.setMsoBaseUrl("testmso"); - - $scope.convertModel = function(asdcModel) { - - if (!asdcModel) return undefined; - - var convertedAsdcModel = { - "service": asdcModel.service, - "networks": {}, - "vnfs": {} - }; - - for (var networkUuid in asdcModel.networks) { - var networkModel = asdcModel.networks[networkUuid]; - convertedAsdcModel.networks[networkModel.invariantUuid] = {}; - convertedAsdcModel.networks[networkModel.invariantUuid][networkModel.version] = networkModel; - } - - for (var vnfUuid in asdcModel.vnfs) { - var vnfModel = asdcModel.vnfs[vnfUuid]; - convertedAsdcModel.vnfs[vnfModel.invariantUuid] = {}; - convertedAsdcModel.vnfs[vnfModel.invariantUuid][vnfModel.version] = { - "uuid": vnfModel.uuid, - "invariantUuid": vnfModel.invariantUuid, - "version": vnfModel.version, - "name": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "inputs": "", - "description": vnfModel.description, - "vfModules": {}, - "volumeGroups": {} - } - - for (var vfModuleUuid in asdcModel.vnfs[vnfUuid].vfModules) { - var vfModuleModel = asdcModel.vnfs[vnfUuid].vfModules[vfModuleUuid]; - convertedAsdcModel.vnfs[vnfModel.invariantUuid][vnfModel.version].vfModules[vfModuleModel.invariantUuid] = {}; - convertedAsdcModel.vnfs[vnfModel.invariantUuid][vnfModel.version].vfModules[vfModuleModel.invariantUuid][vfModuleModel.version] = vfModuleModel; - } - - for (var volumeGroupUuid in asdcModel.vnfs[vnfUuid].volumeGroups) { - var volumeGroupModel = asdcModel.vnfs[vnfUuid].volumeGroups[volumeGroupUuid]; - convertedAsdcModel.vnfs[vnfModel.invariantUuid][vnfModel.version].volumeGroups[volumeGroupModel.invariantUuid] = {}; - convertedAsdcModel.vnfs[vnfModel.invariantUuid][vnfModel.version].volumeGroups[volumeGroupModel.invariantUuid][volumeGroupModel.version] = volumeGroupModel; - } - } - console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ) ); - return convertedAsdcModel; - }; - - $scope.service = { - "model": vidService.getModel(), - "modelByInvariantUuid": $scope.convertModel(vidService.getModel()), - "instance": vidService.getInstance() - }; - - $scope.deleteNetwork = function(serviceObject, network) { - - console.log("Removing Network " + network.name); - - //Send delete network request to MSO - - //var networks = this.service.instance.networks; - - //networks.splice(networks.indexOf(network), 1); - - //Retrieve updated data from A&AI - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(network); - DataService.setModelInfo(COMPONENT.NETWORK, $scope.service.model); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - //DataService.setServiceName($scope.service.model.name); - - //DataService.setServiceUuid("XXXX-YYYY-ZZZZ"); - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.NETWORK, - callbackFunction : deleteCallbackFunction - }); - }; - - $scope.deleteService = function(serviceObject) { - - var serviceInstance = serviceObject.object; - - console.log("Removing Service " + $scope.service.instance.name); - - DataService.setInventoryItem(serviceInstance); - //DataService.setModelInfo(COMPONENT.SERVICE, $scope.service.model); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelCustomizationName": "", - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.SERVICE, - callbackFunction : deleteServiceInstanceCallbackFunction - }); - - }; - - $scope.deleteVfModule = function(serviceObject, vfModule, vnf) { - - console.log("Removing VF-Module " + vfModule.name); - - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(vfModule.object); - - var svcModel = $scope.service.modelByInvariantUuid; - var vnfModelInvariantUuid = vnf.object["persona-model-id"]; - var vnfModelVersion = vnf.object["persona-model-version"]; - if (svcModel != null && vnfModelInvariantUuid != null && vnfModelVersion != null ) - { - if ( ( UtilityService.hasContents(svcModel.vnfs) && UtilityService.hasContents(svcModel.vnfs[vnfModelInvariantUuid] ) ) && - ( UtilityService.hasContents(svcModel.vnfs[vnfModelInvariantUuid][vnfModelVersion] ) ) ) { - var vnfModel = svcModel.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - // volume groups don't have persona-model-id/version in a&ai. - // Their persona-model-id/version is the one for the associated vfModule - - var vfModuleInvariantUuid = vfModule.object["persona-model-id"]; - var vfModuleModelVersion = vfModule.object["persona-model-version"]; - - if ( UtilityService.hasContents(vnfModel) && UtilityService.hasContents(vnfModel.vfModules) && UtilityService.hasContents(vfModuleInvariantUuid) && UtilityService.hasContents(vfModuleModelVersion) ) - { - var vfModelGroupModel = vnfModel.vfModules[vfModuleInvariantUuid][vfModuleModelVersion]; - - var vfModeluuid = vfModelGroupModel.uuid; - if (vfModeluuid == null) - vfModeluuid = ""; - - var vnfModelCustomizationName = vnfModel.modelCustomizationName; - if (vnfModelCustomizationName == null) - vnfModelCustomizationName = ""; - - var vfModelName = vfModelGroupModel.name; - if (vfModelName == null) - vfModelName = ""; - - var vfModelVersionID = vfModule.object['vf-module-id']; - if (vfModelVersionID == null) - vfModelVersionID = ""; - - DataService.setModelInfo(COMPONENT.VF_MODULE, { - "modelInvariantId": vfModuleInvariantUuid, - "modelVersion": vfModuleModelVersion, - "modelNameVersionId": vfModeluuid, - "modelCustomizationName": vnfModelCustomizationName, - "modelName": vfModelName, - "inputs": "" - }); - - DataService.setVnfInstanceId(vnf.object['vnf-id']); - DataService.setVfModuleInstanceId(vfModelVersionID); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.VF_MODULE, - callbackFunction : deleteCallbackFunction - }); - - return; - } - - } - } - - console.log("Removing VNF " + vnf.name + " could not proceed due to missing ASDC model information."); - - - //Retrieve updated data from A&AI - }; - - $scope.deleteVnf = function(serviceObject, vnf) { - - console.log("Removing VNF " + vnf.name); - - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(vnf.object); - - var vnftype = vnf.object['vnf-type']; - if (vnftype == null) - vnftype = ""; - else - { - var n = vnftype.search("/"); - if (n >= 0) - vnftype = vnftype.substring(n+1); - } - - - var svcModel = $scope.service.modelByInvariantUuid; - var vnfModelInvariantUuid = vnf.object["persona-model-id"]; - var vnfModelVersion = vnf.object["persona-model-version"]; - if (svcModel != null && vnfModelInvariantUuid != null && vnfModelVersion != null ) - { - - console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.modelByInvariantUuid.vnfs, null, 4) ); - - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - if (vnfModel == null) - { - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModelInvariantUuid, - "modelVersion": vnfModelVersion, - "modelNameVersionId": "", - "modelCustomizationName": vnftype, - "modelName": "", - "inputs": "" - }); - } - else - { - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModelInvariantUuid, - "modelVersion": vnfModelVersion, - "modelNameVersionId": vnfModel.uuid, - "modelCustomizationName": vnftype, - "modelName": vnfModel.name, - "inputs": "" - }); - } - } - else - { - console.log("Removing VNF name = " + vnf.name + " didn't get the correponding model details so sending empty model values to MSO!"); - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": "", - "modelVersion": "", - "modelNameVersionId": "", - "modelCustomizationName": vnftype, - "modelName": "", - "inputs": "" - }); - } - - DataService.setVnfInstanceId(vnf.object['vnf-id']); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.VNF, - callbackFunction : deleteCallbackFunction - }); - - }; - - /* - $scope.deleteVnf = function(serviceObject, vnf) { - - console.log("Removing VNF " + vnf.name); - - //Send delete VF-Module request to MSO - - var svcModel = $scope.service.modelByInvariantUuid; - var vnfModelInvariantUuid = vnf.object["persona-model-id"]; - var vnfModelVersion = vnf.object["persona-model-version"]; - console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.modelByInvariantUuid.vnfs, null, 4) ); - - DataService.setInventoryItem(vnf); - - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModelInvariantUuid, - "modelVersion": vnfModelVersion, - "modelNameVersionId": vnfModel.uuid, - "modelCustomizationName": vnfModel.modelCustomizationName, - "modelName": vnfModel.name, - "inputs": vnfModel.inputs - }); - - DataService.setSubscriberName(serviceObject['globalCustomerId']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceObject['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName(vnf.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.VNF, - callbackFunction : deleteCallbackFunction - }); - - //var vnfs = this.service.instance.vnfs; - - //vnfs.splice(vnfs.indexOf(vnf), 1); - - //Retrieve updated data from A&AI - };*/ - - $scope.deleteVolumeGroup = function(serviceObject, vnf, vfModule, volumeGroup) { - - console.log("Removing Volume Group " + volumeGroup.name); - var haveModel = false; - var svcModel = $scope.service.modelByInvariantUuid; - - var vnfModelInvariantUuid = vnf.object["persona-model-id"]; - var vnfModelVersion = vnf.object["persona-model-version"]; - - if ( ( UtilityService.hasContents(vnfModelInvariantUuid) ) && (UtilityService.hasContents(vnfModelVersion) ) ) { - if ( UtilityService.hasContents(svcModel) && UtilityService.hasContents($scope.service.modelByInvariantUuid.vnfs) ) { - //console.log ( "vnf models "); console.log (JSON.stringify ($scope.service.modelByInvariantUuid.vnfs, null, 4) ); - if ( ( UtilityService.hasContents($scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid] ) ) && - ( UtilityService.hasContents($scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion] ) ) ) { - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - // volume groups don't have persona-model-id/version in a&ai. - // Their persona-model-id/version is the one for the associated vfModule - - var vfModuleInvariantUuid = vfModule.object["persona-model-id"]; - var vfModuleModelVersion = vfModule.object["persona-model-version"]; - - if ( UtilityService.hasContents(vnfModel.volumeGroups) && UtilityService.hasContents(vfModuleInvariantUuid) && UtilityService.hasContents(vfModuleModelVersion) ) { - - if ( ( UtilityService.hasContents (vnfModel.volumeGroups[vfModuleInvariantUuid]) ) && - (UtilityService.hasContents (vnfModel.volumeGroups[vfModuleInvariantUuid][vfModuleModelVersion]) ) ) { - var volGroupModel = vnfModel.volumeGroups[vfModuleInvariantUuid][vfModuleModelVersion]; - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": vfModuleInvariantUuid, - "modelVersion": vfModuleModelVersion, - "modelNameVersionId": volGroupModel.uuid, - "modelCustomizationName": vnfModel.modelCustomizationName, - "modelName": volGroupModel.name, - "inputs": "" - }); - haveModel = true; - - } - } - } - } - } - if ( !haveModel ) { - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": "", - "modelVersion": "", - "modelNameVersionId": "", - "modelCustomizationName": "", - "modelName": "", - "inputs": "" - }); - } - - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(volumeGroup.object); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - DataService.setVnfInstanceId(vnf.nodeId); - DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); - - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : deleteCallbackFunction - }); - }; - - $scope.deleteVnfVolumeGroup = function(serviceObject, vnf, volumeGroup) { - - console.log("Removing Volume Group " + volumeGroup.name); - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(volumeGroup.object); - - var svcModel = $scope.service.modelByInvariantUuid; - var vnfModelInvariantUuid = vnf.object["persona-model-id"]; - var vnfModelVersion = vnf.object["persona-model-version"]; - var vnfModel = null; - - var volGroupModelInvariantUuid = null; - var volGroupModelVersion = null; - - // send an empty model by default since model is not required for deletes - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {}); - - if ( (volumeGroup.object != null) && ( volumeGroup.object["persona-model-id"] != null ) && - (volumeGroup.object["persona-model-version"] != null) ) { - - volGroupModelInvariantUuid = volumeGroup.object["persona-model-id"]; - volGroupModelVersion = volumeGroup.object["persona-model-version"]; - - if (svcModel != null && vnfModelInvariantUuid != null && vnfModelVersion != null ) { - console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.modelByInvariantUuid.vnfs, null, 4) ); - if ( ($scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid] != null) && - ($scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]) != null ) { - - vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - if ( (vnfModel.volumeGroups != null) && ( vnfModel.volumeGroups[volGroupModelInvariantUuid] != null ) - && ( vnfModel.volumeGroups[volGroupModelInvariantUuid][volGroupModelVersion] != null ) ) { - - var volumeGroupModel = vnfModel.volumeGroups[volGroupModelInvariantUuid][volGroupModelVersion]; - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volumeGroupModel.invariantUuid, - "modelVersion": volumeGroupModel.version, - "modelNameVersionId": volumeGroupModel.uuid, - "modelName": volumeGroupModel.name, - "modelCustomizationName": volumeGroupModel.modelCustomizationName, - "inputs": "" - }); - } - } - } - } - - DataService.setVnfInstanceId(vnf.object['vnf-id']); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - DataService.setGlobalCustomerId(serviceObject['globalCustomerId']); - DataService.setServiceInstanceName($scope.service.instance.name); - - DataService.setServiceName($scope.service.model.service.name); - - DataService.setServiceUuid($scope.service.model.service.uuid); - DataService.setVnfInstanceId(vnf.nodeId); - DataService.setVolumeGroupInstanceId(volumeGroup.nodeId); - - //DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME"); - - $scope.$broadcast("deleteComponent", { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : deleteCallbackFunction - }); - }; - - $scope.describeNetwork = function(serviceObject, networkObject) { - var serviceInstance = serviceObject.object; - var network = networkObject.object; - - //Display popup with additional network information - DataService.setNetworkInstanceId(network['network-id']); - DataService.setInventoryItem(network); - //DataService.setModelInfo(network['network-id'], network); - - DataService.setSubscriberName(serviceObject['subscriber-name']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - //DataService.setVnfInstanceId("Testing"); - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.NETWORK - }); - }; - - // for service instance id - no need for this! - $scope.describeService = function(serviceObject) { - var serviceInstance = serviceObject.object; - - DataService.setInventoryItem(serviceInstance); - //DataService.setModelInfo(serviceInstance['service-instance-id'], serviceInstance); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - //Display popup with additional service information - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.SERVICE - }); - - }; - - $scope.describeVfModule = function(serviceObject, vfModuleObject) { - var serviceInstance = serviceObject.object; - var vfModule = vfModuleObject.object; - - //Display popup with additional VF-Module information - DataService.setVfModuleInstanceId(vfModule['vf-module-id']); - DataService.setInventoryItem(vfModule); - //DataService.setModelInfo(vfModule['vf-module-id'], vfModule); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.VF_MODULE - }); - }; - - $scope.describeVnf = function(serviceObject, vnfObject) { - var serviceInstance = serviceObject.object; - var vnf = vnfObject.object; - - //Display popup with additional VNF information - DataService.setVnfInstanceId(vnf['vnf-id']); - DataService.setInventoryItem(vnf); - //DataService.setModelInfo(vnf['vnf-id'], vnf); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.VNF - }); - }; - - $scope.describeVolumeGroup = function(serviceObject, volumeGroupObject) { - var serviceInstance = serviceObject.object; - var volumeGroup = volumeGroupObject.object; - - DataService.setVolumeGroupInstanceId(volumeGroup['volume-group-id']); - DataService.setInventoryItem(volumeGroup); - DataService.setModelInfo(volumeGroup['volume-group-id'], volumeGroup); - - DataService.setSubscriberName(serviceObject['subscriberName']); - DataService.setServiceType(serviceObject['serviceType']); - DataService.setServiceInstanceId(serviceInstance['service-instance-id']); - - //Display popup with additional Volume Group information - //DataService.setVnfInstanceId("Testing"); - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.VOLUME_GROUP - }); - }; - - $scope.addNetworkInstance = function(network) { - console.log("Unsupported in 1610: Adding Network instance of type " + network.name + " to service instance" + this.service.instance.name); - }; - - $scope.addVnfInstance = function(vnf) { - //console.log ("addVnfInstance invoked VNF="); console.log (JSON.stringify (vnf,null,4)); - - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - DataService.setModelInfo(COMPONENT.VNF, { - "modelType": "vnf", - "modelInvariantId": vnf.invariantUuid, - "modelVersion": vnf.version, - "modelNameVersionId": vnf.uuid, - "modelName": vnf.name, - "modelCustomizationName": vnf.modelCustomizationName, - "inputs": "" - }); - - DataService.setModelInstanceName($scope.service.model.service.name); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - $scope.$broadcast("createComponent", { - componentId : COMPONENT.VNF, - callbackFunction : createVnfCallbackFunction - }); - }; - - $scope.addVfModuleInstance = function(vnfInstance, vfModuleModel) { - - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - var vnfModelInvariantUuid = vnfInstance.object["persona-model-id"]; - var vnfModelVersion = vnfInstance.object["persona-model-version"]; - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - var availableVolumeGroupList = []; - angular.forEach(vnfInstance["availableVolumeGroups"], function(volumeGroupInstance, key) { - availableVolumeGroupList.push({"instance": volumeGroupInstance}); - }); - - if (vfModuleModel.volumeGroupAllowed) { - DataService.setAvailableVolumeGroupList(availableVolumeGroupList); - } - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - DataService.setVnfInstanceId(vnfInstance.object["vnf-id"]); - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelName": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "inputs": "" - }); - - DataService.setModelInfo(COMPONENT.VF_MODULE, { - "modelInvariantId": vfModuleModel.invariantUuid, - "modelVersion": vfModuleModel.version, - "modelNameVersionId": vfModuleModel.uuid, - "modelName": vfModuleModel.name, - "inputs": "" - }); - - $scope.$broadcast("createComponent", { - componentId : COMPONENT.VF_MODULE, - callbackFunction : createVfModuleCallbackFunction - }); - - }; - - $scope.addVolumeGroupInstance = function(vnfInstance, volumeGroupModel) { - - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - DataService.setServiceName($scope.service.model.service.name); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - DataService.setVnfInstanceId(vnfInstance.object["vnf-id"]); - - var vnfModelInvariantUuid = vnfInstance.object["persona-model-id"]; - var vnfModelVersion = vnfInstance.object["persona-model-version"]; - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelName": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "inputs": "" - }); - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volumeGroupModel.invariantUuid, - "modelVersion": volumeGroupModel.version, - "modelNameVersionId": volumeGroupModel.uuid, - "modelName": volumeGroupModel.name, - "inputs": "" - }); - - $scope.$broadcast("createComponent", { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : createVolumeGroupCallbackFunction - }); - }; - - $scope.attachVolumeGroupInstance = function(vfModuleInstance, volumeGroupInstance) { - - var vnfInstance = this.vnf; - var vnfModelInvariantUuid = vnfInstance.object["persona-model-id"]; - var vnfModelVersion = vnfInstance.object["persona-model-version"]; - var vnfModel = $scope.service.modelByInvariantUuid.vnfs[vnfModelInvariantUuid][vnfModelVersion]; - - var vfModuleModelInvariantUuid = vfModuleInstance.object["persona-model-id"]; - var vfModuleVersion = vfModuleInstance.object["persona-model-version"]; - var vfModuleModel = vnfModel.vfModules[vfModuleModelInvariantUuid][vfModuleVersion]; - - var volumeGroupModelInvariantUuid = volumeGroupInstance.object["persona-model-id"]; - var volumeGroupModelVersion = volumeGroupInstance.object["persona-model-version"]; - var volumeGroupModel = vnfModel.volumeGroups[volumeGroupModelInvariantUuid][volumeGroupModelVersion]; - - if (vfModuleModel.uuid != volumeGroupModel.uuid) alert("Cannot attach this volume group to this VF module (models do not match)"); - - DataService.setSubscriberName($scope.service.instance.subscriberName); - DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId); - DataService.setServiceName($scope.service.model.name); - DataService.setServiceType($scope.service.instance.serviceType); - DataService.setServiceInstanceName($scope.service.instance.name); - DataService.setServiceInstanceId($scope.service.instance.id); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": $scope.service.model.service.invariantUuid, - "modelVersion": $scope.service.model.service.version, - "modelNameVersionId": $scope.service.model.service.uuid, - "modelName": $scope.service.model.service.name, - "inputs": "" - }); - - DataService.setVnfInstanceId(vnfInstance.object["vnf-id"]); - - DataService.setModelInfo(COMPONENT.VNF, { - "modelInvariantId": vnfModel.invariantUuid, - "modelVersion": vnfModel.version, - "modelNameVersionId": vnfModel.uuid, - "modelName": vnfModel.name, - "modelCustomizationName": vnfModel.modelCustomizationName, - "inputs": "" - }); - - DataService.setModelInfo(COMPONENT.VOLUME_GROUP, { - "modelInvariantId": volumeGroupModel.invariantUuid, - "modelVersion": volumeGroupModel.version, - "modelNameVersionId": volumeGroupModel.uuid, - "modelName": volumeGroupModel.name, - "inputs": "" - }); - - $scope.$broadcast("createComponent", { - componentId : COMPONENT.VOLUME_GROUP, - callbackFunction : createVolumeGroupCallbackFunction - }); - /* - * Code to manipulate the angular ui-tree - var volumeGroups = this.vnf.volumeGroups; - volumeGroups.splice(volumeGroups.indexOf(volumeGroup), 1); - vfModule.volumeGroups.push(volumeGroup); - */ - }; - - $scope.resetProgress = function() { - $scope.percentProgress = 0; - $scope.progressClass = "progress-bar progress-bar-info"; - }; - - $scope.setProgress = function(percentProgress) { - percentProgress = parseInt(percentProgress); - if (percentProgress >= 100) { - $scope.progressClass = "progress-bar progress-bar-success"; - } - - if (percentProgress < $scope.percentProgress) { - return; - } - - $scope.percentProgress = percentProgress; - $scope.progressWidth = {width: percentProgress + "%"}; - if (percentProgress >= 5) { - $scope.progressText = percentProgress + " %"; - } else { - // Hidden since color combination is barely visible when progress portion is narrow. - $scope.progressText = ""; - } - }; - - $scope.reloadRoute = function() { - $route.reload(); - } - - var createVnfCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = "none"; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + " isSuccessful: " + response.isSuccessful; - if (response.isSuccessful) { - color = "#8F8"; - $scope.reloadRoute(); - } else { - color = "#F88"; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - - - }; - - var deleteCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = "none"; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + " isSuccessful: " + response.isSuccessful; - if (response.isSuccessful) { - color = "#8F8"; - $scope.reloadRoute(); - } else { - color = "#F88"; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var createVfModuleCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = "none"; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + " isSuccessful: " + response.isSuccessful; - if (response.isSuccessful) { - color = "#8F8"; - $scope.reloadRoute(); - } else { - color = "#F88"; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var deleteServiceInstanceCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = "none"; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + " isSuccessful: " + response.isSuccessful; - if (response.isSuccessful) { - color = "#8F8"; - $location.path("/instances/services") - } else { - color = "#F88"; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - }; - - var createVolumeGroupCallbackFunction = function(response) { - $scope.callbackResults = ""; - var color = "none"; - $scope.callbackStyle = { - "background-color" : color - }; - - /* - * This 1/2 delay was only added to visually highlight the status - * change. Probably not needed in the real application code. - */ - $timeout(function() { - $scope.callbackResults = UtilityService.getCurrentTime() - + " isSuccessful: " + response.isSuccessful; - if (response.isSuccessful) { - color = "#8F8"; - $scope.reloadRoute(); - } else { - color = "#F88"; - } - $scope.callbackStyle = { - "background-color" : color - }; - }, 500); - - - - }; - - }); -})(); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js deleted file mode 100644 index 855c23dde..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js +++ /dev/null @@ -1,196 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -(function () { - 'use strict'; - - app.controller("ServiceModelController", function ($scope, $http, $location, COMPONENT, DataService, vidService, - PropertyService) { - - $scope.popup = {}; - var re = /.*?:\/\/.*?:.*?\/(.*?)\//g; - var baseEndpoint = re.exec($location.absUrl())[1]; - - $scope.getServiceModels = function() { - $scope.status = "Fetching service catalog from ASDC. Please wait."; - $http.get('/' + baseEndpoint + '/rest/models/services?distributionStatus=DISTRIBUTED') - .then(function(response) { - $scope.services = []; - if (angular.isArray(response.data)) { - $scope.services = response.data; - $scope.viewPerPage=10; - $scope.totalPage=$scope.services.length/$scope.viewPerPage; - $scope.sortBy="name"; - $scope.scrollViewPerPage=2; - $scope.currentPage=1; - $scope.searchCategory; - $scope.searchString=""; - $scope.currentPageNum=1; - $scope.isSpinnerVisible = false; - $scope.isProgressVisible = false; - } else { - $scope.status = "Failed to get service models from ASDC."; - $scope.error = true; - $scope.isSpinnerVisible = false; - } - }, function (response) { - console.log("Error: " + response); - }); - } - $scope.init = function() { - // takes a default value, retrieves the prop value from the file system and sets it - var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(1000); - PropertyService.setMsoMaxPollingIntervalMsec(msecs); - - // takes a default value, retrieves the prop value from the file system and sets it - var polls = PropertyService.retrieveMsoMaxPolls(7); - PropertyService.setMsoMaxPolls(polls); - - //PropertyService.setMsoBaseUrl("testmso"); - PropertyService.setServerResponseTimeoutMsec(10000); - } - - $scope.prevPage = function() { - $scope.currentPage--; - } - - $scope.nextPage = function() { - $scope.currentPage++; - } - - $scope.deployService = function(service) { - - console.log("Instantiating ASDC service " + service.uuid); - - $http.get('/' + baseEndpoint + '/rest/models/services/' + service.uuid) - .then(function successCallback(getServiceResponse) { - - var serviceModel = getServiceResponse.data; - DataService.setServiceName(serviceModel.service.name); - - DataService.setModelInfo(COMPONENT.SERVICE, { - "modelInvariantId": serviceModel.service.invariantUuid, - "modelVersion": serviceModel.service.version, - "modelNameVersionId": serviceModel.service.uuid, - "modelName": serviceModel.service.name, - "description": serviceModel.service.description, - "category":serviceModel.service.category - }); - - $scope.$broadcast("createComponent", { - componentId : COMPONENT.SERVICE, - callbackFunction : function(response) { - if (response.isSuccessful) { - vidService.setModel(serviceModel); - - var subscriberId = "Not Found"; - var serviceType = "Not Found"; - - var serviceInstanceId = response.instanceId; - - for (var i = 0; i < response.control.length; i++) { - if (response.control[i].id == "subscriberName") { - subscriberId = response.control[i].value; - } else if (response.control[i].id == "serviceType") { - serviceType = response.control[i].value; - } - } - - - $scope.refreshSubs(subscriberId,serviceType,serviceInstanceId); - - } - } - }); - - }, function errorCallback(response) { - console.log("Error: " + response); - }); - }; - - $scope.refreshSubs = function(subscriberId, serviceType, serviceInstanceId) { - $scope.status = "Fetching subscriber list from A&AI..."; - $scope.init(); - $http.get( PropertyService.getAaiBaseUrl() + "/aai_refresh_full_subscribers", { - - },{ - timeout: $scope.responseTimeoutMsec - }).then(function(response){ - - if (response.data.status < 200 || response.data.status > 202) { - $scope.showError("MSO failure - see log below for details") - return; - } - - $scope.customer = response.data.customer; // get data from json - - $scope.customerList = []; - - $scope.serviceInstanceToCustomer = []; - - angular.forEach($scope.customer, function(subVal, subKey) { - var cust = { "globalCustomerId": subVal["global-customer-id"], "subscriberName": subVal["subscriber-name"] }; - $scope.customerList.push(cust); - if (subVal["service-subscriptions"] != null) { - angular.forEach(subVal["service-subscriptions"]["service-subscription"], function(serviceSubscription, key) { - $scope.serviceInstanceId = []; - if (serviceSubscription["service-type"] != null) { - $scope.serviceType = serviceSubscription["service-type"]; - } else { - $scope.serviceType = "No Service Subscription Found"; - } - if (serviceSubscription["service-instances"] != null) { - angular.forEach(serviceSubscription["service-instances"]["service-instance"], function(instValue, instKey) { - var foo = { "serviceInstanceId": instValue["service-instance-id"], - "globalCustomerId": subVal["global-customer-id"], - "subscriberName": subVal["subscriber-name"] }; - $scope.serviceInstanceToCustomer.push(foo); - }); - } - }); - } - }); - DataService.setServiceInstanceToCustomer($scope.serviceInstanceToCustomer); - var serviceIdList = []; - $http.get(PropertyService.getAaiBaseUrl() + "/aai_get_services", { - },{ - timeout: $scope.responseTimeoutMsec - }).then(function(response) { - angular.forEach(response.data, function(value, key) { - angular.forEach(value, function(subVal, key) { - var newVal = { "id" : subVal["service-id"], "description" : subVal["service-description"] }; - serviceIdList.push(newVal); - DataService.setServiceIdList(serviceIdList); - - $location.search({ - "subscriberId": subscriberId, - "serviceType": serviceType, - "serviceInstanceId": serviceInstanceId - }); - - $location.path("/instantiate"); - }); - }); - }); - }) - ["catch"]($scope.handleServerError); - }; - }); -})(); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/VidApp.js b/vid/src/main/webapp/app/vid/scripts/controller/VidApp.js deleted file mode 100644 index acc185cf8..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/VidApp.js +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -(function () { - 'use strict'; - - app.config(['$routeProvider', '$locationProvider', function ($routeProvider) { - $routeProvider - .when('/models/services', { - controller: 'ServiceModelController', - templateUrl: 'app/vid/scripts/view-models/serviceModels.htm' - }) - .when('/instances/services', { - templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm", - controller : "aaiSubscriberController" - }) - .when('/instances/subdetails', { - templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm", - controller : "aaiSubscriberController" - }) - .when('/instantiate', { - controller: 'InstantiationController', - templateUrl: 'app/vid/scripts/view-models/instantiate.htm' - }) - .otherwise({ - redirectTo: '/models/services' - }); - }]); - - app.service('vidService', function() { - var _model = undefined; - var _instance = undefined; - - this.setModel = function(model) { - _model = model; - }; - - this.getModel = function() { - return _model; - }; - - this.setInstance = function(instance) { - _instance = instance; - }; - - this.getInstance = function() { - return _instance; - }; - }); -})(); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js deleted file mode 100644 index aa3b5223a..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js +++ /dev/null @@ -1,763 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -app.controller("aaiSubscriberController", [ "COMPONENT", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "UtilityService", "vidService", - function(COMPONENT, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, UtilityService, vidService) { - - $scope.showVnfDetails = function(vnf) { - console.log("showVnfDetails"); - DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345"); - DataService - .setInventoryItem(aaiResult["inventory-response-items"]["inventory-response-item"][0]); - - $scope.$broadcast("showComponentDetails", { - componentId : COMPONENT.VNF, - callbackFunction : callbackFunction - }); - } - $scope.popup = new Object(); - - - $scope.isPopupVisible = false; - $scope.defaultBaseUrl = ""; - $scope.responseTimeoutMsec = 60000; - - $scope.serviceTypes=[ "Select a service type" ]; - $scope.defaultSubscriberName=[ "Select a subscriber name" ]; - - var callbackFunction = function(response) { - alert(response); - }; - - $scope.getSubs = function() { - $scope.status = "Fetching subscriber list from A&AI..."; - $scope.init(); - $http.get( PropertyService.getAaiBaseUrl() + "/aai_get_full_subscribers" + '?r=' + Math.random(), { - - },{ - timeout: $scope.responseTimeoutMsec - }).then($scope.handleInitialResponse) - ["catch"]($scope.handleServerError); - var serviceIdList = []; - $http.get(PropertyService.getAaiBaseUrl() + "/aai_get_services" + '?r=' + Math.random(), { - },{ - timeout: $scope.responseTimeoutMsec - }).then(function(response) { - angular.forEach(response.data, function(value, key) { - angular.forEach(value, function(subVal, key) { - var newVal = { "id" : subVal["service-id"], "description" : subVal["service-description"] }; - serviceIdList.push(newVal); - DataService.setServiceIdList(serviceIdList); - }); - }); - }); - }; - - $scope.refreshSubs = function() { - $scope.status = "Fetching subscriber list from A&AI..."; - $scope.init(); - $http.get(PropertyService.getAaiBaseUrl() + "/aai_refresh_full_subscribers" + '?r=' + Math.random(), { - - },{ - timeout: $scope.responseTimeoutMsec - }).then($scope.handleInitialResponse) - ["catch"]($scope.handleServerError); - }; - - $scope.getSubDetails = function(request) { - - $scope.init(); - $scope.selectedSubscriber = $location.search().selectedSubscriber; - $scope.selectedServiceInstance = $location.search().selectedServiceInstance; - $scope.status = "Fetching subscriber details from A&AI for " + $scope.selectedSubscriber; - $http.get(PropertyService.getAaiBaseUrl() + "/aai_sub_details/" + $scope.selectedSubscriber + '?r=' + Math.random(), { - - },{ - timeout: $scope.responseTimeoutMsec - }).then(function(response) { - $scope.subscriber = response.data; - $scope.selectedSubscriberName = $scope.subscriber["subscriber-name"]; - - $scope.displayData= []; - if ($scope.subscriber["service-subscriptions"] != null) { - angular.forEach($scope.subscriber["service-subscriptions"]["service-subscription"], function(serviceSubscription, key) { - $scope.serviceInstanceId = []; - if (serviceSubscription["service-type"] != null) { - $scope.serviceType = serviceSubscription["service-type"]; - } else { - $scope.serviceType = "No Service Subscription Found"; - } - if (serviceSubscription["service-instances"] != null) { - angular.forEach(serviceSubscription["service-instances"]["service-instance"], function(instValue, instKey) { - // put them together, i guess - var inst = { "serviceInstanceId": instValue["service-instance-id"], - "personaModelId": instValue["persona-model-id"], - "personaModelVersion": instValue["persona-model-version"], - "serviceInstanceName": instValue["service-instance-name"] - }; - if ($scope.selectedServiceInstance != null) { - if (instValue["service-instance-id"] == $scope.selectedServiceInstance) { - $scope.serviceInstanceId.push(inst); - } - } else { - $scope.serviceInstanceId.push(inst); - } - }); - } else { - if ($scope.serviceInstanceId == []) { - $scope.serviceInstanceId = [ "No Service Instance Found" ]; - } - } - angular.forEach($scope.serviceInstanceId, function(subVal, subKey) { - $scope.displayData.push({ - globalCustomerId : $scope.selectedSubscriber, - subscriberName : $scope.selectedSubscriberName, - serviceType : $scope.serviceType, - serviceInstanceId : subVal.serviceInstanceId, - personaModelId : subVal.personaModelId, - personaModelVersion : subVal.personaModelVersion, - serviceInstanceName : subVal.serviceInstanceName - }); - }); - }); - } else { - $scope.displayData.push({ - globalCustomerId : $scope.selectedSubscriber, - subscriberName : $scope.selectedSubscriberName, - serviceType : "No Service Subscription Found", - serviceInstanceId : "No Service Instance Found" - }); - } - $scope.viewPerPage=10; - $scope.totalPage=$scope.displayData.length/$scope.viewPerPage; - $scope.scrollViewPerPage=2; - $scope.currentPage=1; - $scope.searchCategory; - $scope.searchString=""; - $scope.currentPageNum=1; - $scope.defaultSort="subscriberName" - $scope.setProgress(100); // done - $scope.status = "Done"; - $scope.isSpinnerVisible = false; - }); - } - - - $scope.$on("deleteInstance", function(event, request) { - // $log.debug("deleteInstance: request:"); - // $log.debug(request); - $scope.init(); - // Use this line instead of the subsequent $http.post to change from POST to DELETE - // $http["delete"]($scope.baseUrl + request.url,{timeout: $scope.responseTimeoutMsec}).then($scope.requestOkay - $http.post($scope.baseUrl + request.url, { - requestDetails: request.requestDetails - },{ - timeout: $scope.responseTimeoutMsec - }).then($scope.handleInitialResponse) - ["catch"]($scope.handleServerError); - }); - - $scope.init = function() { - - //PropertyService.setAaiBaseUrl("testaai"); - //PropertyService.setAsdcBaseUrl("testasdc"); - - // takes a default value, retrieves the prop value from the file system and sets it - var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(1000); - PropertyService.setMsoMaxPollingIntervalMsec(msecs); - - // takes a default value, retrieves the prop value from the file system and sets it - var polls = PropertyService.retrieveMsoMaxPolls(7); - PropertyService.setMsoMaxPolls(polls); - - //PropertyService.setMsoBaseUrl("testmso"); - PropertyService.setServerResponseTimeoutMsec(10000); - - /* - * Common parameters that would typically be set when the page is - * displayed for a specific service instance id. - */ - -// DataService.setSubscriberName("Mobility"); -// DataService.setGlobalCustomerId("CUSTID12345") -// DataService.setServiceType("Mobility Type 1"); -// DataService.setServiceName("Mobility Service 1"); -// DataService.setServiceInstanceId("mmsc-test-service-instance"); - - $scope.baseUrl = $scope.defaultBaseUrl; - - $scope.isSpinnerVisible = true; - $scope.isProgressVisible = true; - $scope.isPopupVisible = true; - $scope.requestId = ""; - $scope.error = ""; - $scope.pollAttempts = 0; - $scope.log = ""; - $scope.enableCloseButton(false); - $scope.resetProgress(); - $scope.setProgress(2); // Show "a little" progress - } - - $scope.getComponentList = function(event, request) { - - $scope.isSpinnerVisible = true; - $scope.isProgressVisible = true; - $scope.isPopupVisible = true; - $scope.requestId = ""; - $scope.error = ""; - $scope.pollAttempts = 0; - $scope.log = ""; - - $scope.resetProgress(); - $scope.setProgress(2); // Show "a little" progress - - //subscriberId=jimmy-testing&serviceType=gamma-01%2F1&serviceInstanceId=jimmy2-01%2F01%2F%2F01 - $scope.globalCustomerId = $location.search().subscriberId; - $scope.serviceType = $location.search().serviceType; - $scope.serviceInstanceId = $location.search().serviceInstanceId; - - //$scope.getAsdcModel($location.search().modelUuid); - - // this should be in a config file? - $scope.namedQueryId = "ed0a0f5b-cf79-4784-88b2-911cd726cd3d"; - $scope.url = PropertyService.getAaiBaseUrl() + "/aai_sub_viewedit" + - "/" + encodeURIComponent($scope.namedQueryId) + - "/" + encodeURIComponent($scope.globalCustomerId) + - "/" + encodeURIComponent($scope.serviceType) + - "/" + encodeURIComponent($scope.serviceInstanceId) + '?r=' + Math.random(); - - $scope.status = "Fetching service instance data from A&AI for service-instance-id=" + $scope.serviceInstanceId; - $http.get($scope.url, { - },{ - timeout: $scope.responseTimeoutMsec - }).then($scope.handleInitialResponseInventoryItems) - ["catch"]($scope.handleServerError); - } - - $scope.handleServerError = function(response, status) { - alert(response.statusText); - } - - $scope.getAsdcModel = function(disData) { - $http.get(PropertyService.getAaiBaseUrl() + '/rest/models/services') - .then(function successCallback(response) { - var myUuid = null; - var lastVersion = -1; - angular.forEach(response.data, function(model, key) { - if (angular.equals(model.invariantUUID,disData.personaModelId)) { - if (model.version > lastVersion) { - lastVersion = model.version; - myUuid = model.uuid; - } - - } - }); - if (myUuid == null) - { - console.log("aaiSubscriber getAsdcModel - No matching model found matching the persona Model Id = " + disData.personaModelId); - } - else - { - console.log(myUuid); - $http.get(PropertyService.getAaiBaseUrl() + '/rest/models/services/' + myUuid) - .then(function successCallback(response2) { - vidService.setModel(response2.data); - window.location.href = "#/instantiate?subscriberId=" + disData.globalCustomerId + "&serviceType=" + disData.serviceType + "&serviceInstanceId=" + disData.serviceInstanceId; - console.log("aaiSubscriber getAsdcModel DONE!!!!"); - }); - } - }, function errorCallback(response) { - //TODO - }); - } - - $scope.getTenants = function(globalCustomerId) { - $http.get(PropertyService.getAaiBaseUrl() + '/aai_get_tenants' + globalCustomerId + '?r=' + Math.random()) - .then(function successCallback(response) { - return response.data; - //$location.path("/instantiate"); - }, function errorCallback(response) { - //TODO - }); - } - - $scope.handleInitialResponseInventoryItems = function(response) { - // $log.debug("handleInitialResponse: response contents:"); - // $log.debug(response); - try { - - if (response.status < 200 || response.status > 202) { - $scope.handleServerError(response, response.status); - return; - } - - $scope.inventoryResponseItemList = response.data["inventory-response-item"]; // get data from json - console.log($scope.inventoryResponseItemList.toString()); - - $scope.displayData = []; - $scope.vnfs = []; - - $scope.counter = 100; - - angular.forEach($scope.inventoryResponseItemList, function(inventoryResponseItem, key) { - - $scope.inventoryResponseItem = inventoryResponseItem; - - $scope.serviceInstanceToCustomer = DataService.getServiceInstanceToCustomer(); - var subscriberName = ""; - angular.forEach($scope.serviceInstanceToCustomer, function(servInst, key2) { - if (servInst.serviceInstanceId === $scope.serviceInstanceId) { - subscriberName = servInst.subscriberName; - } - }); - $scope.service.instance = { - "name": $scope.inventoryResponseItem["service-instance"]["service-instance-name"], - "serviceInstanceId": $scope.serviceInstanceId, - "serviceType": $scope.serviceType, - "globalCustomerId": $scope.globalCustomerId, - "subscriberName": subscriberName, - "id": $scope.serviceInstanceId, - "inputs": { - "a": { - "type": "String", - "description": "This variable is 'a'", - "default": "A default" - }, - "b": { - "type": "String", - "description": "This variable is 'b'", - "default": "B default" - }, - }, - "object": $scope.inventoryResponseItem["service-instance"], - "vnfs": [], - "networks": [] - } - - if (inventoryResponseItem["inventory-response-items"] != null) { - - angular.forEach(inventoryResponseItem["inventory-response-items"]["inventory-response-item"], function(subInventoryResponseItem, key) { - // i expect to find vnfs now - - if (subInventoryResponseItem["l3-network"] != null) { - var l3NetworkObject = subInventoryResponseItem["l3-network"]; - var l3Network = { "id": $scope.counter++, - "name": l3NetworkObject["network-name"], - "itemType": "l3-network", - "nodeId": l3NetworkObject["network-id"], - "nodeType": l3NetworkObject["network-type"], - "nodeStatus": l3NetworkObject["orchestration-status"], - "object": l3NetworkObject, - "nodes": [] - }; - $scope.service.instance["networks"].push(l3Network); - } - - if (subInventoryResponseItem["generic-vnf"] != null) { - var genericVnfObject = subInventoryResponseItem["generic-vnf"]; - - var genericVnf = { - "name": genericVnfObject["vnf-name"], - "id": $scope.counter++, - "itemType": "vnf", - "nodeType": genericVnfObject["vnf-type"], - "nodeId": genericVnfObject["vnf-id"], - "nodeStatus": genericVnfObject["orchestration-status"], - "object": genericVnfObject, - "vfModules": [], - "volumeGroups": [], - "availableVolumeGroups": [] - }; - $scope.service.instance["vnfs"].push(genericVnf); - - // look for volume-groups - if (subInventoryResponseItem["inventory-response-items"] != null) { - angular.forEach(subInventoryResponseItem["inventory-response-items"]["inventory-response-item"], function(vfmodules, key) { - - if (vfmodules["volume-group"] != null) { - var volumeGroupObject = vfmodules["volume-group"]; - var volumeGroup = { "id": $scope.counter++, - "name": volumeGroupObject["volume-group-name"], - "itemType": "volume-group", - "nodeId": volumeGroupObject["volume-group-id"], - "nodeType": volumeGroupObject["vnf-type"], - "nodeStatus": volumeGroupObject["orchestration-status"], - "object": volumeGroupObject, - "nodes": [] - }; - genericVnf["volumeGroups"].push(volumeGroup); - genericVnf["availableVolumeGroups"].push(volumeGroup); - } - }); - } - // now we've loaded up the availableVolumeGroups, we can use it - if (subInventoryResponseItem["inventory-response-items"] != null) { - angular.forEach(subInventoryResponseItem["inventory-response-items"]["inventory-response-item"], function(vfmodules, key) { - - if (vfmodules["vf-module"] != null) { - var vfModuleObject = vfmodules["vf-module"]; - var vfModule = { "id": $scope.counter++, - "name": vfModuleObject["vf-module-name"], - "itemType": "vf-module", - "nodeType": "vf-module", - "nodeStatus": vfModuleObject["orchestration-status"], - "volumeGroups": [], - "object": vfModuleObject, - "networks": [] - }; - genericVnf["vfModules"].push(vfModule); - if (vfmodules["inventory-response-items"] != null) { - angular.forEach(vfmodules["inventory-response-items"]["inventory-response-item"], function(networks, key) { - if (networks["l3-network"] != null) { - var l3NetworkObject = networks["l3-network"]; - var l3Network = { "id": $scope.counter++, - "name": l3NetworkObject["network-name"], - "itemType": "l3-network", - "nodeId": l3NetworkObject["network-id"], - "nodeType": l3NetworkObject["network-type"], - "nodeStatus": l3NetworkObject["orchestration-status"], - "object": l3NetworkObject, - "nodes": [] - }; - vfModule["networks"].push(l3Network); - } - if (networks["volume-group"] != null) { - var volumeGroupObject = networks["volume-group"]; - - var volumeGroup = { "id": $scope.counter++, - "name": volumeGroupObject["volume-group-name"], - "itemType": "volume-group", - "nodeId": volumeGroupObject["volume-group-id"], - "nodeType": volumeGroupObject["vnf-type"], - "nodeStatus": volumeGroupObject["orchestration-status"], - "object": volumeGroupObject, - "nodes": [] - }; - var tmpVolGroup = []; - - angular.forEach(genericVnf["availableVolumeGroups"], function(avgroup, key) { - if (avgroup.name != volumeGroup.name) { - tmpVolGroup.push(avgroup); - } - }); - - genericVnf["availableVolumeGroups"] = tmpVolGroup; - - vfModule["volumeGroups"].push(volumeGroup); - } - - }); - } - } - }); - } - } - }); - } - }); - - $scope.setProgress(100); // done - $scope.status = "Done"; - $scope.isSpinnerVisible = false; - console.log("HERE!!!"); - } catch (error) { - console.log(error); - } - } - - $scope.handleInitialResponse = function(response) { - try { - $scope.enableCloseButton(true); - $scope.updateLog(response); - if (response.data.status < 200 || response.data.status > 202) { - $scope.showError("MSO failure - see log below for details") - return; - } - - $scope.setProgress(100); // done - $scope.status = "Done"; - $scope.isSpinnerVisible = false; - - $scope.customer = response.data.customer; // get data from json - - $scope.customerList = []; - - $scope.serviceInstanceToCustomer = []; - //$scope.serviceIdList = []; - angular.forEach($scope.customer, function(subVal, subKey) { - var cust = { "globalCustomerId": subVal["global-customer-id"], "subscriberName": subVal["subscriber-name"] }; - $scope.customerList.push(cust); - if (subVal["service-subscriptions"] != null) { - - - angular.forEach(subVal["service-subscriptions"]["service-subscription"], function(serviceSubscription, key) { - $scope.serviceInstanceId = []; - if (serviceSubscription["service-type"] != null) { -// var newVal = { "id" : serviceSubscription["service-type"], "description" : serviceSubscription["service-type"] }; -// if ($scope.serviceIdList.indexOf(newVal) == -1) { -// $scope.serviceIdList.push(newVal); -// } - $scope.serviceType = serviceSubscription["service-type"]; - } else { - $scope.serviceType = "No Service Subscription Found"; - } - if (serviceSubscription["service-instances"] != null) { - angular.forEach(serviceSubscription["service-instances"]["service-instance"], function(instValue, instKey) { - var foo = { "serviceInstanceId": instValue["service-instance-id"], - "globalCustomerId": subVal["global-customer-id"], - "subscriberName": subVal["subscriber-name"] }; - $scope.serviceInstanceToCustomer.push(foo); - }); - } - }); - } - }); -// DataService.setServiceIdList($scope.serviceIdList); - DataService.setServiceInstanceToCustomer($scope.serviceInstanceToCustomer); - } catch (error) { - $scope.showContentError(error); - } - } - - $scope.autoGetSubs = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $scope.getSubs(); - - } - - $scope.pollStatus = function () { - /* - * The "?r=" argument overrides caching. This was needed for Internet Explorer 11. - * - * Ideally this should NOT be needed and appears to be an Angular bug. - */ - $http.get($scope.baseUrl + "mso_get_orch_req/" + $scope.requestId + "?r=" + Math.random(), { - cache: false, // This alternative did NOT seem to disable caching but was retained as a reference - timeout: $scope.responseTimeoutMsec - }).then($scope.handlePollResponse) - ["catch"]($scope.handleServerError); - } - - $scope.handlePollResponse = function(response) { - try { - // $log.debug("handlePollResponse: response contents:"); - // $log.debug(response); - $scope.updateLog(response); - - if (response.data.status < 200 || response.data.status > 202) { - $scope.showError("MSO failure - see log below for details") - return; - } - -// UtilityService.checkUndefined("request", response.data.entity.request); -// UtilityService.checkUndefined("requestStatus", response.data.entity.request.requestStatus); - -// $scope.setProgress(response.data.entity.request.requestStatus.percentProgress); - -// var requestState = response.data.entity.request.requestStatus.requestState; -// if (requestState == "InProgress") { -// requestState = "In Progress"; -// } -// var statusMessage = response.data.entity.request.requestStatus.statusMessage; -// if (UtilityService.hasContents(statusMessage)) { -// $scope.status = requestState + " - " + statusMessage; -// } else { -// $scope.status = requestState; -// } -// if (requestState == "Complete") { -// $scope.isSpinnerVisible = false; -// return; -// } -// if (requestState == "Failure") { -// $scope.showError("MSO failure - see log below for details") -// return; -// } -// if (++$scope.pollAttempts > $scope.properties.msoMaxPolls) { -// $scope.showError("Maximum number of poll attempts exceeded"); -// } else { -// $scope.timer = $timeout($scope.pollStatus, $scope.properties.msoMaxPollingIntervalMsec); -// } - } catch (error) { - $scope.showContentError(error); - } - } - - $scope.updateLog = function(response) { -// $scope.log = UtilityService.getCurrentTime() + " HTTP Status: " + -// UtilityService.getHttpStatusText(response.data.status) + "\n" + -// angular.toJson(response.data.entity, true) + "\n\n" + $scope.log; -// UtilityService.checkUndefined("entity", response.data.entity); -// UtilityService.checkUndefined("status", response.data.status); - } - - $scope.handleServerError = function(response, status) { - $scope.enableCloseButton(true); - var message = UtilityService.getHttpErrorMessage(response); - if (message != ""){ - message = " (" + message + ")"; - } - $scope.showError("System failure" + message); - } - - $scope.showContentError = function(message) { - // $log.debug(message); - console.log(message); - if (UtilityService.hasContents(message)) { - $scope.showError("System failure (" + message + ")"); - } else { - $scope.showError("System failure"); - } - } - - $scope.showError = function(message) { - $scope.isSpinnerVisible = false; - $scope.isProgressVisible = false; - $scope.error = message; - $scope.status = "Error"; - } - - $scope.close = function() { - if ($scope.timer != undefined) { - $timeout.cancel($scope.timer); - } - $scope.isPopupVisible = false; - } - - - - /* - * Consider converting the progress bar mechanism, the disabled button handling - * and the following methods to generic Angular directive(s) and/or approach. - */ - - $scope.enableCloseButton = function(isEnabled) { - var selector = "div[ng-controller=msoCommitController] button"; - - $scope.isCloseEnabled = isEnabled; - - if (isEnabled) { - $(selector).addClass("button--primary").removeClass("button--inactive").attr("btn-type", "primary"); - } else { - $(selector).removeClass("button--primary").addClass("button--inactive").attr("btn-type", "disabled"); - } - } - - $scope.resetProgress = function() { - $scope.percentProgress = 0; - $scope.progressClass = "progress-bar progress-bar-info"; - } - - $scope.setProgress = function(percentProgress) { - percentProgress = parseInt(percentProgress); - if (percentProgress >= 100) { - $scope.progressClass = "progress-bar progress-bar-success"; - } - - if (percentProgress < $scope.percentProgress) { - return; - } - - $scope.percentProgress = percentProgress; - $scope.progressWidth = {width: percentProgress + "%"}; - if (percentProgress >= 5) { - $scope.progressText = percentProgress + " %"; - } else { - // Hidden since color combination is barely visible when progress portion is narrow. - $scope.progressText = ""; - } - } - - $scope.reloadRoute = function() { - $route.reload(); - } - - $scope.prevPage = function() { - $scope.currentPage--; - } - - $scope.nextPage = function() { - $scope.currentPage++; - } - $scope.getSubscriberDet = function(selectedCustomer,selectedServiceInstance){ - if (selectedCustomer != null) { - window.location.href = '#/instances/subdetails?selectedSubscriber=' + selectedCustomer; - } else if (selectedServiceInstance != null) { - selectedServiceInstance.trim(); - var serviceInstanceToCustomer = $scope.serviceInstanceToCustomer; - var notFound = true; - angular.forEach(serviceInstanceToCustomer, function(inst, key) { - if (inst.serviceInstanceId == selectedServiceInstance) { - - notFound = false; - window.location.href = '#/instances/subdetails?selectedSubscriber=' + inst.globalCustomerId + '&selectedServiceInstance=' + selectedServiceInstance; - } - }); - if (notFound) { - alert("That service instance does not exist. Please try again."); - } - } else { - alert("Please select a subscriber or enter a service instance"); - } - }; -} -]); - - -app.controller('TreeCtrl', ['$scope', function ($scope) { - $scope.remove = function (scope) { - scope.remove(); - }; - - $scope.toggle = function (scope) { - scope.toggle(); - }; - - $scope.moveLastToTheBeginning = function () { - var a = $scope.data.pop(); - $scope.data.splice(0, 0, a); - }; - - $scope.newSubItem = function (scope) { - var nodeData = scope.$modelValue; - nodeData.nodes.push({ - id: nodeData.id * 10 + nodeData.nodes.length, - title: nodeData.title + '.' + (nodeData.nodes.length + 1), - nodes: [] - }); - }; - - $scope.collapseAll = function () { - $scope.$broadcast('angular-ui-tree:collapse-all'); - }; - - $scope.expandAll = function () { - $scope.$broadcast('angular-ui-tree:expand-all'); - }; - - -}]); - - - diff --git a/vid/src/main/webapp/app/vid/scripts/controller/creationDialogController.js b/vid/src/main/webapp/app/vid/scripts/controller/creationDialogController.js deleted file mode 100644 index 5e5c51d6e..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/creationDialogController.js +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -var creationDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log, - CreationService, UtilityService) { - - $scope.isDialogVisible = false; - $scope.summaryControl = {}; - $scope.userProvidedControl = {}; - - var callbackFunction = undefined; - var componentId = undefined; - - $scope.$on("createComponent", function(event, request) { - - $scope.isSpinnerVisible = true; - $scope.isErrorVisible = false; - $scope.isDataVisible = false; - $scope.isConfirmEnabled = false; - $scope.isDialogVisible = true; - $scope.popup.isVisible = true; - - callbackFunction = request.callbackFunction; - componentId = request.componentId; - CreationService.initializeComponent(request.componentId); - - CreationService.setHttpErrorHandler(function(response) { - showError("System failure", UtilityService - .getHttpErrorMessage(response)); - }); - - $scope.componentName = CreationService.getComponentDisplayName(); - - CreationService.getParameters(handleGetParametersResponse); - - }); - - var handleGetParametersResponse = function(parameters) { - $scope.summaryControl.setList(parameters.summaryList); - $scope.userProvidedControl.setList(parameters.userProvidedList); - - $scope.isSpinnerVisible = false; - $scope.isDataVisible = true; - $scope.isConfirmEnabled = true; - }; - - var validateInstanceName = function(iname) { - var patt1 = /^([a-z])+([0-9a-z\-_]*)$/i; - - if ( iname == null ){ - return false; - } - if ( !iname.match(patt1) ) { - return false; - } - return true; - } - - $scope.userParameterChanged = function(id) { - CreationService.updateUserParameterList(id, $scope.userProvidedControl); - } - - $scope.confirm = function() { - - var requiredFields = $scope.userProvidedControl.getRequiredFields(); - if (requiredFields !== "") { - showError("Missing data", requiredFields); - return; - } - // validate the instance names for volumeGroup, vfModule, network - - if ( componentId != COMPONENT.SERVICE ) { - var paramList = $scope.userProvidedControl.getList(); - var instanceName = ""; - - if ( paramList != null ) { - for (var i = 0; i < paramList.length; i++) { - if (paramList[i].id === FIELD.ID.INSTANCE_NAME) { - instanceName = paramList[i].value; - break; - } - } - } - var isValid = validateInstanceName (instanceName); - if ( isValid ) { - $scope.isErrorVisible = false; - } else { - showError("Invalid instance name: " + instanceName, - "The instance name must contain only alphanumeric or \"_-.\" characters, and must start with an alphabetic character"); - return; - } - } - var requestDetails = CreationService - .getMsoRequestDetails($scope.userProvidedControl.getList()); - - $scope.isDialogVisible = false; - - $scope.$broadcast("createInstance", { - url : CreationService.getMsoUrl(), - requestDetails : requestDetails, - callbackFunction : function(response) { - if (response.isSuccessful) { - $scope.popup.isVisible = false; - runCallback(response); - } else { - $scope.isDialogVisible = true; - } - } - }); - } - - $scope.cancel = function() { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - runCallback(false); - } - - var runCallback = function(response) { - if (angular.isFunction(callbackFunction)) { - callbackFunction({ - isSuccessful : response.isSuccessful, - control : $scope.userProvidedControl.getList(), - instanceId : response.instanceId - }); - } - } - - var showError = function(summary, details) { - var message = summary; - if (UtilityService.hasContents(details)) { - message += " (" + details + ")"; - } - $scope.isSpinnerVisible = false; - $scope.isErrorVisible = true; - $scope.error = message; - } - -} - -app - .controller("creationDialogController", [ "COMPONENT", "FIELD", "$scope", "$http", - "$timeout", "$log", "CreationService", "UtilityService", - creationDialogController ]); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js b/vid/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js deleted file mode 100644 index caac6de9b..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -var deletionDialogController = function($scope, $http, $timeout, $log, - DeletionService, UtilityService) { - - $scope.isDialogVisible = false; - $scope.summaryControl = {}; - $scope.userProvidedControl = {}; - - var callbackFunction = undefined; - - $scope.$on("deleteComponent", function(event, request) { - - $scope.isDataVisible = false; - $scope.isSpinnerVisible = false; - $scope.isErrorVisible = false; - $scope.isDialogVisible = true; - $scope.popup.isVisible = true; - $scope.isConfirmEnabled = false; - - callbackFunction = request.callbackFunction; - - DeletionService.initializeComponent(request.componentId); - - $scope.componentName = DeletionService.getComponentDisplayName(); - - $scope.summaryControl.setList(DeletionService.getSummaryList()); - - DeletionService.getParameters(handleGetParametersResponse); - - }); - - var handleGetParametersResponse = function(parameters, dontshow) { - $scope.summaryControl.setList(parameters.summaryList); - $scope.userProvidedControl.setList(parameters.userProvidedList); - - $scope.isSpinnerVisible = false; - if (dontshow) - $scope.isDataVisible = false; - else - $scope.isDataVisible = true; - $scope.isConfirmEnabled = true; - }; - - $scope.userParameterChanged = function(id) { - DeletionService.updateUserParameterList(id, $scope.userProvidedControl); - } - - $scope.confirm = function() { - - var requiredFields = $scope.userProvidedControl.getRequiredFields(); - if (requiredFields === "") { - $scope.isErrorVisible = false; - } else { - showError("Missing data", requiredFields); - return; - } - - - var requestDetails = DeletionService.getMsoRequestDetails($scope.userProvidedControl.getList()); - - $scope.isDialogVisible = false; - - $scope.$broadcast("deleteInstance", { - url : DeletionService.getMsoUrl(), - requestDetails : requestDetails, - callbackFunction : function(isSuccessful) { - if (isSuccessful) { - $scope.popup.isVisible = false; - runCallback(true); - } else { - $scope.isDialogVisible = true; - } - } - }); - - } - - $scope.cancel = function() { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - runCallback(false); - } - - var runCallback = function(isSuccessful) { - if (angular.isFunction(callbackFunction)) { - callbackFunction({ - isSuccessful : isSuccessful - }); - } - } -} - -app - .controller("deletionDialogController", [ "$scope", "$http", - "$timeout", "$log", "DeletionService", "UtilityService", - deletionDialogController ]); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js b/vid/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js deleted file mode 100644 index 5f58ae319..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -var detailsDialogController = function($scope, $http, $timeout, $log, - MsoService, DetailsService, UtilityService) { - - $scope.isDialogVisible = false; - $scope.summaryControl = {}; - $scope.detailsControl = {}; - - $scope.$on("showComponentDetails", function(event, request) { - - $scope.log = ""; - $scope.isSpinnerVisible = true; - $scope.isErrorVisible = false; - $scope.isDialogVisible = true; - $scope.popup.isVisible = true; - - DetailsService.initializeComponent(request.componentId); - - $scope.componentName = DetailsService.getComponentDisplayName(); - - $scope.summaryControl.setList(DetailsService.getSummaryList()); - - $scope.detailsControl.setList(DetailsService.getDetailsList()); - - UtilityService.setHttpErrorHandler(function(response) { - showError("System failure", UtilityService - .getHttpErrorMessage(response)); - }); - - MsoService.getOrchestrationRequests( - DetailsService.getMsoFilterString(), handleGetResponse); - }); - - var handleGetResponse = function(response) { - $scope.isSpinnerVisible = false; - try { - $scope.log = MsoService - .getFormattedGetOrchestrationRequestsResponse(response); - } catch (error) { - $scope.log = MsoService.getFormattedCommonResponse(response); - MsoService.showResponseContentError(error, showError); - } - } - - $scope.close = function() { - $scope.isDialogVisible = false; - $scope.popup.isVisible = false; - } - - var showError = function(summary, details) { - var message = summary; - if (UtilityService.hasContents(details)) { - message += " (" + details + ")"; - } - $scope.isSpinnerVisible = false; - $scope.isErrorVisible = true; - $scope.error = message; - } -} - -app.controller("detailsDialogController", [ "$scope", "$http", "$timeout", - "$log", "MsoService", "DetailsService", "UtilityService", - detailsDialogController ]); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/dummy.txt b/vid/src/main/webapp/app/vid/scripts/controller/dummy.txt deleted file mode 100644 index e69de29bb..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/dummy.txt +++ /dev/null diff --git a/vid/src/main/webapp/app/vid/scripts/controller/msoCommitController.js b/vid/src/main/webapp/app/vid/scripts/controller/msoCommitController.js deleted file mode 100644 index ef3adeb32..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/msoCommitController.js +++ /dev/null @@ -1,249 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -/* - * "msoCommitController.js" provides controller code to commit MSO requests. - * - * HIGHLIGHTS: - * - * Parent HTML/JSP code is expected to include "msoCommit.htm" (via - * "ng-include") and this file (via "<script>"). "msoCommit.jsp" (displayed - * when the parent code includes "msoCommit.htm") renders a popup window, but - * initially hides the display. - * - * The parent controller code is expected to broadcast either the - * "createInstance" or "deleteInstance" events when it is ready to commit the - * code. - * - * This controller receives these events (via "$scope.on" declarations), calls - * "$scope.init()" to "unhide" and initialize the popup display and then makes a - * REST request to the appropriate server Java controller. - * - * The initial REST response is handled by "handleInitialResponse". This method - * then polls the server (via "getRequestStatus") if the request is successful. - * - * The subsequent "getRequestStatus" responses are handled by - * "handleGetResponse". - * - * "handleInitialResponse" and "handleGetResponse" primarily filter response - * data, manipulate the display and provide error handling. - * - * The mechanism has these dependencies (in addition to "msoCommit.htm"): - * - * 1) Three services: MsoService, PropertyService and UtilityService - * - * 2) The popup window directive found in "popupWindow.htm" and - * "popupWindowDirective.js" - * - * 2) Display styling defined in "dialogs.css" - * - * CAVEATS: - * - * The parent HTML is assumed to be the "popup-window" directive and the - * corresponding parent controller is assumed to define the object - * "$scope.popup". - */ - -var msoCommitController = function($scope, $http, $timeout, $window, $log, - MsoService, PropertyService, UtilityService, DataService) { - - $scope.isViewVisible = false; - $scope.progressBarControl = {}; - $scope.popupWindowControl = {}; - - var _this = this; - - $scope.$on("createInstance", function(event, request) { - init(request); - MsoService.createInstance(request, handleInitialResponse); - }); - - $scope.$on("deleteInstance", function(event, request) { - init(request); - MsoService.deleteInstance(request, handleInitialResponse); - }); - - var init = function(request) { - $scope.status = "Submitting Request"; - $scope.isSpinnerVisible = true; - $scope.isProgressVisible = true; - $scope.error = ""; - $scope.log = ""; - $scope.isCloseEnabled = false; - $scope.isViewVisible = true; - $scope.popup.isVisible = true; - - _this.pollAttempts = 0; - _this.callbackFunction = request.callbackFunction; - - if (angular.isFunction($scope.progressBarControl.reset)) { - $scope.progressBarControl.reset(); - } - $scope.percentProgress = 2; // Show "a little" progress - - UtilityService.setHttpErrorHandler(function(response) { - $scope.isCloseEnabled = true; - showError("System failure", UtilityService - .getHttpErrorMessage(response)); - }); - } - - var handleInitialResponse = function(response) { - try { - updateViewAfterInitialResponse(response); - _this.timer = $timeout(getRequestStatus, PropertyService - .getMsoMaxPollingIntervalMsec()); - - $scope.instanceId = response.data.entity.instanceId; - if ($scope.instanceId == null) { - $scope.instanceId = response.data.entity.requestReferences.instanceId; - } - } catch (error) { - MsoService.showResponseContentError(error, showError); - } - } - - var getRequestStatus = function() { - MsoService.getOrchestrationRequest(_this.requestId, handleGetResponse); - } - - var handleGetResponse = function(response) { - try { - if (isUpdateViewAfterGetResponseComplete(response)) { - return; - } - console.log ( "msoCommitController _this.pollAttempts=" + _this.pollAttempts + " max polls=" + PropertyService.getMsoMaxPolls()); - if (++_this.pollAttempts > PropertyService.getMsoMaxPolls()) { - showError("Maximum number of poll attempts exceeded"); - } else { - _this.timer = $timeout(getRequestStatus, PropertyService - .getMsoMaxPollingIntervalMsec()); - } - } catch (error) { - MsoService.showResponseContentError(error, showError); - } - } - - var updateViewAfterInitialResponse = function(response) { - $scope.isCloseEnabled = true; - - updateLog(response); - - _this.requestId = UtilityService.checkUndefined("requestId", - UtilityService.checkUndefined("requestReferences", - response.data.entity.requestReferences).requestId); - - $scope.percentProgress = 4; // Show "a little more" progress - $scope.status = "In Progress"; - } - - /* - * Updates the view and returns "true" if the MSO operation has returned a - * "Complete" status. - */ - var isUpdateViewAfterGetResponseComplete = function(response) { - console.log("msoCommitController isUpdateViewAfterGetResponseComplete"); - updateLog(response); - - var requestStatus = UtilityService.checkUndefined("requestStatus", - UtilityService.checkUndefined("request", - response.data.entity.request).requestStatus); - - var requestState = requestStatus.requestState; - console.log("msoCommitController requestState=" + requestState); - // look for "progress" or "pending" - var patt1 = /progress/i; - var patt2 = /pending/i; - var result1 = patt1.test(requestState); - var result2 = patt2.test(requestState) - if (result1 || result2) { - requestState = "In Progress"; - } - var statusMessage = requestStatus.statusMessage; - console.log("msoCommitController statusMessage=" + statusMessage); - if (UtilityService.hasContents(statusMessage)) { - $scope.status = requestState + " - " + statusMessage; - } else { - $scope.status = requestState; - } - if (UtilityService.hasContents(requestStatus.percentProgress)) { - $scope.percentProgress = requestStatus.percentProgress; - } - - if (requestState.toLowerCase() === "Failed".toLowerCase()) { - throw { - type : "msoFailure" - }; - } - - if (requestState.toLowerCase() === "Complete".toLowerCase()) { - $scope.isSpinnerVisible = false; - return true; - } - - return false; - } - - var updateLog = function(response) { - $scope.log = MsoService.getFormattedCommonResponse(response) - + $scope.log; - UtilityService.checkUndefined("entity", response.data.entity); - UtilityService.checkUndefined("status", response.data.status); - MsoService.checkValidStatus(response); - } - - $scope.close = function() { - if (_this.timer !== undefined) { - $timeout.cancel(_this.timer); - } - $scope.isViewVisible = false; - if (angular.isFunction(_this.callbackFunction)) { - if ($scope.error === "") { - _this.callbackFunction({ - isSuccessful : true, - instanceId : $scope.instanceId - }); - } else { - _this.callbackFunction({ - isSuccessful : false - }); - } - } else { - $scope.popup.isVisible = false; - } - } - - var showError = function(summary, details) { - var message = summary; - if (UtilityService.hasContents(details)) { - message += " (" + details + ")"; - } - $scope.isSpinnerVisible = false; - $scope.isProgressVisible = false; - $scope.error = message; - $scope.status = "Error"; - } -} - -app.controller("msoCommitController", [ "$scope", "$http", "$timeout", - "$window", "$log", "MsoService", "PropertyService", "UtilityService", - msoCommitController ]); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/sample-page-controller.js b/vid/src/main/webapp/app/vid/scripts/controller/sample-page-controller.js deleted file mode 100644 index 0f5494556..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/sample-page-controller.js +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -app.controller('samplePageController', function($scope, $http,ProfileService,modalService){ - $scope.tableData=[]; - $scope.viewPerPage=20; - $scope.scrollViewPerPage=2; - $scope.currentPage=1; - $scope.totalPage; - $scope.searchCategory; - $scope.searchString=""; - $scope.currentPageNum=1; - ProfileService.getProfilePagination(1,$scope.viewPerPage).then(function(data){ - var j = data; - $scope.data = JSON.parse(j.data); - $scope.tableData =JSON.parse($scope.data.profileList); - $scope.totalPages =JSON.parse($scope.data.totalPage); - for(x in $scope.tableData){ - if($scope.tableData[x].active_yn=='Y') - $scope.tableData[x].active_yn=true; - else - $scope.tableData[x].active_yn=false; - } - //$scope.resetMenu(); - },function(error){ - console.log("failed"); - reloadPageOnce(); - }); - - $scope.$watch('currentPageNum', function(val) { - - ProfileService.getProfilePagination(val,$scope.viewPerPage).then(function(data){ - var j = data; - $scope.data = JSON.parse(j.data); - $scope.tableData =JSON.parse($scope.data.profileList); - $scope.totalPages =JSON.parse($scope.data.totalPage); - for(x in $scope.tableData){ - if($scope.tableData[x].active_yn=='Y') - $scope.tableData[x].active_yn=true; - else - $scope.tableData[x].active_yn=false; - } - //$scope.resetMenu(); - },function(error){ - console.log("failed"); - }); - - }); - - $scope.editRow = function(profileId){ - window.location = 'userProfile#/profile/' + profileId; - } - - $scope.toggleProfileActive = function(rowData) { - modalService.popupConfirmWinWithCancel("Confirm","You are about to change user's active status. Do you want to continue?", - function(){ - $http.get("profile/toggleProfileActive?profile_id="+rowData.id).success(function(){}); - }, - function(){ - rowData.active=!rowData.active; - }) - }; - -}); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/sample-page-iframe-controller.js b/vid/src/main/webapp/app/vid/scripts/controller/sample-page-iframe-controller.js deleted file mode 100644 index 99f66de7e..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/sample-page-iframe-controller.js +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -app.controller('samplePageWithIframeController', function($scope, $http,ProfileService,modalService){ - - -}); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/sampleController.js b/vid/src/main/webapp/app/vid/scripts/controller/sampleController.js deleted file mode 100644 index 190ac301d..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/sampleController.js +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -app.config(function($routeProvider) { - $routeProvider - .when('/iframe', { - templateUrl: 'app/fusionapp/scripts/view-models/sampleWithIframe.html', - controller : "samplePageWithIframeController" - }) - .otherwise({ - templateUrl: 'app/fusionapp/scripts/view-models/sample.html', - controller : "samplePageController" - }); -}); diff --git a/vid/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js b/vid/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js deleted file mode 100644 index 110c07ad1..000000000 --- a/vid/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js +++ /dev/null @@ -1,385 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -"use strict"; - -app.requires.push('ngRoute'); -app.requires.push('ui.tree'); - -app.config(function($routeProvider) { - $routeProvider - .when("/subviewedit", { - templateUrl : "app/vid/scripts/view-models/aaiSubViewEdit.htm", - controller : "aaiSubscriberSearchController" - - }) - .when("/subdetails", { - templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm", - controller : "aaiSubscriberController" - - }) - .otherwise({ - templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm", - controller : "aaiSubscriberSearchController" - }); -}); - -app.config(function(treeConfig) { - treeConfig.defaultCollapsed = true; // collapse nodes by default - }); - -app.factory("user",function(){ - return {}; -}); - -app.controller("aaiSubscriberSearchController", [ "$scope", "$timeout", "$log", "UtilityService", "user", "PropertyService", - function($scope, $timeout, $log, UtilityService, user, PropertyService) { - - $scope.baseUrl = ""; - $scope.responseTimeoutMsec = 10000; - $scope.msoMaxPollingIntervalMsec = 1000; - $scope.msoMaxPolls = 7; - - $scope.init = function(properties) { - // takes a default value, retrieves the prop value from the file system and sets it - var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(1000); - PropertyService.setMsoMaxPollingIntervalMsec(msecs); - - // takes a default value, retrieves the prop value from the file system and sets it - var polls = PropertyService.retrieveMsoMaxPolls(7); - PropertyService.setMsoMaxPolls(polls); - - PropertyService.setServerResponseTimeoutMsec(10000); - - // These two properties only added for testing - properties.msoDefaultBaseUrl = $scope.baseUrl; - properties.responseTimeoutMsec = $scope.responseTimeoutMsec; - - UtilityService.setProperties(properties); - } - - $scope.autoGetSubs = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $timeout(function() { - $scope.getSubscribers(); - // $scope.deleteServiceInstance(); - // $scope.generateInvalidUrl405(); - }, 100); - } - - $scope.autoGetSubDetails = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $timeout(function() { - $scope.getSubDetails(); - // $scope.deleteServiceInstance(); - // $scope.generateInvalidUrl405(); - }, 100); - } - - $scope.autoPopulateViewEdit = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $timeout(function() { - $scope.getComponentList(); - // $scope.deleteServiceInstance(); - // $scope.generateInvalidUrl405(); - }, 100); - } - - $scope.refreshSubs = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $timeout(function() { - $scope.refreshSubscribers(); - // $scope.deleteServiceInstance(); - // $scope.generateInvalidUrl405(); - }, 100); - } - - $scope.autoStartQueryTest = function() { - /* - * Optionally comment in / out one of these method calls (or add a similar - * entry) to auto-invoke an entry when the test screen is redrawn. - */ - $timeout(function() { - // $scope.queryServiceInstance(); - }, 100); - } - - $scope.queryServiceInstance = function() { - /* - * Example of method call needed to query a service instance. - */ - $scope.$broadcast("queryServiceInstance", { - serviceInstanceId: "bc305d54-75b4-431b-adb2-eb6b9e546014" - }); - } - - $scope.getSubscribers = function() { - /* - * Example of method call needed to commit an instance creation request. - */ - $scope.$broadcast("getSubs", { - url : "aai_get_subscribers", - requestDetails : createServiceRequestDetails - }); - } - - $scope.getSubDetails = function() { - /* - * Example of method call needed to commit an instance creation request. - */ - $scope.$broadcast("getSubDetails", { - url : "aai_sub_details", - requestDetails : createServiceRequestDetails - }); - } - - $scope.getComponentList = function() { - /* - * Example of method call needed to commit an instance creation request. - */ - $scope.$broadcast("getComponentList", { - url : "aai_sub_viewedit", - requestDetails : createServiceRequestDetails - }); - } - - - $scope.refreshSubscribers = function() { - /* - * Example of method call needed to commit an instance creation request. - */ - $scope.$broadcast("getSubs", { - url : "aai_refresh_subscribers", - requestDetails : createServiceRequestDetails - }); - } - - $scope.deleteServiceInstance = function() { - /* - * Example of method call needed to commit an instance deletion request. - */ - $scope.$broadcast("deleteInstance", { - url : "mso_delete_svc_instance/bc305d54-75b4-431b-adb2-eb6b9e546014", - requestDetails : deleteServiceRequestDetails - }); - } - - $scope.createNetworkInstance = function() { - $scope.$broadcast("createInstance", { - url : "mso_create_nw_instance", - requestDetails : createNetworkRequestDetails - }); - } - - $scope.deleteNetworkInstance = function() { - $scope.$broadcast("deleteInstance", { - url : "mso_delete_nw_instance/bc305d54-75b4-431b-adb2-eb6b9e546014/networks/ff305d54-75b4-ff1b-fff1-eb6b9e5460ff", - requestDetails : deleteNetworkRequestDetails - }); - } - - $scope.generateError = function(testName) { - // Clone example request object - var request = JSON.parse(JSON.stringify(createServiceRequestDetails)); - request.modelInfo.modelName = testName; - $scope.$broadcast("createInstance", { - url : "mso_create_svc_instance", - requestDetails : request - }); - } - - $scope.generateInvalidUrl404 = function() { - var properties = UtilityService.getProperties(properties); - properties.msoDefaultBaseUrl = "/INVALID_STRING/"; - UtilityService.setProperties(properties); - $scope.$broadcast("refreshProperties"); - - $scope.$broadcast("createInstance", { - url : "mso_create_svc_instance", - requestDetails : createServiceRequestDetails - }); - - properties.msoDefaultBaseUrl = $scope.baseUrl; - UtilityService.setProperties(properties); - $scope.$broadcast("refreshProperties"); - } - - $scope.generateInvalidUrl405 = function() { - $scope.$broadcast("createInstance", { - url : "INVALID_STRING_mso_create_svc_instance", - requestDetails : createServiceRequestDetails - }); - } - - /* - * Test data objects: - */ - - var subscriberInfo = { - globalSubscriberId : "C12345", - subscriberName : "General Electric Division 12" - }; - - var createServiceRequestDetails = { - modelInfo : { - modelType : "service", - modelId : "sn5256d1-5a33-55df-13ab-12abad84e764", - modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484a333", - modelName : "WanBonding", - modelVersion : "1" - }, - subscriberInfo : subscriberInfo, - requestParameters : { - vpnId : "1a2b3c4d5e6f", - productName : "Trinity", - customerId : "icore9883749" - } - }; - - var deleteServiceRequestDetails = { - modelInfo : { - modelType : "service", - modelId : "sn5256d1-5a33-55df-13ab-12abad84e764", - modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484a333", - modelName : "WanBonding", - modelVersion : "1" - } - }; - - var createNetworkRequestDetails = { - modelInfo : { - modelType : "network", - modelId : "ff5256d1-5a33-55df-aaaa-12abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fe", - modelName : "vIsbcOamNetwork", - modelVersion : "1" - }, - relatedModelList : [ - { - relatedModel : { - instanceId : "ff305d54-75b4-431b-adb2-eb6b9e5ff000", - modelInfo : { - modelType : "service", - modelId : "ff3514e3-5a33-55df-13ab-12abad84e7ff", - modelNameVersionId : "fe6985cd-ea33-3346-ac12-ab121484a3fe", - modelName : "Intercarrier Interconnect Session Border Controller", - modelVersion : "1" - } - } - }, - { - relatedModel : { - instanceId : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff", - modelInfo : { - modelType : "vnf", - modelId : "ff5256d1-5a33-55df-13ab-12abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-ac12-ab121484a3fe", - modelName : "vIsbc", - modelVersion : "1" - } - } - }, - { - relatedModel : { - instanceId : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff", - modelInfo : { - modelType : "vfModule", - modelId : "ff5256d1-5a33-55df-13ab-22abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-bc12-ab121484a3fe", - modelName : "vIsbcRtpExpansionModule", - modelVersion : "1" - } - } - } ], - subscriberInfo : subscriberInfo, - requestParameters : { - /* - * FYI: quotes around field names are needed due to embedded "-" - * characters - */ - "cidr-mask" : "255.255.255.000", - "gateway-address" : "10.10.125.1", - "dhcp-enabled" : "true" - } - }; - - var deleteNetworkRequestDetails = { - modelInfo : { - modelType : "network", - modelId : "ff5256d1-5a33-55df-aaaa-12abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fe", - modelName : "vIsbcOamNetwork", - modelVersion : "1" - }, - relatedModelList : [ - { - relatedModel : { - instanceId : "ff305d54-75b4-431b-adb2-eb6b9e5ff000", - modelInfo : { - modelType : "service", - modelId : "ff3514e3-5a33-55df-13ab-12abad84e7ff", - modelNameVersionId : "fe6985cd-ea33-3346-ac12-ab121484a3fe", - modelName : "Intercarrier Interconnect Session Border Controller", - modelVersion : "1" - } - } - }, - { - relatedModel : { - instanceId : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff", - modelInfo : { - modelType : "vnf", - modelId : "ff5256d1-5a33-55df-13ab-12abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-ac12-ab121484a3fe", - modelName : "vIsbc", - modelVersion : "1" - } - } - }, - { - relatedModel : { - instanceId : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff", - modelInfo : { - modelType : "vfModule", - modelId : "ff5256d1-5a33-55df-13ab-22abad84e7ff", - modelNameVersionId : "fe6478e4-ea33-3346-bc12-ab121484a3fe", - modelName : "vIsbcRtpExpansionModule", - modelVersion : "1" - } - } - } ] - }; - $scope.getSubscriberDet = function(selectedCustomer){ - window.location.href = '#subdetails?selectedSubscriber=' + selectedCustomer; - }; - } -]); |