diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-08-06 15:26:47 +0200 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-08-06 15:26:47 +0200 |
commit | ae5dce00beb6cdd61f28b566479d6111b3f8ada2 (patch) | |
tree | cdbd62e75840967fa3d0263c5350d43119ff5da0 /src/main | |
parent | f744247f2b725152d4959eb6fe4cb59d9d7223d7 (diff) |
Remove commented lines
Rework the javascript code and commented lines removed + re-indenting
Issue-ID: CLAMP-191
Change-Id: Idc188276ebc12a0af5458acc634d53a80dabc2de
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'src/main')
2 files changed, 201 insertions, 283 deletions
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html index 7f4dafdb..3a894c28 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html @@ -554,7 +554,7 @@ label { $("#formId" + count).append(form); $(".formId").not($("#formId" + count)).css("display", "none") addCustListen(count) - //addTabListen(count) + addSelectListen(count); // This is for when the process is not loading from map but being created if(!loadingId){ @@ -602,27 +602,7 @@ label { $("#add_one_more").click(); } - - - //listener will change the tab name to the recipe - function addTabListen(count){ - - // disable parentPolicyConditions when a parentPolicy is not selected - //don't think this is used.. - /* $("#formId"+count+" #parentPolicy").on("change",function(){ - if($("#formId"+count+" #parentPolicy").val().toString()==""){ - // deselect all options - $("#formId"+count+" #parentPolicyConditions option:selected").prop("selected", false); - // disable the select box - $("#formId"+count+" #parentPolicyConditions").multiselect("disable"); - - } else { - $("#formId"+count+" #parentPolicyConditions").multiselect("enable"); - - } - }); */ - } - + function addCustListen(count) { $('#go_properties_tab' + count).click(function(event) { $("#nav_Tabs li").removeClass("active"); 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 babdeb6f..00a56246 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 @@ -51,26 +51,22 @@ text-align: center; margin-top: 17px; } - #paramsWarn { - display: none; + +#paramsWarn { + display: none; } </style> -<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> +<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; - - } - + document.getElementById("fileUpload").disabled = true; + } + function disableSVN() { + document.getElementById("schemaLocation").disabled = true; + document.getElementById("userID").disabled = true; + document.getElementById("password").disabled = true; + } </script> @@ -80,69 +76,74 @@ aria-hidden="true" style="margin-top: -3px">×</button> <h4>Model Properties</h4> </div> - + <div class="modal-body" style="height: 280px"> - <i hidden id="ridinSpinners" class="fa fa-spinner fa-spin" style="display:none;margin-bottom:10px;width:100%;text-align:center;font-size:24px;color:black;"></i> - <form id="saveProps" > - <div class="alert alert-danger" role="alert" id='paramsWarn'> - <strong>Ooops!</strong> Unable to load properties for <span id='servName'>. Would you like to</span> - <a href="javascript:void(0);" class="btn-link" id='paramsRetry'>Retry </a> / - <a href="javascript:void(0);" class="btn-link" id='paramsCancel'>Cancel</a> - </div> - <div> - - <div class="form-group clearfix"> - <label for="services" class="col-sm-4 control-label" >Services</label> - - <div class="col-sm-8"> - <select class="form-control" - name="service" id="service" onchange="propChangeAlert(this);"> -<!-- <option ng-repeat="(key, value) in services" value="{{key}}">{{value}}</option> --> - </select> - </div> + <i hidden id="ridinSpinners" class="fa fa-spinner fa-spin" + style="display: none; margin-bottom: 10px; width: 100%; text-align: center; font-size: 24px; color: black;"></i> + <form id="saveProps"> + <div class="alert alert-danger" role="alert" id='paramsWarn'> + <strong>Ooops!</strong> Unable to load properties for <span + id='servName'>. Would you like to</span> <a + href="javascript:void(0);" class="btn-link" id='paramsRetry'>Retry + </a> / <a href="javascript:void(0);" class="btn-link" id='paramsCancel'>Cancel</a> + </div> + <div> + + <div class="form-group clearfix"> + <label for="services" class="col-sm-4 control-label">Services</label> + + <div class="col-sm-8"> + <select class="form-control" name="service" id="service" + onchange="propChangeAlert(this);"> + <!-- <option ng-repeat="(key, value) in services" value="{{key}}">{{value}}</option> --> + </select> </div> - <div class="form-group clearfix"> - <label for="vf" class="col-sm-4 control-label"> - Resource-VF</label> + </div> + <div class="form-group clearfix"> + <label for="vf" class="col-sm-4 control-label"> Resource-VF</label> - <div class="col-sm-8"> - <select class="form-control" id="vf" name="vf" onchange="propChangeAlert(this);"> + <div class="col-sm-8"> + <select class="form-control" id="vf" name="vf" + onchange="propChangeAlert(this);"> - </select> + </select> - </div> </div> - - <div class="form-group clearfix"> - <label for="actionSet" class="col-sm-4 control-label"> - Action Set</label> + </div> - <div class="col-sm-8"> - <select class="form-control" id="actionSet" name="actionSet" onchange="propChangeAlert(this);"> - </select> + <div class="form-group clearfix"> + <label for="actionSet" class="col-sm-4 control-label"> + Action Set</label> + + <div class="col-sm-8"> + <select class="form-control" id="actionSet" name="actionSet" + onchange="propChangeAlert(this);"> + </select> - </div> </div> - - <div class="form-group clearfix"> - <label for="location" class="col-sm-4 control-label"> - Location</label> + </div> + + <div class="form-group clearfix"> + <label for="location" class="col-sm-4 control-label"> + Location</label> - <div class="col-sm-8"> - <select class="form-control" id="location" name="location" multiple size=2> + <div class="col-sm-8"> + <select class="form-control" id="location" name="location" + multiple size=2> - </select> + </select> - </div> </div> - - - </div> + + + </div> + </form> - <div class="alert alert-warning propChangeWarn" style="display:none;"> - <strong>Warning!</strong> Changing these properties will reset all associated GUI fields. + <div class="alert alert-warning propChangeWarn" style="display: none;"> + <strong>Warning!</strong> Changing these properties will reset all + associated GUI fields. </div> </div> @@ -153,205 +154,142 @@ class="btn btn-primary">Cancel</button> </div> - <!-- <select id="vUSP_vfc" disabled hidden></select> - <select id="vUSP_location" disabled hidden></select> - <select id="vUSP_recipe" disabled hidden></select> - <select id="vUSP_vf" disabled hidden></select> - - <select id="Trinity_vfc" disabled hidden></select> - <select id="Trinity_location" disabled hidden></select> - <select id="Trinity_recipe" disabled hidden></select> - <select id="Trinity_vf" disabled hidden></select> - - - <select id="vSCP_vfc" disabled hidden></select> - <select id="vSCP_location" disabled hidden></select> - <select id="vSCP_recipe" disabled hidden></select> - <select id="vSCP_vf" disabled hidden></select> - - <select id="vProbes_vfc" disabled hidden></select> - <select id="vProbes_location" disabled hidden></select> - <select id="vProbes_recipe" disabled hidden></select> - <select id="vProbes_vf" disabled hidden></select> --> - - - <script> -// $.ajax({ -// async:false, -// dataType: "json", -// url: '/restservices/clds/v1/clds/asdc/services/', -// success: function(data){ -// vf_Services=data; -// }, -// error:function(s,a,err){ -// console.log(err) -// console.log(s) -// console.log(a) -// }, -// timeout:100000 -// }); -// var services=vf_Services.service -// console.log(elementMap["global"]) -// for(k in services){ -// console.log("lol") -// $("#service").append("<option value="+k+">"+services[k]+"</option>") -// } -// loadSharedPropertyByService() -// var el = elementMap["global"]; -// $("#status").val($("#activity_modeler").text()) -// if (el !== undefined) { -// for (var i = 0; i < el.length; i++) { -// $("#" + el[i].name).val(el[i].value); -// } -// } - - //display message only if global was previously saved - serDiff = false; - vfDiff = false; - asDiff = false; - - (function () { - $("#paramsWarn").hide(); - /*Below service method is called for checking the service is being loaded or not*/ - - var intialize = intializeService; - - function intializeService() { - $("#service").off('focus').off('change'); - - $("#service").on('change', function(){ - var chosen = $(this).val(); - (function(spinner){ - $("#ridinSpinners").show(); - setTimeout(spinner, 1); - })(function(){ - loadSharedPropertyByService(chosen, null, intialize); - if (elementMap["global"]){ - if ($("#vf").val() == oldVf){ - vfDiff = false; - if ((!vfDiff)&&(!asDiff)&&(!serDiff)){ - $(".propChangeWarn").hide(); - }; - } else { - vfDiff = true; - $(".propChangeWarn").show(); - } - } - $("#ridinSpinners").hide(); - }); - }); - } - - loadSharedPropertyByService(undefined, null, intialize); - intializeService(); - - $("#paramsRetry").on('click', function () { - //$("#paramsWarn").hide(); - var currentValue = $("#service").val(); - $("#ridinSpinners").css("display","") - var bool=loadSharedPropertyByService(currentValue); - $("#ridinSpinners").css("display","none") - }); - $("#paramsCancel").on('click', function () { - loadSharedPropertyByServiceProperties(); - $("#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++){ - if (elementMap["global"][i]["name"]=="vf"){ - oldVf = elementMap["global"][i]["value"]; - } - } - } else { - oldVf = ""; - } - }); - - function propChangeAlert(actionset){ - //throw warnings only if options were previously chosen - if (elementMap["global"]){ - loop1: - for (var i=0; i< elementMap["global"].length; i++){ - if (elementMap["global"][i]["name"] == actionset.id){ - //user did not change properties - if (elementMap["global"][i]["value"][0] == actionset.value){ - if (elementMap["global"][i]["name"] == "actionSet"){ - asDiff = false; - } else if (elementMap["global"][i]["name"] == "service"){ - serDiff = false; - } else if (elementMap["global"][i]["name"] == "vf"){ - vfDiff = false; - } - if ((!vfDiff)&&(!asDiff)&&(!serDiff)){ - $(".propChangeWarn").hide(); - }; - //user changed properties - } else { - if (elementMap["global"][i]["name"] == "actionSet"){ - asDiff = true; - } else if (elementMap["global"][i]["name"] == "service"){ - serDiff = true; - } else if (elementMap["global"][i]["name"] == "vf"){ - vfDiff = true; - }; - $(".propChangeWarn").show(); - } - break loop1; - } - } - } - } - - $("#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> + //display message only if global was previously saved + serDiff = false; + vfDiff = false; + asDiff = false; + (function() { + $("#paramsWarn").hide(); + /*Below service method is called for checking the service is being loaded or not*/ + var intialize = intializeService; + function intializeService() { + $("#service").off('focus').off('change'); + $("#service").on('change', function() { + var chosen = $(this).val(); + (function(spinner) { + $("#ridinSpinners").show(); + setTimeout(spinner, 1); + })(function() { + loadSharedPropertyByService(chosen, null, intialize); + if (elementMap["global"]) { + if ($("#vf").val() == oldVf) { + vfDiff = false; + if ((!vfDiff) && (!asDiff) && (!serDiff)) { + $(".propChangeWarn").hide(); + } + ; + } else { + vfDiff = true; + $(".propChangeWarn").show(); + } + } + $("#ridinSpinners").hide(); + }); + }); + } + loadSharedPropertyByService(undefined, null, intialize); + intializeService(); + $("#paramsRetry").on('click', function() { + //$("#paramsWarn").hide(); + var currentValue = $("#service").val(); + $("#ridinSpinners").css("display", "") + var bool = loadSharedPropertyByService(currentValue); + $("#ridinSpinners").css("display", "none") + }); + $("#paramsCancel").on('click', function() { + loadSharedPropertyByServiceProperties(); + $("#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++) { + if (elementMap["global"][i]["name"] == "vf") { + oldVf = elementMap["global"][i]["value"]; + } + } + } else { + oldVf = ""; + } + }); + function propChangeAlert(actionset) { + //throw warnings only if options were previously chosen + if (elementMap["global"]) { + loop1: for (var i = 0; i < elementMap["global"].length; i++) { + if (elementMap["global"][i]["name"] == actionset.id) { + //user did not change properties + if (elementMap["global"][i]["value"][0] == actionset.value) { + if (elementMap["global"][i]["name"] == "actionSet") { + asDiff = false; + } else if (elementMap["global"][i]["name"] == "service") { + serDiff = false; + } else if (elementMap["global"][i]["name"] == "vf") { + vfDiff = false; + } + if ((!vfDiff) && (!asDiff) && (!serDiff)) { + $(".propChangeWarn").hide(); + } + ; + //user changed properties + } else { + if (elementMap["global"][i]["name"] == "actionSet") { + asDiff = true; + } else if (elementMap["global"][i]["name"] == "service") { + serDiff = true; + } else if (elementMap["global"][i]["name"] == "vf") { + vfDiff = true; + } + ; + $(".propChangeWarn").show(); + } + break loop1; + } + } + } + } + $("#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> |