From 8397eabe505c6a25b4f59729e89c7cb0eb5f2d12 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Tue, 5 Dec 2023 21:32:41 +0000 Subject: [PATCH] custom reports returning array columns will be split over lines --- share/config.yml | 2 +- share/views/ajax/report/generic_report.tt | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/share/config.yml b/share/config.yml index 56634a3f..1edeae57 100644 --- a/share/config.yml +++ b/share/config.yml @@ -265,7 +265,7 @@ system_reports: - { count: 'Instances' } - { seen: 'Where Seen' } query: | - SELECT subnet, count(subnet), array_to_string(array_agg(host(alias)::text || ' on ' || host(ip)::text), ', ') AS seen + SELECT subnet, count(subnet), array_agg(host(alias)::text || ' on ' || host(ip)::text) AS seen FROM device_ip WHERE ip <> alias AND (masklen(subnet) <> 32 AND masklen(subnet) <> 128) diff --git a/share/views/ajax/report/generic_report.tt b/share/views/ajax/report/generic_report.tt index 1e106039..49d2c686 100644 --- a/share/views/ajax/report/generic_report.tt +++ b/share/views/ajax/report/generic_report.tt @@ -10,13 +10,16 @@ [% FOREACH row IN results %] [% FOREACH col IN columns %] - [% IF column_options.$col._searchable %] - - [% row.item(col) | html_entity %] - - [% ELSE %] - [% row.item(col) | html_entity %] + + [% FOREACH record IN row.item(col) %] + [% IF column_options.$col._searchable %] + [% record | html_entity %] + [% ELSE %] + [% record | html_entity %] + [% END %] + [% '
' IF loop.size > 1 %] [% END %] + [% END %] [% END %]