diff options
author | Anaël Closson <ac2550@intl.att.com> | 2017-09-11 15:38:03 +0200 |
---|---|---|
committer | Sébastien Determe <sd378r@intl.att.com> | 2017-09-13 14:46:19 +0000 |
commit | 5a4f2a1c04d88be4fd30b3d2e285aad9b23cf796 (patch) | |
tree | 80fe109040f09c91d096334df3c689d9e62450cc | |
parent | 03ab91582bd465b481567169904e44e7aa107f64 (diff) |
Policy and StringMatch GUI need refresh
A reload of GUI for Policy and StringMatch was required to see changes
done in some select fields. This patch add automatic updates of fields
that needs it.
Change-Id: Ida7ad705218b1881868dcdec936c809b19df69bd
Issue-Id: CLAMP-53
Signed-off-by: Anaël Closson <ac2550@intl.att.com>
2 files changed, 81 insertions, 8 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 5e809ae05..4f7a77d4e 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 @@ -236,7 +236,7 @@ label{ <div class="form-group clearfix" > <label class="col-sm-4 control-label" for="recipe">Recipe</label> <div class="col-sm-8"> - <select class="form-control" name="recipe" id="recipe" enableFilter="false"></select> + <select class="form-control" name="recipe" id="recipe" enableFilter="true"></select> </div> </div> <div class="form-group clearfix"> @@ -270,7 +270,7 @@ label{ Parent Policy</label> <div class="col-sm-8"> <select class="form-control" id="parentPolicy" - name="parentPolicy" enableFilter="false"><option value=""></option></select> + name="parentPolicy" enableFilter="true"><option value=""></option></select> </div> </div> <div class="form-group clearfix"> @@ -395,7 +395,35 @@ label{ } } - + + function addSelectListen(count) { + var onSelectChange = function() { + var opselected = this.selectedOptions[0].text; + + if (this.id == "recipe"){ + if(opselected!==""){ + var polCount = $(this).closest("[id^='formId']").attr("id").substring(6); + $(this).closest(".policyPanel").find("#go_properties_tab"+polCount).text(opselected); + } else { + $(this).closest("[id^='go_properties_tab']").text("Policy"); + } + } + + if (this.id=="parentPolicy"){ + var ppCond = $(this).closest("[id^='formId']").find("#parentPolicyConditions"); + if(opselected==""){ + ppCond.multiselect("clearSelection"); + ppCond.multiselect("disable"); + } else { + ppCond.multiselect("enable"); + } + } + }; + $("#formId"+count+" select").each( function () { + this.change = onSelectChange; + }); + } + //This is ensure there are no repeated keys in the map function noRepeats(form) { @@ -487,6 +515,7 @@ label{ $(".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){ var l=makeid() @@ -830,4 +859,4 @@ label{ $(".policyPanel").css("display", "unset"); } </script> -</div>
\ No newline at end of file +</div> diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/stringMatch_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/stringMatch_properties.html index 018a4535b..49ac07d73 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/stringMatch_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/stringMatch_properties.html @@ -283,7 +283,7 @@ label{ <div class="form-group clearfix"> <label for="vfc" class="col-sm-4 control-label">Resource-VFC</label> <div class="col-sm-8"> - <select class="form-control" id="vfc" name="vfc"> + <select class="form-control" id="vfc" name="vfc" enableFilter="true"> </select> @@ -292,7 +292,7 @@ label{ <div class="form-group clearfix"> <label for="alarmCondition" class="col-sm-4 control-label">Alarm Condition</label> <div class="col-sm-8"> - <select class="form-control" id="alarmCondition" name="alarmCondition"> + <select class="form-control" id="alarmCondition" name="alarmCondition" enableFilter="true"> </select> </div> @@ -350,7 +350,7 @@ label{ <div class="col-sm-8"> <select class="form-control" id="outputEventName" - name="outputEventName" enableFilter="false"></select> + name="outputEventName" enableFilter="true"></select> </div> </div> @@ -376,8 +376,9 @@ label{ // css attribute display:none $("#add_one_more").click(function(event) { event.preventDefault(); - add_one_more(); + num = add_one_more(); setMultiSelect(); + addSelectListen(num); }); @@ -460,6 +461,8 @@ label{ alarm_conditions_temp=""; event_severity_temp=""; event_type_source_temp=""; + + addSelectListen(num); } //Adding all the ids for parent String options @@ -667,6 +670,47 @@ label{ }) } + function addSelectListen(count) { + var onSelectChange = function() { + var opselected = this.selectedOptions[0].text; + + if (this.id=="outputEventName"){ + if(opselected!==""){ + var stringMatchCount = $(this).closest("[id^='formId']").attr("id").substring(6); + $(this).closest(".stringMatchPanel").find("#go_properties_tab"+stringMatchCount).text(opselected); + } else { + $(this).closest("[id^='go_properties_tab']").text("Condition"); + } + } + + if (this.id=="vfc"){ + var vfcCount = $(this).closest("[id^='formId']").attr("id").substring(6); + if(opselected!==""){ + setAlarmConditions(opselected, vfcCount); + setAlertDescription(opselected, vfcCount); + } else { + $(this).closest(".formId").find("#eventSourceType").val(""); + $(this).closest(".formId").find("#eventSeverity").val(""); + } + } + + if (this.id=="alarmCondition"){ + var alarmCount = $(this).closest("[id^='formId']").attr("id").substring(6); + if(opselected!==""){ + setEventSourceType(opselected.toString(), alarmCount, "alarm"); + } else { + $(this).closest(".formId").find("#eventSourceType").val(""); + $(this).closest(".formId").find("#eventSeverity").val(""); + } + } + + }; + + $("#formId"+count+" select").each( function () { + this.change = onSelectChange; + }); + } + function addCustListen(count) { $('#go_properties_tab' + count).click(function(event) { $("#nav_Tabs li").removeClass("active"); |