From 52dfbc92e91d4e6eeb401cd7ae0a5130fb4c5a08 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 24 Jan 2020 11:10:02 -0500 Subject: [PATCH] put back operator filtering in parseRows. Do it for all attrs. Fix Zone name in AlarmedZoneId attr --- web/skins/classic/views/js/filter.js | 32 +++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/web/skins/classic/views/js/filter.js b/web/skins/classic/views/js/filter.js index ce20a576e..dd2c8e8c0 100644 --- a/web/skins/classic/views/js/filter.js +++ b/web/skins/classic/views/js/filter.js @@ -209,7 +209,7 @@ function parseRows(rows) { for ( zone_id in zones ) { var zone = zones[zone_id]; if ( monitor_id == zone.MonitorId ) { - zoneSelect.append(''); + zoneSelect.append(''); } } // 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('').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(''); - } - inputTds.eq(3).html(opSelect).children().val(opVal).chosen({width: "101%"}); -} - var textInput = $j('').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('').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(''); + } + 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) {