* ============LICENSE_START=======================================================\r
* VID\r
* ================================================================================\r
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.\r
+ * Modifications Copyright (C) 2019 IBM.\r
* ================================================================================\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
(function () {\r
'use strict';\r
\r
- appDS2.controller("ServiceModelController", function ($scope, $http, $location, COMPONENT, VIDCONFIGURATION, FIELD, DataService, vidService,\r
- PropertyService, UtilityService) {\r
+ appDS2.controller("ServiceModelController",function ($uibModal, $scope, $http, $location, COMPONENT, VIDCONFIGURATION, FIELD, DataService, vidService,\r
+ PropertyService, UtilityService, AsdcService, $timeout, featureFlags) {\r
\r
$scope.popup = {};\r
- \r
+ var defaultViewPerPage = 10;\r
// var baseEndpoint = "vid";\r
var pathQuery = COMPONENT.SERVICES_DIST_STATUS_PATH + VIDCONFIGURATION.ASDC_MODEL_STATUS;\r
\r
if ( VIDCONFIGURATION.ASDC_MODEL_STATUS === FIELD.STATUS.ALL) {\r
pathQuery = COMPONENT.SERVICES_PATH;\r
}\r
- \r
+ window.addEventListener("message", receiveMessage, false);\r
+\r
+ function receiveMessage(event){\r
+ if(event.data == 'navigateTo') {\r
+ $location.path('/models/services').search({});\r
+ $scope.$apply();\r
+ $scope.rememberFilter = true;\r
+ }\r
+ if(event.data == 'navigateToInstantiationStatus') {\r
+ $location.path('/instantiationStatus').search({});\r
+ $scope.$apply();\r
+ }\r
+ }\r
+\r
$scope.getServiceModels = function() {\r
$scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG_ASDC;\r
\r
$http.get(pathQuery)\r
- .then(function successCallback(response) {\r
+ .then(function (response) {\r
$scope.services = [];\r
if (response.data && angular.isArray(response.data.services)) {\r
wholeData = response.data.services;\r
- $scope.services = $scope.filterDataWithHigherVersion(wholeData);\r
- $scope.viewPerPage=10;\r
- $scope.totalPage=$scope.services.length/$scope.viewPerPage;\r
- $scope.sortBy=COMPONENT.NAME;\r
- $scope.scrollViewPerPage=2;\r
- $scope.currentPage=1;\r
- $scope.searchCategory;\r
- $scope.currentPageNum=1;\r
- $scope.isSpinnerVisible = false;\r
- $scope.isProgressVisible = false;\r
+ $scope.services = $scope.filterDataWithHigherVersion(wholeData);\r
+ $scope.viewPerPage = defaultViewPerPage;\r
+ $scope.totalPage=$scope.services.length/$scope.viewPerPage;\r
+ $scope.sortBy=COMPONENT.NAME;\r
+ $scope.scrollViewPerPage=2;\r
+ $scope.currentPage=1;\r
+ $scope.currentPageNum=1;\r
+ $scope.isSpinnerVisible = false;\r
+ $scope.isProgressVisible = false;\r
+ var searchKey = sessionStorage.getItem("searchKey");\r
+ if (searchKey != 'undefined' && searchKey!=null && ($scope.rememberFilter)) {\r
+ var searchKey = JSON.parse(sessionStorage.getItem("searchKey"));\r
+ $scope.searchString = searchKey.searchString || '';\r
+ $scope.viewPerPage = searchKey.viewPerPage || defaultViewPerPage;\r
+ $scope.totalPage = $scope.services.length / $scope.viewPerPage;\r
+ $timeout(function () {\r
+ // the table controller handles the current page once\r
+ // data is loaded, therefore we're delying the paging\r
+ // override\r
+ $scope.currentPage = $scope.currentPageNum = searchKey.currentPage ? parseInt(searchKey.currentPage) : 1;\r
+ }, 0);\r
+ $scope.rememberFilter = false;\r
+ }\r
} else {\r
$scope.status = FIELD.STATUS.FAILED_SERVICE_MODELS_ASDC;\r
$scope.error = true;\r
$scope.isSpinnerVisible = false;\r
}\r
$scope.deployButtonType = response.data.readOnly ? 'disabled' : 'primary';\r
- }, function errorCallback(response) {\r
+ }, function (response) {\r
console.log("Error: " + response);\r
});\r
};\r
\r
+ $scope.isShowOrchestrationType = function() {\r
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_SHOW_ORCHESTRATION_TYPE);\r
+ };\r
+\r
var wholeData=[];\r
\r
$scope.filterDataWithHigherVersion = function(serviceData){\r
\r
var polls = PropertyService.retrieveMsoMaxPolls();\r
PropertyService.setMsoMaxPolls(polls);\r
- \r
- //PropertyService.setMsoBaseUrl("testmso");\r
- PropertyService.setServerResponseTimeoutMsec(30000);\r
- }\r
+ };\r
\r
$scope.prevPage = function() {\r
$scope.currentPage--;\r
- }\r
+ };\r
\r
$scope.nextPage = function() {\r
$scope.currentPage++;\r
- }\r
+ };\r
+\r
+ $scope.showReportWindow = function() {\r
+\r
+ const modalWindow = $uibModal.open({\r
+ templateUrl: 'app/vid/scripts/modals/report-modal/report-modal.html',\r
+ controller: 'reportModalController',\r
+ controllerAs: 'vm',\r
+ resolve: {\r
+ errorMsg: function () {\r
+ return $scope.status;\r
+ }\r
+ }\r
+ });\r
+\r
+ };\r
+\r
+ $scope.isShowErrorReport = function() {\r
+ return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_CREATE_ERROR_REPORTS);\r
+ };\r
\r
$scope.createType = COMPONENT.A_LA_CARTE;\r
$scope.deployService = function(service) {\r
-\r
+ var searchKey = {\r
+ searchString: $scope.searchString,\r
+ viewPerPage: $scope.viewPerPage,\r
+ currentPage: $scope.currentPage\r
+ };\r
+ sessionStorage.setItem("searchKey",JSON.stringify(searchKey));\r
\r
console.log("Instantiating SDC service " + service.uuid);\r
- \r
+\r
$http.get(COMPONENT.SERVICES_PATH + service.uuid)\r
- .then(function successCallback(getServiceResponse) {\r
- \r
+ .then(function (getServiceResponse) {\r
+\r
var serviceModel = getServiceResponse.data;\r
\r
//VID-233 bug fix when models doesn't exists\r
"description": serviceModel.service.description,\r
"category":serviceModel.service.category\r
});\r
- DataService.setALaCarte (true);\r
+\r
+ var shouldTakeTheAsyncInstantiationFlow = AsdcService.shouldTakeTheAsyncInstantiationFlow(serviceModel);\r
+ DataService.setShouldIncludeInAsyncInstantiationFlow(shouldTakeTheAsyncInstantiationFlow);\r
+\r
+ DataService.setALaCarte (true);\r
+ DataService.setPnf(!angular.equals(serviceModel.pnfs, {}));\r
$scope.createType = COMPONENT.A_LA_CARTE;\r
var broadcastType = COMPONENT.CREATE_COMPONENT;\r
- \r
- if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid )) {\r
- DataService.setALaCarte (false);\r
- $scope.createType = COMPONENT.MACRO;\r
- var convertedAsdcModel = UtilityService.convertModel(serviceModel);\r
- \r
- //console.log ("display inputs "); \r
- //console.log (JSON.stringify ( convertedAsdcModel.completeDisplayInputs));\r
- \r
- DataService.setModelInfo(COMPONENT.SERVICE, {\r
- "modelInvariantId": serviceModel.service.invariantUuid,\r
- "modelVersion": serviceModel.service.version,\r
- "modelNameVersionId": serviceModel.service.uuid,\r
- "modelName": serviceModel.service.name,\r
- "description": serviceModel.service.description,\r
- "category":serviceModel.service.category,\r
- "serviceEcompNaming": serviceModel.service.serviceEcompNaming,\r
- "inputs": serviceModel.service.inputs,\r
- "serviceType": serviceModel.service.serviceType,\r
- "serviceRole": serviceModel.service.serviceRole,\r
- "displayInputs": convertedAsdcModel.completeDisplayInputs\r
- });\r
- };\r
- \r
+ if (AsdcService.isMacro(serviceModel) || DataService.getE2EService()) {\r
+ DataService.setALaCarte(false);\r
+ if(!shouldTakeTheAsyncInstantiationFlow){\r
+ $scope.createType = COMPONENT.MACRO;\r
+ var convertedAsdcModel = UtilityService.convertModel(serviceModel);\r
+\r
+ DataService.setModelInfo(COMPONENT.SERVICE, {\r
+ "modelInvariantId": serviceModel.service.invariantUuid,\r
+ "modelVersion": serviceModel.service.version,\r
+ "modelNameVersionId": serviceModel.service.uuid,\r
+ "modelName": serviceModel.service.name,\r
+ "description": serviceModel.service.description,\r
+ "category": serviceModel.service.category,\r
+ "serviceEcompNaming": serviceModel.service.serviceEcompNaming,\r
+ "inputs": serviceModel.service.inputs,\r
+ "serviceType": serviceModel.service.serviceType,\r
+ "serviceRole": serviceModel.service.serviceRole,\r
+ "displayInputs": convertedAsdcModel.completeDisplayInputs\r
+ });\r
+ }\r
+ }\r
+\r
$scope.$broadcast(broadcastType, {\r
componentId : COMPONENT.SERVICE,\r
+ modelNameVersionId: serviceModel.service.uuid,\r
callbackFunction : function(response) {\r
if (response.isSuccessful) {\r
vidService.setModel(serviceModel);\r
- \r
+\r
var subscriberId = FIELD.STATUS.NOT_FOUND;\r
var serviceType = FIELD.STATUS.NOT_FOUND;\r
- \r
+\r
var serviceInstanceId = response.instanceId;\r
- \r
+\r
for (var i = 0; i < response.control.length; i++) {\r
if (response.control[i].id == COMPONENT.SUBSCRIBER_NAME) {\r
subscriberId = response.control[i].value;\r
serviceType = response.control[i].value;\r
}\r
}\r
- \r
- \r
+\r
+\r
$scope.refreshSubs(subscriberId,serviceType,serviceInstanceId);\r
- \r
+\r
}\r
}\r
});\r
- \r
- }, function errorCallback(response) {\r
+ }, function (response) {\r
console.log("Error: " + response);\r
});\r
};\r
callbackFunction : function(response) {\r
}\r
});\r
- }\r
+ };\r
\r
$scope.refreshSubs = function(subscriberId, serviceType, serviceInstanceId) {\r
$scope.status = FIELD.STATUS.FETCHING_SUBSCRIBER_LIST_AAI;\r
}).then(function(response){\r
\r
if (response.data.status < 200 || response.data.status > 202) {\r
- $scope.showError(FIELD.ERROR.MSO)\r
+ $scope.showError(FIELD.ERROR.MSO);\r
return;\r
}\r
\r