diff options
author | 2018-08-06 13:34:49 +0000 | |
---|---|---|
committer | 2018-08-06 13:34:49 +0000 | |
commit | d4da64c40ed711a0557d46cbeedd0f9533471119 (patch) | |
tree | 4719c3260ae274250c408be8653a116640f1225b /vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js | |
parent | c53f8f4cbec4376f5f66f1acb076157e352bb62f (diff) | |
parent | d350d5ac25c8df2846e4f0d9082cb4d364a17a83 (diff) |
Merge "UI Feature flagging support"
Diffstat (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js')
-rwxr-xr-x | vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js | 63 |
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]);
|