2 ============LICENSE_START=======================================================
4 ================================================================================
5 Copyright (C) 2017 AT&T Intellectual Property. All rights
7 ================================================================================
8 Licensed under the Apache License, Version 2.0 (the "License");
9 you may not use this file except in compliance with the License.
10 You may obtain a copy of the License at
12 http://www.apache.org/licenses/LICENSE-2.0
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19 ============LICENSE_END============================================
20 ===================================================================
21 ECOMP is a trademark and service mark of AT&T Intellectual Property.
26 background-color:#dddd;
30 background-color: #dddd;
38 .fileUpload input.upload {
47 filter: alpha(opacity = 0);
52 display: inline-block;
63 /* box-sizing:border-box; */
74 vertical-align:middle;
77 .leftStringMatchPanel{
81 #createNewStringMatch{
84 background-color:#f2bfab;
100 background-color: #f5f5f5;
107 padding: 2px 2px 2px 30px;
116 #stringMatchTable tr{
117 border-bottom: 1px solid #ddd;
118 border-collapse: collapse;
124 #stringMatchTable td{
128 #stringMatchTable tr.highlight{
129 background-color: #f5f5f5;
134 #stringMatchTableHolder{
147 <script type="text/javascript">
148 function disablefile() {
150 document.getElementById("fileUpload").disabled = true;
154 function disableSVN() {
155 var selectLength = document.querySelectorAll(".disabled-block-container .tab-close-popup");
156 if(selectLength && selectLength.length>0){
157 for(var i = 0; i< selectLength.length ; i++){
158 selectLength[i].disabled = true;
162 document.getElementById("schemaLocation").disabled = true;
163 document.getElementById("userID").disabled = true;
164 document.getElementById("password").disabled = true;
170 <div attribute-test="stringMatchwindowproperties" id="configure-widgets" class="disabled-block-container">
171 <div attribute-test="stringMatchwindowpropertiesh" class="modal-header">
172 <button type="button" class="close" ng-click="close(false)"
173 aria-hidden="true" style="margin-top: -3px">×</button>
174 <h4>String Matching Micro Service</h4>
178 <div class="modal-body">
179 <div attribute-test="stringMatchwindowpropertiesb" class="modal-body row">
181 <div class="leftStringMatchPanel">
182 <div class="panel panel-default">
183 <i class="modelSearchBox"></i> <input type="text"
184 id="stringMatchSearch" onkeyup="searchStringMatchList()"
185 placeholder="Search ...">
186 <div id="stringMatchTableHolder">
187 <table id="stringMatchTable"></table>
190 <div style="float: left">
191 <button type="button" id="createNewStringMatch" class="btn btn-sm">New Group</button>
194 <div style="float: right">
195 <button type="button" id="deleteStringMatch" class="btn btn-sm glyphicon glyphicon-trash" disabled></button>
198 <div id="repeatIdError" class="idError">Error: This Group name is already taken.</div>
199 <div id="newIdError" class="idError">Error: Please rename your new Group.</div>
202 <div class="panel panel-default col-sm-9 stringMatchPanel"
203 style="display: none;">
204 <form id="topicPublish" class="form-horizontal">
206 <!-- As per the last minute new requirements for 1707 the ID needs to be hidden and we need to have a friendly name instead -->
207 <div style="display: none;">
208 <div class="form-group clearfix">
209 <label class="col-sm-4 control-label">Resource Group Id</label>
210 <div class="col-sm-8">
211 <input class="form-control" id="rgname" name="rgname" readOnly> </input>
217 <div class="form-group clearfix">
218 <label class="col-sm-4 control-label">Resource Group</label>
219 <div class="col-sm-8">
220 <input class="form-control" maxlength="48" placeholder="Enter Unique Name" id="rgfriendlyname" name="rgfriendlyname"> </input>
225 <!--Policy's drop down box -->
226 <div class="form-group clearfix">
227 <label class="col-sm-4 control-label">Ops Policy:</label>
228 <div class="col-sm-8">
229 <select class="form-control" id="policyName" name="policyName"
230 autofocus="autofocus" required ng-trim="true" enableFilter="true">
231 <option ng-repeat="x in policyNames" value="{{x}}">{{x}}</option>
239 <div class="panel-heading" style="background-color: white;">
240 <ul id="nav_Tabs" class="nav nav-tabs">
241 <li class><a id="add_one_more" href="#desc_tab"><span
242 class="glyphicon glyphicon-plus" aria-hidden="true"></span></a></li>
245 <div class="panel-body">
246 <div class="tab-content">
247 <div id="properties_tab" class="tab-pane fade in active"></div>
252 <span id="formSpan" style="display: none">
253 <form class="saveProps" class="form-horizontal">
256 <div class="form-group clearfix">
257 <label for="aaiMatchingFields" class="col-sm-4 control-label">AAI Fields Matching </label>
258 <div class="col-sm-8">
259 <select class="form-control" name="aaiMatchingFields" id="aaiMatchingFields" multiple size=2></select>
263 <div class="form-group clearfix">
264 <label for="aaiSendFields" class="col-sm-4 control-label">AAI Fields Send (Select Multiple)</label>
266 <div class="col-sm-8 ">
267 <select class="form-control" id="aaiSendFields"
268 name="aaiSendFields" multiple size=2>
273 <!-- <div class="form-group clearfix"> -->
274 <!-- <label for="groupNumber" class="col-sm-4 control-label"> -->
275 <!-- Resource-Group</label> -->
277 <!-- <div class="col-sm-8"> -->
278 <!-- <input type="number" class="form-control" id="groupNumber" -->
279 <!-- name="groupNumber" min="0"> </input> -->
283 <div class="form-group clearfix">
284 <label for="vfc" class="col-sm-4 control-label">Resource-VFC</label>
285 <div class="col-sm-8">
286 <select class="form-control" id="vfc" name="vfc" enableFilter="true">
292 <div class="form-group clearfix">
293 <label for="alarmCondition" class="col-sm-4 control-label">Alarm Condition</label>
294 <div class="col-sm-8">
295 <select class="form-control" id="alarmCondition" name="alarmCondition" enableFilter="true">
300 <div class="form-group clearfix">
301 <label for="eventSeverity" class="col-sm-4 control-label">Event Severity</label>
302 <div class="col-sm-8">
303 <select class="form-control" id="eventSeverity"
304 name="eventSeverity" enableFilter="false"></select>
307 <div class="form-group clearfix">
308 <label for="eventSourceType" class="col-sm-4 control-label">
309 Event Source Type</label>
310 <div class="col-sm-8">
311 <input type="text" class="form-control" id="eventSourceType"
312 name="eventSourceType" readOnly></input>
316 <div class="form-group clearfix">
317 <label for="timeWindow" class="col-sm-4 control-label">
320 <div class="col-sm-8">
321 <input type="text" maxlength="5" class="form-control"
322 onkeypress="return isNumberKey(event)"
323 id="timeWindow" name="timeWindow" />
326 <div class="form-group clearfix">
327 <label for="ageLimit" class="col-sm-4 control-label"> Age
330 <div class="col-sm-8">
331 <input type="text" maxlength="5" class="form-control" id="ageLimit"
332 onkeypress="return isNumberKey(event)"
336 <div class="form-group clearfix">
337 <label for="createClosedLoopEventId"
338 class="col-sm-4 control-label"> Create CL Event ID</label>
339 <div class="col-sm-8">
340 <select class="form-control" id="createClosedLoopEventId"
341 name="createClosedLoopEventId" enableFilter="false">
347 <div class="form-group clearfix">
348 <label for="outputEventName" class="col-sm-4 control-label">
349 Output Event Name</label>
351 <div class="col-sm-8">
352 <select class="form-control" id="outputEventName"
353 name="outputEventName" enableFilter="true"></select>
366 <div attribute-test="stringMatchwindowpropertiesf" class="modal-footer">
367 <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
368 <button id="savePropsBtn" class="btn btn-primary">Close</button>
369 <button ng-click="close(true)" id="close_button"
370 class="btn btn-primary">Cancel</button>
375 //Basically this method will add a new form. All forms share the same class. When you want one form to show(active form) the other forms get the
376 // css attribute display:none
377 $("#add_one_more").click(function(event) {
378 event.preventDefault();
379 num = add_one_more();
381 addSelectListen(num);
385 //This method will load the existing Strin Match onto the screen
386 loadPropertyWindow("string_match");
389 // By default, parentStringMatchConditions is disabled
390 $("#parentStringMatchConditions").prop('disabled', 'disabled');
393 var parent_stringMatch = {}
394 var stringMatch_ids = {}
395 var loadingId = false;
398 var alarm_conditions_temp=""
399 var event_severity_temp=""
400 var event_type_source_temp=""
402 //Grab saved values for dropdowns
403 var obj = elementMap[lastElementSelected];
405 if (!($.isEmptyObject(obj))) {
406 allSMatch = jQuery.extend({}, obj);
407 for ( var x in allSMatch) {
408 $("#stringMatchTable").prepend(
409 "<tr><td>" + x + "</td></tr>");
414 //Load properties_tab for a chosen String Match
415 function disperseConfig(stringMatchObj, id) {
416 //remove old gui forms
417 for (var i = 1; i < ($(".formId").length + 1); i++) {
418 $("#go_properties_tab" + i).parent().remove();
420 $(".formId").remove();
422 if (stringMatchObj !== undefined) {
423 var el = stringMatchObj[id][4]['serviceConfigurations']
424 for (var i = 0; i < el.length; i++) {
426 var num = add_one_more();
428 for (var j = 0; j < el[i].length; j++) {
429 if (el[i][j]["stringSet"] !== undefined) {
430 var ss = el[i][j]["stringSet"]
431 for (var o = 0; o < ss.length; o++) {
432 if(ss[o].hasOwnProperty("name")){
433 if(ss[o].name==="alarmCondition"){
434 alarm_conditions_temp=ss[o].value
435 }else if(ss[o].name==="eventSeverity"){
436 event_severity_temp=ss[o].value;
437 }else if(ss[o].name==="eventSourceType"){
438 event_type_source_temp=ss[o].value;
441 $("#formId" + num + " #" + ss[o].name).val(ss[o].value);
445 }else if(el[i][j].hasOwnProperty("name") && el[i][j].name==="vfc"){
446 vfc_temp=el[i][j].value
448 else if (el[i][j].name === 'outputEventName' && el[i][j].value.toString() !== '') {
449 $("#go_properties_tab" + num).text(el[i][j].value);
450 $("#formId" + num + " #" + el[i][j].name).val(el[i][j].value);
453 if(el[i][j].hasOwnProperty("name")){
454 $("#formId" + num + " #" + el[i][j].name).val(
459 set_vfc_alarm_event(num);
461 alarm_conditions_temp="";
462 event_severity_temp="";
463 event_type_source_temp="";
465 addSelectListen(num);
468 //Adding all the ids for parent String options
469 for (var i = 1; i <= $(".formId").length; i++) {
470 for (k in stringMatch_ids) {
471 if ($("#formId" + i + " #_id").val() !== stringMatch_ids[k].toString() && $(k + " #recipe").val() !== undefined && $(k + " #recipe").val() !== "") {
472 $("#formId" + i + " #parentStringMatch").append("<option value=\""+stringMatch_ids[k]+"\">"+ $(k + " #recipe").val()+ "</option>");
477 for (k in parent_stringMatch) {
478 $("#formId" + k + " #parentStringMatch").val(parent_stringMatch[k]);
479 // force the change event
480 $("#formId" + k + " #parentStringMatch").change();
483 if (stringMatchObj[id][0]) {
484 $("#" + stringMatchObj[id][0].name).val(stringMatchObj[id][0].value);
487 if (stringMatchObj[id][1]) {
488 $("#" + stringMatchObj[id][1].name).val(stringMatchObj[id][1].value);
491 if (stringMatchObj[id][2]) {
492 $("#" + stringMatchObj[id][2].name).val(stringMatchObj[id][2].value);
498 if (readOnly||readMOnly){
499 $('select[multiple] option').each(function() {
500 var input = $('input[value="' + $(this).val() + '"]');
501 input.prop('disabled', true);
502 input.parent('li').addClass('disabled');
504 $('input[value="multiselect-all"]').prop('disabled', true).parent('li').addClass('disabled');
509 //This is ensure there are no repeated keys in the map
510 function noRepeats(form) {
511 //triggered per String.
513 for (var i = 0; i < form.length; i++) {
514 if (select[form[i].name] === undefined)
515 select[form[i].name] = []
516 select[form[i].name].push(form[i].value);
528 $("#savePropsBtn").click(function(event) {
529 $(".idError").hide();
530 if ($("#stringMatchTable .highlight td").html() !== $("#rgfriendlyname").val()){
532 if ($.inArray($("#rgfriendlyname").val(), Object.keys(allSMatch)) > -1){
533 $("#repeatIdError").show();
535 } else { //not repeated
536 delete allSMatch[$("#stringMatchTable .highlight td").html()];
540 if ($("#stringMatchTable .highlight").length > 0) {
541 saveLastStringMatchLocally($("#stringMatchTable .highlight td").html());
543 if ($("#rgfriendlyname").val().trim() == "New_Group"){
544 $("#newIdError").show();
548 //Removes outdated (deleted) resource Groups by checking against left menu
549 var finalSaveList = {};
550 $("#stringMatchTable td").each(function() {
551 var tableVal = $(this).text();
552 if (tableVal in allSMatch) {
553 finalSaveList[tableVal] = allSMatch[tableVal];
557 saveProperties(finalSaveList);
558 $("#close_button").click();
561 function add_one_more() {
562 $("#nav_Tabs li").removeClass("active");
564 //FormSpan contains a block of the form that is not being displayed. We will create clones of that and add them to tabs
565 var form = $($("#formSpan").children()[0]).clone()
567 //Each new tab will have the formId class attached to it. This way we can track how many forms we currently have out there and assign listeners to them
568 if ($(".formId").length > 0) {
570 var s = $(".formId");
571 for (var i = 0; i < s.length; i++) {
572 if (parseInt($(s[i]).attr("id").substring(6)) > greatest) {
573 greatest = parseInt($(s[i]).attr("id").substring(6))
576 count = greatest + 1;
577 $("#properties_tab").append(
578 ('<span class="formId" id="formId'+count+'"></span>'));
581 $("#properties_tab").append(
582 '<span class="formId" id="formId1"></span>');
585 //$(form).find("#stringMatchName").val("Recipe "+makid(2))
586 //TODO change up how we auto assign stringMatchName. There could be the case where we do this and it will have repeats
587 //alert($(form).find("#_id").val())
588 //stringMatchNameChangeListener(form)
593 ' <li class="active"><a id="go_properties_tab'+count+'">Condition</a><button id="tab_close'+count+'" type="button" class="close tab-close-popup" aria-hidden="true" style="margin-top: -30px;margin-right: 5px">×</button></li>');
594 $("#formId" + count).append(form);
595 $(".formId").not($("#formId" + count)).css("display", "none")
599 // This is for when the process is not loading from map but being created
602 $(form).find("#_id").val(l)
603 stringMatch_ids["#formId" + count] = l
613 function add_new_stringMatch(issueNewNames) {
614 //remove old gui forms
615 for (var i = 1; i < ($(".formId").length + 1); i++) {
616 $("#go_properties_tab" + i).parent().remove();
618 $(".formId").remove();
621 var ms = new Date().getTime();
623 $("#rgname").val(defSMatch);
625 $("#rgfriendlyname").val("New_Group");
627 $("#add_one_more").click();
631 //listener will change the tab name to the recipe
632 function addTabListen(count) {
633 $("#formId" + count + " #recipe").on("change",function() {
634 if ($("#formId" + count + " #recipe").val().toString() !== "") {
635 $('#go_properties_tab' + count).text($("#formId" + count + " #recipe").val())
637 $('#go_properties_tab' + count).text("String");
641 for (var i = 1; i <= greatestIdNum(); i++) {
642 if ($("#formId" + i).length > 0) {
644 answers["#formId" + i + " #parentStringMatch"] = $("#formId" + i + " #parentStringMatch").val()
645 $("#formId" + i + " #parentStringMatch").empty();
647 for (k in stringMatch_ids) {
648 if ($("#formId" + i + " #_id").val().toString() !== stringMatch_ids[k] && $(k + " #recipe").val() !== 'undefined' && $(k + " #recipe").val() !== "") {
649 $("#formId" + i + " #parentStringMatch").append("<option value='"+stringMatch_ids[k]+"''> "+ $(k+ " #recipe").val()+ "</option>")
652 $("#formId" + i + " #parentStringMatch").prepend("<option value=''></option>")
660 // disable parentStringMatchConditions when a parentStringMatch is not selected
661 $("#formId" + count + " #parentStringMatch").on("change",function() {
662 if ($("#formId" + count + " #parentStringMatch").val().toString() == "") {
663 // deselect all options
664 $("#formId"+ count+ " #parentStringMatchConditions option:selected").prop("selected", false);
665 // disable the select box
666 $("#formId"+ count+ " #parentStringMatchConditions").prop('disabled', 'disabled');
668 $("#formId"+ count+ " #parentStringMatchConditions").prop('disabled', false);
673 function addSelectListen(count) {
674 var onSelectChange = function() {
675 var opselected = this.selectedOptions[0].text;
677 if (this.id=="outputEventName"){
679 var stringMatchCount = $(this).closest("[id^='formId']").attr("id").substring(6);
680 $(this).closest(".stringMatchPanel").find("#go_properties_tab"+stringMatchCount).text(opselected);
682 $(this).closest("[id^='go_properties_tab']").text("Condition");
687 var vfcCount = $(this).closest("[id^='formId']").attr("id").substring(6);
689 setAlarmConditions(opselected, vfcCount);
690 setAlertDescription(opselected, vfcCount);
692 $(this).closest(".formId").find("#eventSourceType").val("");
693 $(this).closest(".formId").find("#eventSeverity").val("");
697 if (this.id=="alarmCondition"){
698 var alarmCount = $(this).closest("[id^='formId']").attr("id").substring(6);
700 setEventSourceType(opselected.toString(), alarmCount, "alarm");
702 $(this).closest(".formId").find("#eventSourceType").val("");
703 $(this).closest(".formId").find("#eventSeverity").val("");
709 $("#formId"+count+" select").each( function () {
710 this.change = onSelectChange;
714 function addCustListen(count) {
715 $('#go_properties_tab' + count).click(function(event) {
716 $("#nav_Tabs li").removeClass("active");
717 $(this).parent().addClass("active");
718 $("#formId" + count).css("display", "")
719 $(".formId").not($("#formId" + count)).css("display", "none")
722 $('#tab_close' + count).click(function(event) {
724 $(this).parent().remove();
725 delete stringMatch_ids["#formId" + count + " #_id"]
726 $("#formId" + count).remove();
730 function setStringSet(form) {
732 var alarmCondition = {}
733 var eventSeverity = {}
734 var eventSourceType = {}
735 for (var i = 0; i < form.length; i++) {
736 if (form[i].name === "alarmCondition") {
737 alarmCondition = form[i]
738 } else if (form[i].name === "eventSeverity") {
739 eventSeverity = form[i];
740 } else if (form[i].name === "eventSourceType") {
741 eventSourceType = form[i];
749 stringSet['stringSet'] = []
750 stringSet['stringSet'].push(alarmCondition);
751 stringSet['stringSet'].push(eventSeverity);
752 stringSet['stringSet'].push(eventSourceType);
758 //this will populate alarmcondition,vfc,eventtypesource if they are saved in elementmap
759 function set_vfc_alarm_event (count){
760 if(vfc_temp!=="" && vfc_temp!==undefined){
761 $("#formId"+count+" #vfc").val(vfc_temp)
763 if(alarm_conditions_temp!=="" && alarm_conditions_temp!==undefined){
764 setAlarmConditions(vfc_temp,count)
765 $("#formId"+count+" #alarmCondition").val(alarm_conditions_temp);
767 if(event_severity_temp!=="" && event_severity_temp!==undefined){
768 setEventSourceType(alarm_conditions_temp,count)
769 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
770 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
771 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
774 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
775 setEventSourceType(alarm_conditions_temp,count)
776 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
777 if(event_severity_temp!=="" && event_severity_temp!==undefined){
778 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
785 function setAlarmConditions(vfcID, count){
786 var alarmCondition={}
788 if($("#formId"+count+" #vfc").val()!==""){
789 if(vf_Services['shared'] && vf_Services['shared']['byVfc'] && vf_Services['shared']['byVfc'][vfcID]){
790 alarmCondition=vf_Services['shared']['byVfc'][vfcID]['alarmCondition']
794 $("#formId"+count+" #alarmCondition").empty();
795 $("#formId"+count+" #alarmCondition").append("<option value=\"\"></opton>");
796 if(alarmCondition && _.keys(alarmCondition).length>0){
797 for(key in alarmCondition){
798 var safestring = $('<div>').text(key).html();
799 $("#formId"+count+" #alarmCondition").append("<option value='"+safestring+"'>"+alarmCondition[key]+"</opton>");
801 $("#formId"+count+" #alarmCondition").multiselect("rebuild");
805 function setEventSourceType(alarm, count){
806 var eventSourceTypSeverity={}
807 if($("#formId"+count+" #alarmCondition").val()!==""){
808 if(vf_Services && vf_Services['shared'] && vf_Services['shared']['byAlarmCondition'] && vf_Services['shared']['byAlarmCondition'][alarm]){
809 eventSourceTypSeverity=vf_Services['shared']['byAlarmCondition'][alarm]
814 $("#formId"+count+" #eventSourceType").val(eventSourceTypSeverity.eventSourceType);
815 $("#formId"+count+" #eventSeverity").val(eventSourceTypSeverity.eventSeverity);
816 $("#formId"+count+" #eventSeverity").multiselect("rebuild");
819 function greatestIdNum() {
821 var s = $(".formId");
822 for (var i = 0; i < s.length; i++) {
823 if (parseInt($(s[i]).attr("id").substring(6)) > greatest) {
824 greatest = parseInt($(s[i]).attr("id").substring(6))
830 //Generate random id for each String
831 //Also made sure ids couldnt be repeated
832 function makeid(num) {
835 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
838 for (var i = 0; i < 7; i++)
839 text += possible.charAt(Math.floor(Math.random()
841 var hasValue = false;
842 for (k in stringMatch_ids) {
843 if (text === stringMatch_ids[k])
852 var ParentStringMatch = function(id, name) {
857 //String table search filter
858 function searchStringMatchList() {
859 var search = document.getElementById("stringMatchSearch");
860 var row = document.getElementsByTagName("td");
861 for (var i = 0; i < row.length; i++) {
862 if (row[i].innerHTML.toUpperCase().indexOf(
863 search.value.toUpperCase()) > -1) {
864 row[i].style.display = "";
866 row[i].style.display = "none";
871 function saveLastStringMatchLocally(lastStringMatchId) {
874 var properties = $(".saveProps").not("#formSpan .saveProps")
876 var topicPublish = $("#topicPublish").serializeArray();
878 for (var i = 0; i < topicPublish.length; i++) {
879 polForm.push(topicPublish[i]);
882 //The below three lines are added to make sure resource group can be save correctly even if the policy is not present
883 if (topicPublish.length == 2){
884 var pname = {name:"policyName", value:""};
886 var pid = {name:"policyId", value:""};
889 var selectedPName = topicPublish[2]["value"];
890 var pid = {name:"policyId", value:allPolicies[selectedPName][1]["value"]};
895 d["serviceConfigurations"] = [];
896 for (var i = 0; i < properties.length; i++) {
897 var ser = $(properties[i]).serializeArray();
898 var s = noRepeats(ser)
899 var newSer = setStringSet(s);
900 d["serviceConfigurations"].push(newSer);
903 allSMatch[lastStringMatchId] = polForm;
906 $("#deleteStringMatch").on('click', function() {
907 $(".idError").hide();
908 var deleteId = $("#stringMatchTable .highlight td").html();
909 delete allSMatch.deleteId;
910 $("#stringMatchTable .highlight").remove();
911 $("#rgfriendlyname").val('');
915 $('#stringMatchTable').on('click', 'tr', function(event) {
916 $(".idError").hide();
918 if ($("#stringMatchTable .highlight td").html() !== $("#rgfriendlyname").val()){
920 if ($.inArray($("#rgfriendlyname").val(), Object.keys(allSMatch)) > -1){
921 $("#repeatIdError").show();
923 } else { //not repeated
924 $("#repeatIdError").hide();
925 delete allSMatch[$("#stringMatchTable .highlight td").html()];
928 if ($("#rgfriendlyname").val().trim() == "New_Group"){
929 $("#newIdError").show();
932 if (!(readOnly||readMOnly)){
935 if ($("#stringMatchTable .highlight").length == 0){
940 $(this).addClass('highlight').siblings().removeClass('highlight');
941 disperseConfig(allSMatch, $(this).find("td").html());
945 $('#createNewStringMatch').on('click', function() {
946 $(".idError").hide();
948 if ($("#stringMatchTable .highlight td").html() !== $("#rgfriendlyname").val()){
950 if ($.inArray($("#rgfriendlyname").val(), Object.keys(allSMatch)) > -1){
951 $("#repeatIdError").show();
953 } else { //not repeated
954 $("#repeatIdError").hide();
955 delete allSMatch[$("#stringMatchTable .highlight td").html()];
958 if ($("#rgfriendlyname").val().trim() == "New_Group"){
959 $("#newIdError").show();
963 var defSMatch = add_new_stringMatch();
965 if (("#stringMatchTable .highlight").length > 0) {
966 $('#stringMatchTable tr.highlight').removeClass('highlight');
968 //$("#stringMatchTable").prepend("<tr class='highlight' id='" +defSMatch+ "''><td>"+ defSMatch + "</td></tr>");
969 $("#stringMatchTable").prepend("<tr class='highlight'><td>New_Group</td></tr>");
973 function isNumberKey(event){
974 var charCode = (event.which) ? event.which : event.keyCode
975 if (charCode > 31 && (charCode < 48 || charCode > 57)){
981 function startNextItem() {
982 //save last item before transitioning
983 var lastItem = $("#stringMatchTable .highlight");
986 if (lastItem.length > 0) {
987 saveLastStringMatchLocally($("#rgfriendlyname").val());
988 //lastItem.attr("id", $("#rgfriendlyname").val());
989 if($("#rgfriendlyname").val() != ''){
990 lastItem.find("td").html($("#rgfriendlyname").val());
997 if ($("#deleteStringMatch").prop("disabled")) {
998 $("#deleteStringMatch").prop("disabled", false);
1002 //Show table panel only
1003 function expandTable() {
1004 $(".stringMatchPanel").css("display", "none");
1005 $(".leftStringMatchPanel").removeClass("col-sm-3");
1006 $(".modelSearchBox").css("padding", "25px 12px");
1007 if (!($("#deleteStringMatch").prop("disabled"))) {
1008 $("#deleteStringMatch").prop("disabled", true);
1013 function collapseTable() {
1014 $(".leftStringMatchPanel").addClass("col-sm-3");
1015 $(".glyphicon-search").css("padding", "10px 12px");
1016 $(".stringMatchPanel").css("display", "unset");