Dedup code for alert rest endpoints

This commit is contained in:
Alfredo Cardigliano 2021-05-06 15:04:02 +02:00
parent 3fd216e8e8
commit e4ff578117
8 changed files with 41 additions and 50 deletions

View file

@ -20,10 +20,9 @@ local system_alert_store = require "system_alert_store".new()
--
local rc = rest_utils.consts.success.ok
local res = {}
interface.select(getSystemInterfaceId())
local count_by_severity_and_time = system_alert_store:count_by_severity_and_time()
local res = system_alert_store:count_by_severity_and_time_request()
rest_utils.answer(rc, {series = {{ data = count_by_severity_and_time, name = i18n("alerts_dashboard.alerts") }}})
rest_utils.answer(rc, res)