From 8ec67f7011f2c30ec0252a27dc8c56ce421dc331 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Thu, 7 Nov 2024 01:30:35 +0200 Subject: [PATCH] Fix to print table if there is data https://forum.virtualmin.com/t/virtualmin-should-use-a-modified-webmin-to-appear-as-one-product/130121/22?u=ilia --- sysinfo.cgi | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/sysinfo.cgi b/sysinfo.cgi index 9cde65b7f..da746ce51 100755 --- a/sysinfo.cgi +++ b/sysinfo.cgi @@ -66,15 +66,6 @@ my ($cpu_percent, if ($get_user_level ne '3') { my $sysinfo = grep { $_->{'id'} eq 'sysinfo' } @info; - - # Print sysinfo panel start - print_sysstats_panel_start(\@info) if ($sysinfo); - - # Easypie charts - if ($sysinfo && $theme_config{'settings_sysinfo_easypie_charts'} ne 'false') { - print_easypie_charts($cpu_percent, $mem_percent, $virt_percent, $disk_percent); - } - my @table_data; # Hostname @@ -185,10 +176,20 @@ if ($get_user_level ne '3') { # Pre-load history data print '' . "\n" if ($sysinfo); + convert_to_json(get_stats_history()) . ';' . "\n" + if ($sysinfo && webmin_user_is_admin()); # Print system info table if (@table_data) { + # Print sysinfo panel start + print_sysstats_panel_start(\@info) + if ($sysinfo); + + # Easypie charts + if ($sysinfo && $theme_config{'settings_sysinfo_easypie_charts'} ne 'false') { + print_easypie_charts($cpu_percent, $mem_percent, $virt_percent, $disk_percent); + } + print '' . "\n"; while (scalar(@table_data) > 0) { my $left = shift(@table_data); @@ -196,13 +197,14 @@ if ($get_user_level ne '3') { print_table_row_responsive(@$left, @$right); } print '
' . "\n"; - } + + # Print System Warning + print get_sysinfo_warning(\@info) if ($sysinfo); - # Print System Warning - print get_sysinfo_warning(\@info) if ($sysinfo); + # Print sysinfo panel end + print_sysstats_panel_end() if ($sysinfo); + } - # Print sysinfo panel end - print_sysstats_panel_end() if ($sysinfo); print get_extended_sysinfo(\@info, '-1'); print '' . "\n" if ($sysinfo);