Remove SDC query
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / CldsModelService.js
index 98e8443..0e44aec 100644 (file)
@@ -27,24 +27,36 @@ app
     'alertService',
     '$http',
     '$q',
-    function(alertService, $http, $q) {
-
-           function checkIfElementType(name) {
-
-                   // This will open the methods located in the app.js
-                   if (undefined == name) {
-                           return;
-                   }
-                   mapping = {
-                       'tca' : TCAWindow,
-                       'policy' : PolicyWindow,
-                       'vescollector' : VesCollectorWindow,
-                       'holmes' : HolmesWindow,
-                   };
-                   key = name.split('_')[0].toLowerCase()
-                   if (key in mapping) {
-                           mapping[key]();
-                   }
+    '$rootScope',
+    function(alertService, $http, $q, $rootScope) {
+
+           function checkIfElementType(name, isSimple) {
+
+        //This will open the methods located in the app.js
+                 if (isSimple){
+                         if (undefined == name) {
+                                 return;
+                         }else if (name.toLowerCase().indexOf("policy") >= 0){
+                                         PolicyWindow();
+                         } else {
+                                 $rootScope.selectedBoxName = name.toLowerCase();
+                                 ToscaModelWindow();
+                         }
+                 } else {
+                         if (undefined == name) {
+                                 return;
+                         }
+                       mapping = {
+                               'tca' : TCAWindow,
+                               'policy' : PolicyWindow,
+                               'vescollector' : VesCollectorWindow,
+                               'holmes' : HolmesWindow,
+                           };
+                           key = name.split('_')[0].toLowerCase()
+                           if (key in mapping) {
+                                   mapping[key]();
+                           }
+                 };
            }
            function handleQueryToBackend(def, svcAction, svcUrl, svcPayload) {
 
@@ -105,34 +117,6 @@ app
                    handleQueryToBackend(def, action, deployUrl, requestData);
                    return def.promise;
            };
-           this.getASDCServices = function() {
-
-                   var def = $q.defer();
-                   var sets = [];
-                   var svcUrl = "/restservices/clds/v1/clds/sdc/services/";
-                   $http.get(svcUrl).success(function(data) {
-
-                           def.resolve(data);
-                   }).error(function(data) {
-
-                           def.reject("sdc Services not found");
-                   });
-                   return def.promise;
-           };
-           this.getASDCService = function(uuid) {
-
-                   var def = $q.defer();
-                   var sets = [];
-                   var svcUrl = "/restservices/clds/v1/clds/sdc/services/" + uuid;
-                   $http.get(svcUrl).success(function(data) {
-
-                           def.resolve(data);
-                   }).error(function(data) {
-
-                           def.reject("SDC service not found");
-                   });
-                   return def.promise;
-           };
            this.getModel = function(modelName) {
 
                    var def = $q.defer();
@@ -242,7 +226,7 @@ app
                            document.getElementById(menuText).classList.add('ThisLink');
                    }
            };
-           this.processActionResponse = function(modelName, pars) {
+           this.processActionResponse = function(modelName, pars, simple) {
 
                    // populate control name (prefix and uuid here)
                    var controlNamePrefix = pars.controlNamePrefix;
@@ -260,7 +244,7 @@ app
                    document.getElementById("modeler_name").textContent = headerText;
                    document.getElementById("templa_name").textContent = ("Template Used - " + selected_template);
                    setStatus(pars)
-                   addSVG(pars);
+                   disableBPMNAddSVG(pars, simple);
                    this.enableDisableMenuOptions(pars);
            };
            this.processRefresh = function(pars) {
@@ -309,7 +293,7 @@ app
                    '<span id="status_clds" style="position: absolute;  left: 61%;top: 151px; font-size:20px;">Status: '
                    + statusMsg + '</span>');
            }
-           function addSVG(pars) {
+           function disableBPMNAddSVG(pars, simple) {
 
                    var svg = pars.imageText.substring(pars.imageText.indexOf("<svg"))
                    if ($("#svgContainer").length > 0)
@@ -330,7 +314,7 @@ app
                            var name = $($(event.target).parent()).attr("data-element-id")
                            lastElementSelected = $($(event.target).parent()).attr(
                            "data-element-id")
-                           checkIfElementType(name)
+                           checkIfElementType(name, simple)
                    });
            }
            this.enableDisableMenuOptions = function(pars) {
@@ -345,14 +329,11 @@ app
                            document.getElementById('Close Model').classList
                            .remove('ThisLink');
                            // disable models options
-                           document.getElementById('Create CL').classList.add('ThisLink');
                            document.getElementById('Save CL').classList.add('ThisLink');
                            document.getElementById('Revert Model Changes').classList
                            .add('ThisLink');
                    } else {
                            // enable menu options
-                           document.getElementById('Create CL').classList
-                           .remove('ThisLink');
                            document.getElementById('Save CL').classList.remove('ThisLink');
                            document.getElementById('Properties CL').classList
                            .remove('ThisLink');
@@ -364,8 +345,6 @@ app
                            .remove('ThisLink');
                            document.getElementById('Refresh Status').classList
                            .remove('ThisLink');
-                           document.getElementById('Refresh ASDC').classList
-                           .remove('ThisLink');
                    }
                    // enable/disable menu options based on permittedActionCd
                    // list
@@ -383,10 +362,4 @@ app
                    this.checkPermittedActionCd(permittedActionCd, 'UnDeploy',
                    'UNDEPLOY');
            }
-           this.getASDCServices().then(function(pars) {
-
-                   var obj = JSON.parse(pars);
-                   var services = obj.service;
-                   asdc_Services = services
-           });
     } ]);