From a767ad1e264edc3db0910aede388e47646202eb2 Mon Sep 17 00:00:00 2001 From: Simone Mainardi Date: Fri, 2 Jul 2021 17:50:14 +0200 Subject: [PATCH] Prevents acknowledged alerts from being returned by default --- scripts/lua/modules/alert_store/alert_store.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/lua/modules/alert_store/alert_store.lua b/scripts/lua/modules/alert_store/alert_store.lua index 5fe65bea3e..247c6a5e5d 100644 --- a/scripts/lua/modules/alert_store/alert_store.lua +++ b/scripts/lua/modules/alert_store/alert_store.lua @@ -33,6 +33,7 @@ local CSV_SEPARATOR = "|" function alert_store:init(args) self._group_by = nil self._top_limit = TOP_LIMIT + self._acknowledged = false -- By default, don't include acknowledged alerts -- Note: _where contains conditions for the where clause. -- Example: @@ -207,6 +208,10 @@ function alert_store:build_where_clause() local and_clauses = {} local or_clauses = {} + if not self._acknowledged then + where_clause = string.format("alert_status <> %u", alert_consts.alert_status.acknowledged.alert_status_id) + end + for name, groups in pairs(self._where) do -- Build AND clauses for all fields for _, cond in ipairs(groups.all) do