diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-08-10 18:43:54 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-08-10 18:43:54 +0200 |
commit | 1229f31e9d9778aa082ad1244acf089f36f0a08b (patch) | |
tree | 0e33ca3c75943dbf272551e71a454431a7448eec | |
parent | 499e4e89cb68c99547df5632df358847b62ccc3f (diff) |
Fix issue with deploy params
Fix the problem when Global parameters are saved, it deletes the
deployParameters field
Issue-ID: CLAMP-195
Change-Id: Ie4a828ad81d52a321fc9385f0e3aea19880abfe7
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
3 files changed, 79 insertions, 92 deletions
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html index 00a56246f..811f6b716 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html @@ -23,52 +23,10 @@ <style> -.fileUpload { - position: relative; - overflow: hidden; - margin: 10px; -} - -.fileUpload input.upload { - position: absolute; - top: 0; - right: 0; - margin: 0; - padding: 0; - font-size: 20px; - cursor: pointer; - opacity: 0; - filter: alpha(opacity = 0); - float: left; -} - -.fileDisplay { - display: inline-block; - overflow: hidden; - float: right; - margin-left: 0px; - z-index: initial; - text-align: center; - margin-top: 17px; -} - #paramsWarn { display: none; } </style> -<link rel="stylesheet" - href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> -<script type="text/javascript"> - function disablefile() { - document.getElementById("fileUpload").disabled = true; - } - function disableSVN() { - document.getElementById("schemaLocation").disabled = true; - document.getElementById("userID").disabled = true; - document.getElementById("password").disabled = true; - } -</script> - <div id="configure-widgets"> <div class="modal-header"> @@ -135,7 +93,17 @@ </div> </div> + <div class="form-group clearfix"> + <label for="deployParameters" class="col-sm-4 control-label"> + Deploy Parameters</label> + <div class="col-sm-8"> + <textarea class="form-control" id="deployParameters" + name="deployParameters" rows="3"> + </textarea> + + </div> + </div> </div> @@ -148,8 +116,7 @@ </div> <div class="modal-footer"> - <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>--> - <button id="savePropsBtn" class="btn btn-primary">Save</button> + <button id="savePropsBtn" class="btn btn-primary" ng-click="submitForm()">Save</button> <button ng-click="close(true)" id="close_button" class="btn btn-primary">Cancel</button> @@ -204,26 +171,6 @@ $("#paramsWarn").hide(); }); })(); - function noRepeats(form) { - var select = {}; - for (var i = 0; i < form.length; i++) { - if (form[i].hasOwnProperty("name")) { - if (select[form[i].name] === undefined) - select[form[i].name] = [] - select[form[i].name].push(form[i].value); - } - } - var arr = [] - for (s in select) { - var f = {} - f.name = s - f.value = select[s] - if (!(s == "service" && f.value == "")) { - arr.push(f) - } - } - return arr - } $(function() { if (elementMap["global"]) { for (var i = 0; i < elementMap["global"].length; i++) { @@ -270,26 +217,5 @@ } } } - $("#saveProps").on('submit', function(event) { - saveGlobalProperties(noRepeats($(this).serializeArray())) - event.preventDefault(); - //module reset, based on property updates - if (elementMap["global"]) { - $.each(Object.keys(elementMap), function(i, v) { - if ((v.match(/^Policy/)) && asDiff) { - elementMap[v] = {}; - } - if ((v.match(/^TCA/)) && (vfDiff || serDiff)) { - elementMap[v] = {}; - } - }); - } - ; - $("#close_button").click(); - }) - $("#savePropsBtn").click(function(event) { - //alert($("#CProp_Target").val()) - $("#saveProps").submit(); - }) </script> </div> diff --git a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js index 1652c48b6..f4c658ce1 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js +++ b/src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js @@ -43,7 +43,13 @@ function($scope, $rootScope, $uibModalInstance, cldsModelService, $location, var el = elementMap["global"]; if (el !== undefined) { for (var i = 0; i < el.length; i++) { - $("#" + el[i].name).val(el[i].value); + if (el[i].name === 'deployParameters') + { + // This is a special case, that value is not a string but a JSON + $("#" + el[i].name).val(JSON.stringify(el[i].value)); + } else { + $("#" + el[i].name).val(el[i].value); + } } } setMultiSelect(); @@ -66,4 +72,56 @@ function($scope, $rootScope, $uibModalInstance, cldsModelService, $location, console.log("close"); $uibModalInstance.close("closed"); }; + $scope.convertDeployParametersJsonToString = function() { + var index = elementMap["global"].findIndex(function(e) { + return (typeof e == "object" && !(e instanceof Array)) + && "deployParameters" == e["name"]; + }); + if (index != -1) { + $('#deployParameters').val(JSON.stringify(elementMap["global"][index].value)); + } + } + + function noRepeats(form) { + var select = {}; + for (var i = 0; i < form.length; i++) { + if (form[i].hasOwnProperty("name")) { + if (form[i].name === 'deployParameters') { + // This is a special case, that value MUST not be a string but a JSON + select[form[i].name]=JSON.parse(form[i].value); + } else { + if (select[form[i].name] === undefined) + select[form[i].name] = [] + select[form[i].name].push(form[i].value); + } + } + } + var arr = [] + for (s in select) { + var f = {} + f.name = s + f.value = select[s] + if (!(s == "service" && f.value == "")) { + arr.push(f) + } + } + return arr + } + + $scope.submitForm = function() { + saveGlobalProperties(noRepeats($("#saveProps").serializeArray())) + //module reset, based on property updates + if (elementMap["global"]) { + $.each(Object.keys(elementMap), function(i, v) { + if ((v.match(/^Policy/)) && asDiff) { + elementMap[v] = {}; + } + if ((v.match(/^TCA/)) && (vfDiff || serDiff)) { + elementMap[v] = {}; + } + }); + } + $uibModalInstance.close(); + } + } ]); diff --git a/src/main/resources/boot-message.txt b/src/main/resources/boot-message.txt index 734af3c67..d8763e269 100644 --- a/src/main/resources/boot-message.txt +++ b/src/main/resources/boot-message.txt @@ -1,7 +1,10 @@ - ___ _ ___ __ __ ___ - / __| | | / \ | \/ | | _ \ - | (__ | |__ | - | | |\/| | | _/ - \___| |____| |_|_| |_|__|_| _|_|_ -_|"""""|_|"""""|_|"""""|_|"""""|_| """ | -"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-' + __ __ __ __ __ __ +/ \|\ | /\ |__) __ / ` /\ /__` /\ |__)| /\ |\ |/ ` /\ +\__/| \|/~~\| \__,/~~\.__//~~\|__)|___/~~\| \|\__,/~~\ + +\ __ / __ __ \ __ / + \ / \ / / `| /\ |\/||__) ||| \ / \ / + \\__// \__,|___/~~\| || ||| \\__// + + Starting ::
\ No newline at end of file |