Rework deploy/undeploy UI
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / propertyController.js
index f1ab1e1..2b32f4d 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 function updateMsProperties(type, newMsProperties) {
-    var newMsProperties = cl_props["microServicePolicies"];
+    var newMsProperties = JSON.parse(JSON.stringify(cl_props["microServicePolicies"]));
     for (p in newMsProperties) {
         if (newMsProperties[p]["name"] == type) {
                cl_props["microServicePolicies"][p] = newMsProperties;
@@ -43,22 +43,26 @@ function getLoopName() {
 }
 
 function getOperationalPolicyProperty() {
-    return cl_props["operationalPolicies"]["0"]["configurationsJson"];
+    return JSON.parse(JSON.stringify(cl_props["operationalPolicies"]["0"]["configurationsJson"]));
 }
 
 function getOperationalPolicies() {
-    return cl_props["operationalPolicies"];
+    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 msProperties[p];
+           return JSON.parse(JSON.stringify(msProperties[p]));
         }
     }
     return null;
@@ -68,7 +72,7 @@ function getMsProperty(type) {
     var msProperties = cl_props["microServicePolicies"];
     for (p in msProperties) {
         if (msProperties[p]["name"] == type) {
-           return msProperties[p]["properties"];
+           return JSON.parse(JSON.stringify(msProperties[p]["properties"]));
         }
     }
     return null;
@@ -78,21 +82,33 @@ 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 getStatus() {
+function getLastUpdatedStatus() {
     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"];
 }
-module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getStatus,getDeploymentID,getDeploymentStatusURL };
\ No newline at end of file
+
+function setDeploymentStatusURL(deploymentStatusURL) {
+    cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL;
+}
+module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL };
\ No newline at end of file