mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
Dedup code for alert rest endpoints
This commit is contained in:
parent
3fd216e8e8
commit
e4ff578117
8 changed files with 41 additions and 50 deletions
|
|
@ -32,21 +32,6 @@ end
|
|||
|
||||
interface.select(ifid)
|
||||
|
||||
local res = {
|
||||
series = {},
|
||||
fill = {
|
||||
colors = {}
|
||||
}
|
||||
}
|
||||
|
||||
local count_data = host_alert_store:count_by_severity_and_time()
|
||||
|
||||
for _, severity in pairsByField(alert_severities, "severity_id", rev) do
|
||||
res.series[#res.series + 1] = {
|
||||
name = i18n(severity.i18n_title),
|
||||
data = count_data[severity.severity_id],
|
||||
}
|
||||
res.fill.colors[#res.fill.colors + 1] = severity.color
|
||||
end
|
||||
local res = host_alert_store:count_by_severity_and_time_request()
|
||||
|
||||
rest_utils.answer(rc, res)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue