diff options
author | xg353y <xg353y@intl.att.com> | 2019-03-15 15:06:25 +0100 |
---|---|---|
committer | xg353y <xg353y@intl.att.com> | 2019-03-15 16:17:53 +0100 |
commit | 7fc8fd594dddbd079fcb8419f658e08620eb38c7 (patch) | |
tree | ad4e98e197943668d305bcc265e46ed61d89b161 /src/main/resources | |
parent | 2e4242e58dbc659e11df212115b9c8827d548167 (diff) |
Rework UI
Fix bugs due to the data model change
Issue-ID: CLAMP-318
Change-Id: If3750505a5f496caae61c01c2179e058e79eba52
Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/main/resources')
5 files changed, 11 insertions, 12 deletions
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; } } } |