From 3982f4f67314ec37fd9b22ae54049958af777c1b Mon Sep 17 00:00:00 2001 From: jimmydot Date: Sun, 7 May 2017 14:58:24 -0400 Subject: [VID-6] Initial rebase push Change-Id: I9077be9663754d9b22f77c6a7b3109b361b39346 Signed-off-by: jimmydot --- .../app/vid/scripts/controller/subscriberSearch.js | 246 +++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100755 vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js new file mode 100755 index 00000000..afd7abad --- /dev/null +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js @@ -0,0 +1,246 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +"use strict"; + +appDS2.requires.push('ngRoute'); +appDS2.requires.push('ui.tree'); + +appDS2.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" + }); +}); + +appDS2.config(function(treeConfig) { + treeConfig.defaultCollapsed = true; // collapse nodes by default + }); + +appDS2.factory("user",function(){ + return {}; +}); + +appDS2.controller("aaiSubscriberSearchController", [ "$scope", "$timeout", "$log", "UtilityService", "user", "PropertyService", "COMPONENT", "FIELD", + function($scope, $timeout, $log, UtilityService, user, PropertyService, COMPONENT, FIELD) { + + $scope.baseUrl = ""; + $scope.responseTimeoutMsec = 10000; + $scope.msoMaxPollingIntervalMsec = 1000; + $scope.msoMaxPolls = 7; + + $scope.init = function(properties) { + var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec(); + PropertyService.setMsoMaxPollingIntervalMsec(msecs); + + var polls = PropertyService.retrieveMsoMaxPolls(); + 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(COMPONENT.QUERY_SERVICE_INSTANCE, { + serviceInstanceId: COMPONENT.SERVICE_INSTANCE_ID_1 + }); + } + + $scope.getSubscribers = function() { + /* + * Example of method call needed to commit an instance creation request. + */ + $scope.$broadcast(COMPONENT.GET_SUBS, { + url : FIELD.ID.AAI_GET_SUBSCRIBERS, + requestDetails : createServiceRequestDetails + }); + } + + $scope.getSubDetails = function() { + /* + * Example of method call needed to commit an instance creation request. + */ + $scope.$broadcast(COMPONENT.GET_SUB_DETAILS, { + url : FIELD.ID.AAI_SUB_DETAILS, + requestDetails : createServiceRequestDetails + }); + } + + $scope.getComponentList = function() { + /* + * Example of method call needed to commit an instance creation request. + */ + $scope.$broadcast(COMPONENT.GET_COMPONENT_LIST, { + url : FIELD.ID.AAI_SUB_VIEWEDIT, + requestDetails : createServiceRequestDetails + }); + } + + + $scope.refreshSubscribers = function() { + /* + * Example of method call needed to commit an instance creation request. + */ + $scope.$broadcast(COMPONENT.GET_SUBS, { + url : FIELD.ID.AAI_REFRESH_SUBSCRIBERS, + requestDetails : createServiceRequestDetails + }); + } + + $scope.deleteServiceInstance = function() { + /* + * Example of method call needed to commit an instance deletion request. + */ + $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, { + url : COMPONENT.MSO_DELETE_SVC_INSTANCE_PATH + COMPONENT.SERVICE_INSTANCE_ID_1, + requestDetails : deleteServiceRequestDetails + }); + } + + $scope.createNetworkInstance = function() { + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url : COMPONENT.MSO_CREATE_NW_INSTANCE, + requestDetails : createNetworkRequestDetails + }); + } + + $scope.deleteNetworkInstance = function() { + $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, { + url : COMPONENT.MSO_CREATE_NW_INSTANCE_PATH + COMPONENT.SERVICE_INSTANCE_ID_1 + COMPONENT.FORWARD_SLASH + COMPONENT.NETWORKS + COMPONENT.FORWARD_SLASH + COMPONENT.DELETE_INSTANCE_ID_1, + requestDetails : deleteNetworkRequestDetails + }); + } + + $scope.generateError = function(testName) { + // Clone example request object + var request = JSON.parse(JSON.stringify(createServiceRequestDetails)); + request.modelInfo.modelName = testName; + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url : COMPONENT.MSO_CREATE_SVC_INSTANCE, + requestDetails : request + }); + } + + $scope.generateInvalidUrl404 = function() { + var properties = UtilityService.getProperties(properties); + properties.msoDefaultBaseUrl = COMPONENT.INVALID_STRING; + UtilityService.setProperties(properties); + $scope.$broadcast(COMPONENT.REFRESH_PROPERTIES); + + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url : COMPONENT.MSO_CREATE_SVC_INSTANCE, + requestDetails : createServiceRequestDetails + }); + + properties.msoDefaultBaseUrl = $scope.baseUrl; + UtilityService.setProperties(properties); + $scope.$broadcast(COMPONENT.REFRESH_PROPERTIES); + } + + $scope.generateInvalidUrl405 = function() { + $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, { + url : COMPONENT.INVALID_STRING_MSO_CREATE_SVC_INSTANCE, + requestDetails : createServiceRequestDetails + }); + } + + + $scope.getSubscriberDet = function(selectedCustomer){ + window.location.href = COMPONENT.SUBDETAILS_SELECTEDSUBSCRIBER + selectedCustomer; + }; + } +]); -- cgit 1.2.3-korg