Merge "E2E Automation"
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / propertyController.js
index a637734..75c64f3 100644 (file)
  * ===================================================================
  * 
  */
- function saveMsProperties(type, form) {
-    for (p in cl_props["microServicePolicies"]) {
-        if (cl_props["microServicePolicies"][p]["name"] == type) {
-               cl_props["microServicePolicies"][p]["properties"] = form;
+
+function updateMsProperties(type, newMsProperties) {
+    var newMsProperties = JSON.parse(JSON.stringify(cl_props["microServicePolicies"]));
+    for (p in newMsProperties) {
+        if (newMsProperties[p]["name"] == type) {
+               cl_props["microServicePolicies"][p] = newMsProperties;
         }
     }
 }
 
-function saveGlobalProperties(form) {
-    cl_props["globalPropertiesJson"] = form;
+function updateGlobalProperties(newGlobalProperties) {
+    cl_props["globalPropertiesJson"] = newGlobalProperties;
+}
+
+function updateOpPolicyProperties(newOpProperties) {   
+   cl_props["operationalPolicies"] = newOpProperties;
 }
 
-function saveOpPolicyProperties(form) {
-        cl_props["operationalPolicies"]["0"]["configurationsJson"] = form;
+function getLoopName() {
+    return cl_props["name"];
 }
 
 function getOperationalPolicyProperty() {
-    return cl_props["operationalPolicies"]["0"]["configurationsJson"];
+    return JSON.parse(JSON.stringify(cl_props["operationalPolicies"]["0"]["configurationsJson"]));
+}
+
+function getOperationalPolicies() {
+    return JSON.parse(JSON.stringify(cl_props["operationalPolicies"]));
 }
 
 function getGlobalProperty() {
-    return cl_props["globalPropertiesJson"];
+    return JSON.parse(JSON.stringify(cl_props["globalPropertiesJson"]));
+}
+
+function getDeploymentProperties() {
+    return JSON.parse(JSON.stringify(cl_props["globalPropertiesJson"]["dcaeDeployParameters"]));
+}
+
+function getMsJson(type) {
+    var msProperties = cl_props["microServicePolicies"];
+    for (p in msProperties) {
+        if (msProperties[p]["name"] == type) {
+           return JSON.parse(JSON.stringify(msProperties[p]));
+        }
+    }
+    return null;
 }
 
 function getMsProperty(type) {
     var msProperties = cl_props["microServicePolicies"];
     for (p in msProperties) {
         if (msProperties[p]["name"] == type) {
-           return msProperties[p]["properties"];
+               if (msProperties[p]["properties"] !== null && msProperties[p]["properties"] !== undefined) {
+                       return JSON.parse(JSON.stringify(msProperties[p]["properties"]));
+               }
         }
     }
     return null;
@@ -58,24 +84,42 @@ function getMsUI(type) {
     var msProperties = cl_props["microServicePolicies"];
     for (p in msProperties) {
         if (msProperties[p]["name"] == type) {
-           return msProperties[p]["jsonRepresentation"];
+               return JSON.parse(JSON.stringify(msProperties[p]["jsonRepresentation"]));
         }
     }
     return null;
 }
 
-function loadSharedPropertyByService(onChangeUUID, refresh, callBack) {
-      setASDCFields()
+function getLastUpdatedStatus() {
+    return cl_props["lastComputedState"];
 }
 
-function getStatus() {
-    return cl_props["lastComputedState"];
+function setLastUpdatedStatus(status) {
+    cl_props["lastComputedState"] =  status;
 }
 
 function getDeploymentID() {
     return cl_props["dcaeDeploymentId"];
 }
 
+function setDeploymentID(deploymentId) {
+    cl_props["dcaeDeploymentId"] = deploymentId;
+}
+
 function getDeploymentStatusURL() {
     return cl_props["dcaeDeploymentStatusUrl"];
 }
+
+function setDeploymentStatusURL(deploymentStatusURL) {
+    cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL;
+}
+
+function getResourceDetailsProperty() {
+       return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"];
+}
+
+function getResourceDetailsVfcProperty() {
+       return cl_props["modelPropertiesJson"]["resourceDetails"]["VFC"];
+}
+
+module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsProperty,getResourceDetailsVfcProperty };
\ No newline at end of file