Fix other tabs being filtered

This commit is contained in:
emanuele-f 2016-12-13 10:09:20 +01:00 committed by Simone Mainardi
parent cc1eed312b
commit ecca16e402

View file

@ -854,6 +854,7 @@ end
function getNumAlerts(what, options)
local num = 0
local opts = getUnpagedAlertOptions(options or {})
checkFilterOptions(opts)
local res = performAlertsQuery("SELECT COUNT(*) AS count", what, opts)
if((res ~= nil) and (#res == 1) and (res[1].count ~= nil)) then num = tonumber(res[1].count) end
@ -863,7 +864,8 @@ end
-- #################################
function getAlerts(what, options)
return performAlertsQuery("SELECT rowid, *", what, options)
local opts = checkFilterOptions(options, true)
return performAlertsQuery("SELECT rowid, *", what, opts)
end
-- #################################
@ -942,6 +944,29 @@ end
-- #################################
-- this removes filter options for tabs which are not the active one
function checkFilterOptions(opts, clone)
local res
if clone then
res = {}
for k,v in pairs(opts) do res[k] = v end
else
res = opts
end
if not isEmptyString(_GET["status"]) then
if _GET["status"] ~= what then
res.alert_severity = nil
res.alert_type = nil
end
end
return res
end
-- #################################
function checkDeleteStoredAlerts()
if((_GET["csrf"] ~= nil) and (_GET["status"] ~= nil)) then
local delete_params = UrlToalertsQueryParameters(_GET)