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.
31 .fileUpload input.upload {
40 filter: alpha(opacity = 0);
45 display: inline-block;
56 /* box-sizing:border-box; */
64 label{text-align:right;
71 <script type="text/javascript">
72 function disablefile() {
74 document.getElementById("fileUpload").disabled = true;
78 function disableSVN() {
79 var selectLength = document.querySelectorAll(".disabled-block-container .tab-close-popup");
80 if(selectLength && selectLength.length>0){
81 for(var i = 0; i< selectLength.length ; i++){
82 selectLength[i].disabled = true;
88 document.getElementById("schemaLocation").disabled = true;
89 document.getElementById("userID").disabled = true;
90 document.getElementById("password").disabled = true;
96 <div attribute-test="stringmatchproperties" id="configure-widgets" class="disabled-block-container">
97 <div attribute-test="stringmatchpropertiesh" class="modal-header">
98 <button type="button" class="close" ng-click="close(false)"
99 aria-hidden="true" style="margin-top: -3px">×</button>
100 <h4>String Matching Micro Service</h4>
102 <div attribute-test="stringmatchpropertiesb" class="modal-body">
103 <div class="alert alert-danger" role="alert" id='paramsWarn'>
104 <strong>Ooops!</strong> Unable to load properties for <span id='servName'>. Would you like to</span>
105 <a href="javascript:void(0);" class="btn-link" id='paramsRetry'>Retry </a> /
106 <a href="javascript:void(0);" class="btn-link" id='paramsCancel'>Cancel</a>
108 <div style="height: 10px"></div>
109 <div class="panel panel-default">
110 <form id="topicPublish" class="form-horizontal">
113 <div class="form-group">
114 <label for="userID" class="col-sm-4 control-label"> Topic
117 <div class="col-sm-8">
118 <select class="form-control" id="topicPublishes"
119 name="topicPublishes">
125 <div class="panel-heading">
126 <ul id="nav_Tabs" class="nav nav-tabs">
127 <li class><a id="add_one_more" href="#desc_tab"><span
128 class="glyphicon glyphicon-plus" aria-hidden="true"></span></a></li>
131 <div class="panel-body">
132 <div class="tab-content">
133 <div id="properties_tab" class="tab-pane fade in active"></div>
139 <span id="formSpan" style="display: none">
140 <form class="saveProps" class="form-horizontal clearfix">
142 <div class="form-group clearfix">
143 <label for="aaiMatchingFields" class="col-sm-4 control-label">AAI
144 Fields Matching </label>
145 <div class="col-sm-8">
146 <select type="text" class="form-control "
147 name="aaiMatchingFields" id="aaiMatchingFields" multiple="" size=2></select>
151 <div class="form-group clearfix">
152 <label for="aaiSendFields" class="col-sm-4 control-label">
153 AAI Fields Send (Select Multiple)</label>
155 <div class="col-sm-8 ">
156 <select class="form-control"
157 id="aaiSendFields" name="aaiSendFields" multiple size=2>
163 <div class="form-group clearfix">
164 <label for="groupNumber" class="col-sm-4 control-label">
165 Resource-Group</label>
167 <div class="col-sm-8">
168 <input type="number" class="form-control" id="groupNumber" name="groupNumber" min="0" >
174 <div class="form-group clearfix">
175 <label for="vfc" class="col-sm-4 control-label">
178 <div class="col-sm-8">
179 <select class="form-control" id="vfc" name="vfc">
185 <div class="form-group clearfix">
186 <label for="alarmCondition" class="col-sm-4 control-label">
187 Alarm Condition</label>
189 <div class="col-sm-8">
190 <select class="form-control" id="alarmCondition"
191 name="alarmCondition"></select>
194 <div class="form-group clearfix">
195 <label for="eventSeverity" class="col-sm-4 control-label">
196 Event Severity</label>
197 <div class="col-sm-8">
198 <select class="form-control" id="eventSeverity"
199 name="eventSeverity" enableFilter="false"></select>
202 <div class="form-group clearfix">
203 <label for="eventSourceType" class="col-sm-4 control-label">
204 Event Source Type</label>
205 <div class="col-sm-8">
206 <input type="text" class="form-control" id="eventSourceType"
207 name="eventSourceType" readOnly ></input>
211 <div class="form-group clearfix">
212 <label for="timeWindow" class="col-sm-4 control-label">
215 <div class="col-sm-8">
216 <input type="number" min="0" class="form-control" id="timeWindow"
222 <div class="form-group clearfix">
223 <label for="ageLimit" class="col-sm-4 control-label"> Age
226 <div class="col-sm-8">
227 <input type="number" min="0" class="form-control" id="ageLimit"
231 <div class="form-group clearfix">
232 <label for="createClosedLoopEventId"
233 class="col-sm-4 control-label"> Create CL Event ID</label>
234 <div class="col-sm-8">
235 <select class="form-control" id="createClosedLoopEventId"
236 name="createClosedLoopEventId" enableFilter="false">
242 <div class="form-group clearfix">
243 <label for="outputEventName" class="col-sm-4 control-label">
244 Output Event Name</label>
246 <div class="col-sm-8">
247 <select class="form-control" id="outputEventName"
248 name="outputEventName" enableFilter="false"></select>
257 <div attribute-test="stringmatchpropertiesf" class="modal-footer">
258 <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
259 <button id="savePropsBtn" class="btn btn-primary">Close</button>
260 <button ng-click="close(true)" id="close_button"
261 class="btn btn-primary">Cancel</button>
265 //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
266 // css attribute display:none
267 $("#paramsRetry").on('click', function () {
268 $("#paramsWarn").hide();
269 $("#ridinSpinners").css("display","")
270 var bool=loadSharedPropertyByService();
271 $("#ridinSpinners").css("display","none")
273 $("#paramsCancel").on('click', function () {
274 loadSharedPropertyByServiceProperties();
275 $("#paramsWarn").hide();
281 $("#add_one_more").click(function(event) {
283 event.preventDefault();
285 //I have uncomment the below code becoz there is no refreshItems method.
291 loadPropertyWindow("string_match")
293 var arr = elementMap[lastElementSelected];
295 var alarm_conditions_temp=""
296 var event_severity_temp=""
297 var event_type_source_temp=""
298 if (arr !== undefined && arr[1]!==undefined) {
299 var el = arr[1]['serviceConfigurations']
300 for (var i = 0; i < el.length; i++) {
301 var num = add_one_more();
302 for (var j = 0; j < el[i].length; j++) {
303 if (el[i][j]["stringSet"] !== undefined) {
304 var ss = el[i][j]["stringSet"]
305 for (var o = 0; o < ss.length; o++) {
306 if(ss[o].hasOwnProperty("name")){
307 if(ss[o].name==="alarmCondition"){
308 alarm_conditions_temp=ss[o].value
309 }else if(ss[o].name==="eventSeverity"){
310 event_severity_temp=ss[o].value;
311 }else if(ss[o].name==="eventSourceType"){
312 event_type_source_temp=ss[o].value;
315 $("#formId" + num + " #" + ss[o].name).val(ss[o].value);
319 }else if(el[i][j].hasOwnProperty("name") && el[i][j].name==="vfc"){
320 //alert(el[i][j].value)
321 vfc_temp=el[i][j].value
324 if(el[i][j].hasOwnProperty("name")){
325 $("#formId" + num + " #" + el[i][j].name).val(
331 set_vfc_alarm_event(num)
333 alarm_conditions_temp=""
334 event_severity_temp=""
335 event_type_source_temp=""
338 if(arr[0] && arr[0][0] && arr[0][0].name){
339 $("#" + arr[0][0].name).val(arr[0][0].value);
344 //this will populate alarmcondition,vfc,eventtypesource if they are saved in elementmap
345 function set_vfc_alarm_event (count){
347 //alert(alarm_conditions_temp)
348 //alert(alarm_conditions_temp!=="" && alarm_conditions_temp!==undefined)
349 if(vfc_temp!=="" && vfc_temp!==undefined){
350 $("#formId"+count+" #vfc").val(vfc_temp)
352 if(alarm_conditions_temp!=="" && alarm_conditions_temp!==undefined){
353 setAlarmConditions(vfc_temp,count)
354 $("#formId"+count+" #alarmCondition").val(alarm_conditions_temp)
356 if(event_severity_temp!=="" && event_severity_temp!==undefined){
357 setEventSourceType(alarm_conditions_temp,count)
358 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
359 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
360 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
363 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
364 setEventSourceType(alarm_conditions_temp,count)
365 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
366 if(event_severity_temp!=="" && event_severity_temp!==undefined){
367 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
377 function noRepeats(form) {
379 for (var i = 0; i < form.length; i++) {
380 if(form[i].hasOwnProperty("name")){
381 if (select[form[i].name] === undefined)
382 select[form[i].name] = []
383 select[form[i].name].push(form[i].value);
395 function setStringSet(form) {
397 var alarmCondition = {}
398 var eventSeverity = {}
399 var eventSourceType = {}
400 for (var i = 0; i < form.length; i++) {
401 if (form[i].name === "alarmCondition") {
402 alarmCondition = form[i]
403 } else if (form[i].name === "eventSeverity") {
404 eventSeverity = form[i];
405 } else if (form[i].name === "eventSourceType") {
406 eventSourceType = form[i];
414 stringSet['stringSet'] = []
415 stringSet['stringSet'].push(alarmCondition);
416 stringSet['stringSet'].push(eventSeverity);
417 stringSet['stringSet'].push(eventSourceType);
422 $("#savePropsBtn").click(function(event) {
425 var properties = $(".saveProps").not("#formSpan .saveProps")
426 var topicP = $("#topicPublish").serializeArray()
429 d["serviceConfigurations"] = [];
431 for (var i = 0; i < properties.length; i++) {
432 var ser = $(properties[i]).serializeArray();
433 var s = noRepeats(ser)
434 var newSer = setStringSet(s)
436 d["serviceConfigurations"].push(newSer)
441 $("#close_button").click();
449 function add_one_more() {
450 $("#nav_Tabs li").removeClass("active");
451 var form = $($("#formSpan").children()[0]).clone()
453 //alert($(".formId").length>0)
454 if ($(".formId").length > 0) {
456 var s = $(".formId");
458 for (var i = 0; i < s.length; i++) {
459 if (parseInt($(s[i]).attr("id").substring(6)) > greatest) {
460 greatest = parseInt($(s[i]).attr("id").substring(6))
463 count = greatest + 1;
465 $("#properties_tab").append(
466 ('<span class="formId" id="formId'+count+'"></span>'));
470 $("#properties_tab").append(
471 '<span class="formId" id="formId1"></span>');
476 ' <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>');
477 $("#formId" + count).append(form);
478 $(".formId").not($("#formId" + count)).css("display", "none")
480 addEventNameList(count)
481 add_vfc_alarm_event_listener(count);
485 function addCustListen(count) {
486 $('#go_properties_tab' + count).click(function(event) {
487 $("#nav_Tabs li").removeClass("active");
488 $(this).parent().addClass("active");
489 $("#formId" + count).css("display", "")
490 $(".formId").not($("#formId" + count)).css("display", "none")
493 $('#tab_close' + count).click(function(event) {
494 if(document.getElementById("topicPublishes").disabled){
497 $(this).parent().remove();
498 $("#formId" + count).remove();
502 function changeTab(count){
503 var output = $('#formId' + count + " #outputEventName");
504 var group = $('#formId' + count + " #groupNumber");
507 if(output.val()!=="")
508 outputValue=output.val();
509 if(output.val()!=="" && group.val()!=="")
510 groupValue=group.val()+":";
511 else if(group.val()!=="")
512 groupValue=group.val();
514 var tabText="Condition"
515 if(groupValue+outputValue!=="")
516 tabText=groupValue+outputValue;
517 $("#go_properties_tab" + count).text(tabText);
520 function addEventNameList(count) {
522 $('#formId' + count + " #outputEventName").on('change',function(){changeTab(count)})
523 $('#formId' + count + " #groupNumber").on('change',function(){changeTab(count)});
528 function setAlarmConditions(vfcID, count){
529 var alarmCondition={}
531 if($("#formId"+count+" #vfc").val()!==""){
532 if(vf_Services['shared'] && vf_Services['shared']['byVfc'] && vf_Services['shared']['byVfc'][vfcID]){
533 alarmCondition=vf_Services['shared']['byVfc'][vfcID]['alarmCondition']
538 $("#formId"+count+" #alarmCondition").empty();
539 $("#formId"+count+" #alarmCondition").append("<option value=\"\"></opton>")
540 if(alarmCondition && _.keys(alarmCondition).length>0){
541 for(key in alarmCondition){
542 var safestring = $('<div>').text(key).html();
543 $("#formId"+count+" #alarmCondition").append("<option value='"+safestring+"'>"+alarmCondition[key]+"</opton>")
548 function setEventSourceType(alarm, count){
549 var eventSourceTypSeverity={}
550 if($("#formId"+count+" #alarmCondition").val()!==""){
551 if(vf_Services && vf_Services['shared'] && vf_Services['shared']['byAlarmCondition'] && vf_Services['shared']['byAlarmCondition'][alarm]){
552 eventSourceTypSeverity=vf_Services['shared']['byAlarmCondition'][alarm]
557 $("#formId"+count+" #eventSourceType").val(eventSourceTypSeverity.eventSourceType);
558 $("#formId"+count+" #eventSeverity").val(eventSourceTypSeverity.eventSeverity);
561 function add_vfc_alarm_event_listener(count) {
563 $("#formId"+count+" #vfc").on('focus', function () {
564 // Store the current value on focus and on change
565 previous = this.value;
566 }).change(function(){
568 setAlarmConditions($("#formId"+count+" #vfc").val(), count);
569 $("#formId"+count+" #eventSourceType").val("");
570 $("#formId"+count+" #eventSeverity").val("")
574 $("#formId"+count+" #alarmCondition").on('focus', function () {
575 // Store the current value on focus and on change
576 previous = this.value;
577 }).change(function(){
580 setEventSourceType($("#formId"+count+" #alarmCondition").val().toString(),count);