put back operator filtering in parseRows. Do it for all attrs. Fix Zone name in AlarmedZoneId attr

This commit is contained in:
Isaac Connor 2020-01-24 11:10:02 -05:00
parent df5bf788d9
commit 52dfbc92e9
1 changed files with 15 additions and 17 deletions

View File

@ -209,7 +209,7 @@ function parseRows(rows) {
for ( zone_id in zones ) {
var zone = zones[zone_id];
if ( monitor_id == zone.MonitorId ) {
zoneSelect.append('<option value="' + zone_id + '">' + (monitors[zone.MonitorId] ? monitors[zone.MonitorId].Name + ': ' : '') + zone.Name + '</option>');
zoneSelect.append('<option value="' + zone_id + '">' + zone.Name + '</option>');
}
} // end foreach zone
} // end foreach monitor
@ -251,25 +251,23 @@ function parseRows(rows) {
var monitorVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(monitorSelect).children().val(monitorVal);
} else { // Reset to regular text field and operator for everything that isn't special
if ( 0 ) {
// We don't actually do anything different in terms of operators. So why do it for text?
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
var opVal = inputTds.eq(3).children().val();
if ( ! opVal ) {
// Default to equals so that something gets selected
console.log("No value for operator. Defaulting to =");
opVal = '=';
}
for ( var key in opTypes ) {
opSelect.append('<option value="' + key + '"'+(key == opVal ? ' selected="selected"' : '')+'>' + opTypes[key] + '</option>');
}
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
}
var textInput = $j('<input></input>').attr('type', 'text').attr('name', queryPrefix + rowNum + '][val]').attr('id', queryPrefix + rowNum + '][val]');
var textVal = inputTds.eq(4).children().val();
inputTds.eq(4).html(textInput).children().val(textVal);
}
// Validate the operator
var opSelect = $j('<select></select>').attr('name', queryPrefix + rowNum + '][op]').attr('id', queryPrefix + rowNum + '][op]');
var opVal = inputTds.eq(3).children().val();
if ( ! opVal ) {
// Default to equals so that something gets selected
console.log("No value for operator. Defaulting to =");
opVal = '=';
}
for ( var key in opTypes ) {
opSelect.append('<option value="' + key + '"'+(key == opVal ? ' selected="selected"' : '')+'>' + opTypes[key] + '</option>');
}
inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"});
if ( attr.endsWith('DateTime') ) { //Start/End DateTime
inputTds.eq(4).children().datetimepicker({timeFormat: "HH:mm:ss", dateFormat: "yy-mm-dd", maxDate: 0, constrainInput: false});
} else if ( attr.endsWith('Date') ) { //Start/End Date
@ -303,7 +301,7 @@ function addTerm( element ) {
var newRow = row.clone().insertAfter(row);
row.find('select').chosen({width: '101%'});
newRow.find('select').each( function() { //reset new row to default
this[0].selected = 'selected';
this[0].selected = 'selected';
}).chosen({width: '101%'});
newRow.find('input[type="text"]').val('');
newRow[0].querySelectorAll("button[data-on-click-this]").forEach(function attachOnClick(el) {