Add REST endpoint rest/v2/get/interface/top/hosts.lua (migrate old script)

This commit is contained in:
Alfredo Cardigliano 2023-09-04 10:28:58 +02:00
parent b9fc7670ce
commit 844418f928
2 changed files with 110 additions and 0 deletions

View file

@ -1383,6 +1383,10 @@ end
-- Convert to the format accepted by the vue Chart/Pie component
-- js_formatter: render function (e.g. 'format_bytes')
-- Input format (res):
-- [ { label = 'xxx', count = yyy }, ... ]
-- Output format:
-- { labels = [ 'xxx', ...], series = [ yyy, ... ], colors = [ ... ], ... }
function graph_utils.convert_pie_data(res, new_charts, js_formatter)
if not new_charts then
return res