aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
diff options
context:
space:
mode:
authorSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-06 16:14:59 +0300
committerSonsino, Ofir (os0695) <os0695@intl.att.com>2018-08-06 16:14:59 +0300
commitd350d5ac25c8df2846e4f0d9082cb4d364a17a83 (patch)
tree6e2afb18b785bb98dfa61509ae89749a221ad4e8 /vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
parentff76b5ed0aa91d5fdf9dc4f95e8b20f91ed9d072 (diff)
UI Feature flagging support
Change-Id: Ic2151dab6306c42364483e9064c01bab3dd7378b Issue-ID: VID-208 Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js')
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js63
1 files changed, 49 insertions, 14 deletions
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
index 68fdce44f..753f9fd19 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
@@ -20,21 +20,56 @@
"use strict";
-var AsdcService = function($http, $log, PropertyService, UtilityService) {
+var AsdcService = function ($http, $log, PropertyService, UtilityService, VIDCONFIGURATION, COMPONENT, featureFlags) {
return {
- getModel : function(modelId, successCallbackFunction) {
- $log.debug("AsdcService:getModel: modelId: " + modelId);
- $http.get(
- "asdc/getModel/" + modelId
- + "?r=" + Math.random(),
- {
- timeout : PropertyService
- .getServerResponseTimeoutMsec()
- }).then(successCallbackFunction)["catch"]
- (UtilityService.runHttpErrorHandler);
- }
+ getModel: function (modelId, successCallbackFunction) {
+ $log.debug("AsdcService:getModel: modelId: " + modelId);
+ $http.get(
+ "asdc/getModel/" + modelId
+ + "?r=" + Math.random(),
+ {
+ timeout: PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+ shouldExcludeMacroFromAsyncInstatiationFlow: function(serviceModel){
+ if (!featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_ASYNC_INSTANTIATION))
+ return true;
+ if (!_.isEmpty(serviceModel.pnfs))
+ return true;
+ if (!_.isEmpty(serviceModel.collectionResource))
+ return true;
+ if (!_.isEmpty(serviceModel.networks) && !featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_NETWORK_TO_ASYNC_INSTANTIATION))
+ return true;
+ if(serviceModel.service.instantiationType === "ClientConfig")
+ return true;
+ return false;
+ },
+
+ isMacro: function (serviceModel) {
+ if (serviceModel && serviceModel.service) {
+ switch (serviceModel.service.instantiationType) {
+ case 'Macro':
+ case 'Both':
+ return true;
+ case 'A-La-Carte':
+ return false;
+ case 'ClientConfig':
+ console.debug("Looking for " + serviceModel.service.invariantUuid + " by Client Config");
+ return UtilityService.arrayContains(VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid);
+ default:
+ console.debug("Unexpected serviceModel.service.instantiationType: " + serviceModel.service.instantiationType);
+ return true;
+ }
+ } else {
+ $log.debug("isMscro=false, because serviceModel.service is undefined");
+ return false;
+ }
+ }
}
}
-appDS2.factory("AsdcService", [ "$http", "$log", "PropertyService",
- "UtilityService", AsdcService ]);
+appDS2.factory("AsdcService", ["$http", "$log", "PropertyService",
+ "UtilityService", "VIDCONFIGURATION","COMPONENT", "featureFlags", AsdcService]);