From 60a183fb6d21c08e35fc17980191f3ce15df6562 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Mon, 26 Aug 2024 16:58:51 +0300 Subject: [PATCH] Fix not to print system information panel in dashboard if disabled in Virtualmin config --- sysinfo.cgi | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/sysinfo.cgi b/sysinfo.cgi index 2cb2729ce..9cde65b7f 100755 --- a/sysinfo.cgi +++ b/sysinfo.cgi @@ -65,18 +65,15 @@ my ($cpu_percent, ) = get_sysinfo_vars(\@info); if ($get_user_level ne '3') { - print_sysstats_panel_start(\@info); + my $sysinfo = grep { $_->{'id'} eq 'sysinfo' } @info; + + # Print sysinfo panel start + print_sysstats_panel_start(\@info) if ($sysinfo); # Easypie charts - if ($theme_config{'settings_sysinfo_easypie_charts'} ne 'false') { + if ($sysinfo && $theme_config{'settings_sysinfo_easypie_charts'} ne 'false') { print_easypie_charts($cpu_percent, $mem_percent, $virt_percent, $disk_percent); } - - # Pre-load history data - print '' . "\n"; - - # Print system info table - print '' . "\n"; my @table_data; @@ -186,21 +183,29 @@ if ($get_user_level ne '3') { push @table_data, [$theme_text{'body_updates'}, $package_message, 'sysinfo_package_message']; } - while (scalar(@table_data) > 0) { - my $left = shift(@table_data); - my $right = shift(@table_data); - print_table_row_responsive(@$left, @$right); - } + # Pre-load history data + print '' . "\n" if ($sysinfo); - print '
' . "\n"; + # Print system info table + if (@table_data) { + print '' . "\n"; + while (scalar(@table_data) > 0) { + my $left = shift(@table_data); + my $right = shift(@table_data); + print_table_row_responsive(@$left, @$right); + } + print '
' . "\n"; + } # Print System Warning - print get_sysinfo_warning(\@info); + print get_sysinfo_warning(\@info) if ($sysinfo); - print_sysstats_panel_end(); + # Print sysinfo panel end + print_sysstats_panel_end() if ($sysinfo); print get_extended_sysinfo(\@info, '-1'); - print '' . "\n"; + print '' . "\n" if ($sysinfo); } else {