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;
60 <script type="text/javascript">
61 function disablefile() {
63 document.getElementById("fileUpload").disabled = true;
67 function disableSVN() {
68 var selectLength = document.querySelectorAll(".disabled-block-container .tab-close-popup");
69 if(selectLength && selectLength.length>0){
70 for(var i = 0; i< selectLength.length ; i++){
71 selectLength[i].disabled = true;
75 document.getElementById("schemaLocation").disabled = true;
76 document.getElementById("userID").disabled = true;
77 document.getElementById("password").disabled = true;
83 <div id="configure-widgets" class="disabled-block-container">
84 <div class="modal-header">
85 <button type="button" class="close" ng-click="close(false)"
86 aria-hidden="true" style="margin-top: -3px">×</button>
87 <h4>TCA Micro Services</h4>
89 <div class="modal-body">
90 <div style="height: 10px"></div>
91 <div class="panel panel-default">
92 <form id="topicPublish" class="form-horizontal">
95 <div class="form-group">
96 <label for="userID" class="col-sm-4 control-label"> Topic Publishes</label>
98 <div class="col-sm-8">
99 <select class="form-control" id="topicPublishes"
100 name="topicPublishes">
106 <div class="panel-heading">
107 <ul id="nav_Tabs" class="nav nav-tabs">
108 <li class><a id="add_one_more" href="#desc_tab"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a></li>
111 <div class="panel-body">
112 <div class="tab-content">
113 <div id="properties_tab" class="tab-pane fade in active"></div>
119 <span id="formSpan" style="display: none">
120 <form class="saveProps" class="form-horizontal">
123 <div class="form-group">
124 <label class="col-sm-4 control-label">Field Path / Counter</label>
125 <div class="col-sm-8">
126 <select class="form-control" id="fieldPath" name="fieldPath"></select>
129 <div class="form-group">
130 <label class="col-sm-4 control-label">Threshold</label>
131 <div class="col-sm-8">
132 <input type="number" min="0" class="form-control"
133 name="threshold" id="threshold">
139 <div class="form-group">
140 <label class="col-sm-4 control-label">Operator</label>
141 <div class="col-sm-8">
142 <select class="form-control" id="operator" name="operator"></select>
148 <div class="form-group">
149 <label class="col-sm-4 control-label">Ops Policy</label>
151 <div class="col-sm-8">
152 <select class="form-control" id="opsPolicy" name="opsPolicy"
153 enableFilter="false" ></select>
162 <div class="modal-footer">
163 <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
164 <button id="savePropsBtn" class="btn btn-primary">Close</button>
165 <button ng-click="close(true)" id="close_button"
166 class="btn btn-primary">Cancel</button>
170 //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
171 // css attribute display:none
172 $("#add_one_more").click(function(event) {
173 event.preventDefault();
177 loadPropertyWindow("tca")
179 var arr = elementMap[lastElementSelected];
181 var alarm_conditions_temp=""
182 var event_severity_temp=""
183 var event_type_source_temp=""
184 if (arr !== undefined) {
186 var el=arr[1]['serviceConfigurations']
187 for (var i = 0; i < el.length; i++) {
188 var num=add_one_more();
189 for(var j=0;j<el[i].length;j++){
190 if(el[i][j].name==="vfc"){
191 vfc_temp=el[i][j].value
192 }else if(el[i][j].name==="alarmCondition"){
193 alarm_conditions_temp=el[i][j].value
194 }else if(el[i][j].name==="eventSeverity"){
195 event_severity_temp=el[i][j].value;
196 }else if(el[i][j].name==="eventSourceType"){
197 event_type_source_temp=el[i][j].value;
200 $("#formId"+num+" #" + el[i][j].name).val(el[i][j].value);
205 set_vfc_alarm_event(num)
207 alarm_conditions_temp=""
208 event_severity_temp=""
209 event_type_source_temp=""
213 $("#"+ arr[0][0].name).val(arr[0][0].value);
218 function set_vfc_alarm_event (count){
219 if(vfc_temp!=="" && vfc_temp!==undefined){
220 $("#formId"+count+" #vfc").val(vfc_temp)
222 if(alarm_conditions_temp!=="" && alarm_conditions_temp!==undefined){
223 setAlarmConditions(vfc_temp,count)
224 $("#formId"+count+" #alarmCondition").val(alarm_conditions_temp)
226 if(event_severity_temp!=="" && event_severity_temp!==undefined){
227 setEventSourceType(alarm_conditions_temp,count)
228 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
229 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
230 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
233 if(event_type_source_temp!=="" && event_type_source_temp!==undefined){
234 setEventSourceType(alarm_conditions_temp,count)
235 $("#formId"+count+" #eventSourceType").val(event_type_source_temp)
236 if(event_severity_temp!=="" && event_severity_temp!==undefined){
237 $("#formId"+count+" #eventSeverity").val(event_severity_temp)
247 function noRepeats(form){
249 for(var i=0;i<form.length;i++){
250 if(select[form[i].name]===undefined)
251 select[form[i].name]=[]
252 select[form[i].name].push(form[i].value);
264 $("#savePropsBtn").click(function(event) {
266 var properties=$(".saveProps").not("#formSpan .saveProps")
267 var topicP=$("#topicPublish").serializeArray()
270 d["serviceConfigurations"]=[];
272 for(var i=0;i<properties.length;i++){
273 var ser=$(properties[i]).serializeArray();
277 d["serviceConfigurations"].push(s)
282 $("#close_button").click();
287 function add_one_more(){
288 $("#nav_Tabs li").removeClass("active");
289 var form=$($("#formSpan").children()[0]).clone()
291 if($(".formId").length>0){
294 for(var i=0;i<s.length; i++){
295 if(parseInt($(s[i]).attr("id").substring(6))>greatest){
296 greatest=parseInt($(s[i]).attr("id").substring(6))
300 $("#properties_tab").append(('<span class="formId" id="formId'+count+'"></span>'));
303 $("#properties_tab").append('<span class="formId" id="formId1"></span>');
305 $("#add_one_more").parent().before(' <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>');
306 $("#formId"+count).append(form);
307 $(".formId").not($("#formId"+count)).css("display","none")
309 add_vfc_alarm_event_listener(count)
313 function addCustListen(count) {
314 $('#go_properties_tab' + count).click(function(event) {
315 $("#nav_Tabs li").removeClass("active");
316 $(this).parent().addClass("active");
317 $("#formId"+count).css("display","")
318 $(".formId").not($("#formId"+count)).css("display","none")
321 $('#tab_close'+count).click(function(event){
322 if(document.getElementById("topicPublishes").disabled){
325 $(this).parent().remove();
326 $("#formId"+count).remove();
330 function setAlarmConditions(vfcID, count){
331 var alarmCondition={}
333 /*if($("#formId"+count+" #vfc").val()!=="")
334 alarmCondition=vf_Services['shared']['byVfc'][vfcID]['alarmCondition']*/
336 if($("#formId"+count+" #vfc").val()!==""){
337 if(vf_Services && vf_Services['shared'] && vf_Services['shared']['byVfc'] && vf_Services['shared']['byVfc'][vfcID]){
338 alarmCondition=vf_Services['shared']['byVfc'][vfcID]['alarmCondition'];
342 $("#formId"+count+" #alarmCondition").empty();
343 $("#formId"+count+" #alarmCondition").append("<option value=\"\"></opton>")
344 if(alarmCondition && _.keys(alarmCondition).length>0){
345 for(key in alarmCondition){
346 var safestring = $('<div>').text(key).html();
347 $("#formId"+count+" #alarmCondition").append("<option value='"+safestring+"'>"+alarmCondition[key]+"</opton>")
354 function setEventSourceType(alarm, count){
355 var eventSourceTypSeverity={}
356 if($("#formId"+count+" #alarmCondition").val()!=="") {
357 if(vf_Services && vf_Services['shared'] && vf_Services['shared']['byAlarmCondition'] && vf_Services['shared']['byAlarmCondition'][alarm]){
359 eventSourceTypSeverity=vf_Services['shared']['byAlarmCondition'][alarm]
363 $("#formId"+count+" #eventSourceType").val(eventSourceTypSeverity.eventSourceType);
364 $("#formId"+count+" #eventSeverity").val(eventSourceTypSeverity.eventSeverity);
368 function add_vfc_alarm_event_listener(count) {
370 $("#formId"+count+" #vfc").on('focus', function () {
371 // Store the current value on focus and on change
372 previous = this.value;
373 }).change(function(){
375 setAlarmConditions($("#formId"+count+" #vfc").val(), count);
376 $("#formId"+count+" #eventSourceType").val("");
377 $("#formId"+count+" #eventSeverity").val("")
381 $("#formId"+count+" #alarmCondition").on('focus', function () {
382 // Store the current value on focus and on change
383 previous = this.value;
384 }).change(function(){
387 setEventSourceType($("#formId"+count+" #alarmCondition").val().toString(),count);