+ $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();
+ }
+