2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
23 var AsdcService = function ($http, $log, PropertyService, UtilityService, VIDCONFIGURATION, COMPONENT, DataService, featureFlags) {
\r
24 var shouldExcludeMacroFromAsyncInstantiationFlow = function(serviceModel){
\r
25 if (DataService.getE2EService())
\r
27 if (!_.isEmpty(serviceModel.pnfs) && !featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_EXTENDED_MACRO_PNF_CONFIG))
\r
29 if (!_.isEmpty(serviceModel.collectionResources))
\r
31 if (!_.isEmpty(serviceModel.networks) && !featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_NETWORK_TO_ASYNC_INSTANTIATION))
\r
33 if(serviceModel.service.instantiationType === "ClientConfig")
\r
39 getModel: function (modelId, successCallbackFunction) {
\r
40 $log.debug("AsdcService:getModel: modelId: " + modelId);
\r
42 "asdc/getModel/" + modelId
\r
43 + "?r=" + Math.random(),
\r
45 timeout: PropertyService
\r
46 .getServerResponseTimeoutMsec()
\r
47 }).then(successCallbackFunction)["catch"]
\r
48 (UtilityService.runHttpErrorHandler);
\r
51 shouldTakeTheDrawingBoardViewEdit: function(serviceModel) {
\r
52 if (this.enableWebpackModernUi()
\r
53 && serviceModel.service.vidNotions
\r
54 && serviceModel.service.vidNotions.viewEditUI
\r
55 && serviceModel.service.vidNotions.viewEditUI !== 'legacy'
\r
61 enableWebpackModernUi: function(){
\r
62 return featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ENABLE_WEBPACK_MODERN_UI);
\r
65 shouldTakeTheAsyncInstantiationFlow: function(serviceModel) {
\r
66 if (!(this.enableWebpackModernUi()))
\r
68 // Assuming positive flag - first of all, respect serviceModel.service.vidNotions.instantiationUI
\r
69 if (serviceModel.service.vidNotions
\r
70 && serviceModel.service.vidNotions.instantiationUI
\r
71 && serviceModel.service.vidNotions.instantiationUI !== 'legacy'
\r
74 // If defined 'legacy' or not defined, other client-side
\r
75 // logic still apply:
\r
77 if (this.isMacro(serviceModel)
\r
78 && !shouldExcludeMacroFromAsyncInstantiationFlow(serviceModel)
\r
85 isMacro: function (serviceModel) {
\r
86 if (serviceModel && serviceModel.service) {
\r
87 switch (serviceModel.service.instantiationType) {
\r
93 case 'ClientConfig':
\r
94 console.debug("Looking for " + serviceModel.service.invariantUuid + " by Client Config");
\r
95 return UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid);
\r
97 console.debug("Unexpected serviceModel.service.instantiationType: " + serviceModel.service.instantiationType);
\r
98 return UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid);
\r
101 $log.debug("isMscro=false, because serviceModel.service is undefined");
\r
108 appDS2.factory("AsdcService", ["$http", "$log", "PropertyService",
\r
109 "UtilityService", "VIDCONFIGURATION","COMPONENT", "DataService", "featureFlags", AsdcService]);
\r