aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java3
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js2
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js2
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js11
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/ToscaModelService.js2
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/propertyController.js6
6 files changed, 13 insertions, 13 deletions
diff --git a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java b/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
index c316f1f5d..ee9ba5370 100644
--- a/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
+++ b/src/main/java/org/onap/clamp/policy/microservice/MicroservicePolicyService.java
@@ -57,6 +57,7 @@ public class MicroservicePolicyService implements PolicyService<MicroServicePoli
return repository.existsById(policyName);
}
+ @Transactional
public MicroServicePolicy getAndUpdateMicroServicePolicy(Loop loop, MicroServicePolicy policy) {
return repository.findById(policy.getName()).map(p -> updateMicroservicePolicyProperties(p, policy, loop))
.orElse(new MicroServicePolicy(policy.getName(), policy.getPolicyTosca(), policy.getShared(),
@@ -65,7 +66,7 @@ public class MicroservicePolicyService implements PolicyService<MicroServicePoli
private MicroServicePolicy updateMicroservicePolicyProperties(MicroServicePolicy oldPolicy,
MicroServicePolicy newPolicy, Loop loop) {
- oldPolicy.setJsonRepresentation(newPolicy.getJsonRepresentation());
+ oldPolicy.setProperties(newPolicy.getProperties());
if (oldPolicy.getUsedByLoops().contains(loop)) {
oldPolicy.getUsedByLoops().add(loop);
}
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
index 097235fa1..972676b61 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -38,7 +38,7 @@ app
}else if (name.toLowerCase().indexOf("policy") >= 0){
PolicyWindow();
} else {
- $rootScope.selectedBoxName = name.toLowerCase();
+ $rootScope.selectedBoxName = name;
ToscaModelWindow();
}
}
diff --git a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js
index 5dae2dc19..e2f1913d0 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/ImportSchemaCtrl.js
@@ -283,7 +283,7 @@ function($scope, $rootScope, $uibModalInstance, data, svnservice, fileUpload,
};
$scope.submitForm = function(obj) {
- var operationalPolicies = getOperationalPolicies();
+ var operationalPolicies = JSON.parse(JSON.stringify(getOperationalPolicies()));
if (obj !== null) {
operationalPolicies[0]["configurationsJson"] = obj;
}
diff --git a/src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js
index d287f3d78..129c5d984 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js
@@ -64,7 +64,7 @@ app.controller('ToscaModelCtrl',
if($rootScope.selectedBoxName) {
var policyType = $rootScope.selectedBoxName.split('_')[0].toLowerCase();
$scope.toscaModelName = policyType.toUpperCase() + " Microservice";
- $scope.jsonByPolicyType(policyType, '', '');
+ $scope.jsonByPolicyType($rootScope.selectedBoxName, '', '');
}
});
@@ -88,12 +88,11 @@ app.controller('ToscaModelCtrl',
$scope.saveToscaProps = function(){
var policyType = $rootScope.selectedBoxName;
var data = $scope.getEditorData();
-
if(data !== null) {
- var msJson = getMsJson(policyType);
- msJson["properties"] = data;
- cldsModelService.saveMsProperties(msJson).then(function(pars) {
- saveMsProperties(policyType, data);
+ var msJson = JSON.parse(JSON.stringify(getMsJson(policyType)));
+ msJson["properties"] = data[0];
+ toscaModelService.saveMsProperties(msJson).then(function(pars) {
+ updateMsProperties(policyType, msJson);
}, function(data) {
});
if($scope.editor) { $scope.editor.destroy(); $scope.editor = null; }
diff --git a/src/main/resources/META-INF/resources/designer/scripts/ToscaModelService.js b/src/main/resources/META-INF/resources/designer/scripts/ToscaModelService.js
index 222c2c96a..ad864a04c 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/ToscaModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/ToscaModelService.js
@@ -39,7 +39,7 @@ app.service('toscaModelService', ['alertService','$http', '$q', '$rootScope', fu
this.saveMsProperties = function(form) {
var loopName = getLoopName();
var def = $q.defer();
- var svcUrl = "/restservices/clds/v2/loop/updateMicroservicePolicies/" + loopName;
+ var svcUrl = "/restservices/clds/v2/loop/updateMicroservicePolicy/" + loopName;
$http.post(svcUrl, form).success(function(data) {
def.resolve(data);
}).error(function(data) {
diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
index 9b236565d..044b21eca 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
@@ -21,11 +21,11 @@
*
*/
-function saveMsProperties(type, form) {
- var newMsProperties = cl_props["microServicePolicies"];
+function updateMsProperties(type, form) {
+ var newMsProperties = cl_props["microServicePolicies"];
for (p in newMsProperties) {
if (newMsProperties[p]["name"] == type) {
- newMsProperties[p]["properties"] = form;
+ cl_props["microServicePolicies"][p] = form;
}
}
}