<input class="form-control" onkeydown="return false;" type="text" id="tuuid" name="tuuid"></input>
</div>
</div>
-
- <div class="col-sm-8 form-group" style="display:none;">
- <label class="col-sm-3"> NF Code </label>
- <div class="col-sm-9" style="padding:0px;">
- <input class="form-control" onkeydown="return false;" type="text" id="tnfc" name="tnfc"></input>
- </div>
- </div>
-
</div>
<div class="row">
<div class="col-sm-8 form-group">
<select name="tcaPol" id="tcaPol" enableFilter="true"></select>
</div>
</div>
+ <div class="col-sm-8 form-group">
+ <label class="col-sm-3">EventName</label>
+ <div class="col-sm-9" style="padding:0px;">
+ <select name="eventName" id="eventName" enableFilter="true"></select>
+ </div>
+ </div>
<div class="col-sm-8 form-group" style="display:none;">
<label class="col-sm-3"> Policy ID </label>
onkeypress="return isNumberKey(event)" id="threshold"></input>
</div>
</div>
+ <div>
+ <label class="control-label">Control Loop Schema</label>
+ <div>
+ <select id="controlLoopSchema" name="controlLoopSchema"></select>
+ </div>
+ </div>
+ <div>
+ <label class="control-label">Closed Loop Event Status</label>
+ <div>
+ <select id="closedLoopEventStatus" name="closedLoopEventStatus"></select>
+ </div>
+ </div>
</div>
</div>
</div>
return (c == 'x' ? r : (r*0x3|0*8)).toString(16);
});
$("#formId" + count + " #tuuid").val(tuuid);
- }
-
+ };
+
+
+ var propertiesToString = function(formIdNum) {
+ return $('#formId'+formIdNum+' #fieldPathM').find(':selected').text() + ' ' +
+ $('#formId'+formIdNum+' #operator').val() + ' ' +
+ $('#formId'+formIdNum+' #threshold').val() + ' ' +
+ $('#formId'+formIdNum+' #controlLoopSchema').val() + ' ' +
+ $('#formId'+formIdNum+' #closedLoopEventStatus').val();
+ };
+
loadPropertyWindow("tca");
//load dropdown with policy options
}
}
}
-
+
+ var fieldPathMLabel2Value = function(label) {
+ return Object.keys(defaults_props['tca']['fieldPathM']).find(key => defaults_props['tca']['fieldPathM'][key] == label)
+ }
+ var fieldPathMValue2Label = function(value) {
+ return defaults_props['tca']['fieldPathM'][value];
+ }
+
setASDCFields();
-
- //load metrics dropdown
- if (elementMap["global"]){
- for (var i = 0; i < (elementMap["global"].length); i++){
- if ((elementMap["global"][i]["name"]) == "vf"){
- var vfSel = elementMap["global"][i]["value"];
- if (vf_Services["shared"]["byVf"][vfSel]["kpi"]){
- $.each((vf_Services["shared"]["byVf"][vfSel]["kpi"]), function(val, text) {
- $('#fieldPathM').append(
- $('<option></option>').val(val).html(text)
- );
- });
- }
- break;
- };
- };
- };
-
+
var arr = elementMap[lastElementSelected];
-
+
if (arr !== undefined) {
for (var x in arr){
var num = add_one_more();
if (arr[x][i].hasOwnProperty('serviceConfigurations')){
for (var j=0; j<arr[x][i]["serviceConfigurations"].length; j++){
$("#formId" + num + " #tcaTable").prepend("<tr><td>"
- +arr[x][i]["serviceConfigurations"][j][0]+" "
- +(Object.keys(defaults_props['tca']['operator']).find(key => defaults_props['tca']['operator'][key] == (arr[x][i]["serviceConfigurations"][j][1])))+ " "
- +arr[x][i]["serviceConfigurations"][j][2]+"</td></tr>");
+ +fieldPathMValue2Label(arr[x][i]["serviceConfigurations"][j][0])+ " "
+ +(Object.keys(defaults_props['tca']['operator']).find(key => defaults_props['tca']['operator'][key] == (arr[x][i]["serviceConfigurations"][j][1])))+ " "
+ +arr[x][i]["serviceConfigurations"][j][2]+" "
+ +arr[x][i]["serviceConfigurations"][j][3]+" "
+ +arr[x][i]["serviceConfigurations"][j][4]+"</td></tr>");
}
} else {
$("#formId" + num + " #"+arr[x][i].name).val(arr[x][i].value);
} else {
$('#formId'+num+' .tcaErr').hide();
if ($('#formId'+num+' #tcaTable .highlight').length > 0){
- $('#formId'+num+' #tcaTable .highlight td').text(
- $('#formId'+num+' #fieldPathM').val() + ' ' +
- $('#formId'+num+' #operator').val() + ' ' +
- $('#formId'+num+' #threshold').val());
+ $('#formId'+num+' #tcaTable .highlight td').text(propertiesToString(num));
}
var saveP = {};
$('.formId').each(function(){
var header = $(this).find('.tcaParentItems').serializeArray();
var sconf = {};
var sconfa = [];
- var checkNF = true;
$('#formId' +count+' #tcaTable tr').each(function(){
$('td', this).each(function(){
var splitTd = $(this).text().split(' ');
+ splitTd[0]=fieldPathMLabel2Value(splitTd[0]);
splitTd[1]=defaults_props['tca']['operator'][splitTd[1]];
- var checkByKpi = vf_Services["shared"]["byKpi"][splitTd[0].replace(/\s/g, "")];
- if (checkByKpi["fieldPath"]){
- splitTd.push(Object.keys(vf_Services["shared"]["byKpi"][splitTd[0].replace(/\s/g, "")]["fieldPath"])[0]);
- };
- if ((checkByKpi["nfNamingCode"]) && (checkNF)){
- $.grep(header, function(e,i){
- if (e.name == "tnfc"){
- header[i]["value"] = (Object.keys(checkByKpi["nfNamingCode"])[0]);
- }
- });
- checkNF = false;
- }
sconfa.push(splitTd);
});
var form=$($("#formSpan").children()[0]).clone();
var count=0;
if($(".formId").length>0){
- debugger;
var greatest=0;
var s=$(".formId");
for(var i=0;i<s.length; i++){
} else {
$('#formId'+oldCount+' .tcaErr').hide();
if ($('#formId'+oldCount+' #tcaTable .highlight').length > 0){
- $('#formId'+oldCount+' #tcaTable .highlight td').text(
- $('#formId'+oldCount+' #fieldPathM').val() + ' ' +
- $('#formId'+oldCount+' #operator').val() + ' ' +
- $('#formId'+oldCount+' #threshold').val());
+ $('#formId'+oldCount+' #tcaTable .highlight td').text(propertiesToString(oldCount));
}
$("#formId"+oldCount+" #tcaTable .highlight").removeClass("highlight")
}
} else {
$('#formId'+count+' .tcaErr').hide();
if ($('#formId'+count+' #tcaTable .highlight').length > 0){
- $('#formId'+count+' #tcaTable .highlight td').text(
- $('#formId'+count+' #fieldPathM').val() + ' ' +
- $('#formId'+count+' #operator').val() + ' ' +
- $('#formId'+count+' #threshold').val());
+ $('#formId'+count+' #tcaTable .highlight td').text(propertiesToString(num));
}
//$('#formId'+count+' #tcaTable .highlight').text();
$(this).addClass('highlight').siblings().removeClass('highlight');
var str = $(this).text().split(' ');
$('#formId'+count + ' #properties_tab').visible();
- if (str.length == 3){
- $('#formId'+count+' #fieldPathM').val(str[0]).multiselect('refresh');
+ if (str.length == 5){
+ $('#formId'+count+' #fieldPathM').val(fieldPathMLabel2Value(str[0])).multiselect('refresh');
$('#formId'+count+' #operator').val(str[1]).multiselect('refresh');
$('#formId'+count+' #threshold').val(str[2]);
+ $('#formId'+count+' #controlLoopSchema').val(str[3]).multiselect('refresh');
+ $('#formId'+count+' #closedLoopEventStatus').val(str[4]).multiselect('refresh');
}
if ((!(readOnly||readMOnly)) && ($('#formId'+count + ' #deleteThresh').prop('disabled'))) {
} else {
$('#formId'+count+' .tcaErr').hide();
if ($('#formId'+count+' #tcaTable .highlight').length > 0){
- $('#formId'+count+' #tcaTable .highlight td').text(
- $('#formId'+count+' #fieldPathM').val() + ' ' +
- $('#formId'+count+' #operator').val() + ' ' +
- $('#formId'+count+' #threshold').val());
+ $('#formId'+count+' #tcaTable .highlight td').text(propertiesToString(count));
}
$('#formId'+count+ ' #properties_tab').visible();
if (('#formId'+count+' #tcaTable .highlight').length > 0 ){
$('#formId'+count+' #fieldPathM').prop("selectedIndex", 0).multiselect('refresh');
$('#formId'+count+' #operator').prop("selectedIndex", 0).multiselect('refresh');
$('#formId'+count+' #threshold').val("");
-
+ $('#formId'+count+' #controlLoopSchema').prop("selectedIndex", 0).multiselect('refresh');
+ $('#formId'+count+' #closedLoopEventStatus').prop("selectedIndex", 0).multiselect('refresh');
+
if ($('#formId'+count + ' #deleteThresh').prop('disabled')) {
$('#formId'+count + ' #deleteThresh').prop('disabled', false);
}