Don't fetch scheduled tasks when there's no scheduler
[vid.git] / vid-app-common / src / main / webapp / app / vid / scripts / services / change-management.service.js
index 6b45a74..b90d417 100644 (file)
@@ -21,9 +21,9 @@
 (function () {
     'use strict';
 
-    appDS2.service('changeManagementService', ['$http', '$q', 'COMPONENT', 'VIDCONFIGURATION', changeManagementService]);
+    appDS2.service('changeManagementService', ['$http', '$q', 'COMPONENT', 'VIDCONFIGURATION', 'featureFlags', changeManagementService]);
 
-    function changeManagementService($http, $q, COMPONENT, VIDCONFIGURATION) {
+    function changeManagementService($http, $q, COMPONENT, VIDCONFIGURATION, featureFlags) {
         this.getWorkflows = function (vnfs) {
             var requestVnfs = _.map(vnfs, function (vnf) {
                 return {
         this.getMSOChangeManagements = function() {
             var deferred = $q.defer();
 
-            $http.get(COMPONENT.GET_MSO_WORKFLOWS)
-            .success(function (response) {
-                deferred.resolve({data: response});
-            })
-            .error(function(data, status, headers, config) {
-                deferred.reject({message: data, status: status});
-            });
+            if(featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_GUILIN_CHANGEMG_SUBMIT_TO_SO)) {
+                deferred.resolve({data: []}); // no scheduler
+            } else {
+                $http.get(COMPONENT.GET_MSO_WORKFLOWS)
+                .success(function (response) {
+                    deferred.resolve({data: response});
+                })
+                .error(function (data, status, headers, config) {
+                    deferred.reject({message: data, status: status});
+                });
+            }
 
             return deferred.promise;
         };