Skip to content

Commit

Permalink
Fix not to print system information panel in dashboard if disabled in…
Browse files Browse the repository at this point in the history
… Virtualmin config
  • Loading branch information
iliajie committed Aug 26, 2024
1 parent fd4e061 commit 60a183f
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions sysinfo.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<script type="text/javascript">vars.stats.history = ' . convert_to_json(get_stats_history()) . ';</script>' . "\n";

# Print system info table
print '<table class="table table-hover margined-top-25"><tbody>' . "\n";

my @table_data;

Expand Down Expand Up @@ -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 '<script type="text/javascript">vars.stats.history = ' .
convert_to_json(get_stats_history()) . ';</script>' . "\n" if ($sysinfo);

print '</tbody></table>' . "\n";
# Print system info table
if (@table_data) {
print '<table class="table table-hover margined-top-25"><tbody>' . "\n";
while (scalar(@table_data) > 0) {
my $left = shift(@table_data);
my $right = shift(@table_data);
print_table_row_responsive(@$left, @$right);
}
print '</tbody></table>' . "\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 '<script type="text/javascript">typeof stats === "object" && stats.sys.preRender();</script>' . "\n";
print '<script type="text/javascript">typeof stats === "object" && stats.sys.preRender();</script>' . "\n" if ($sysinfo);

} else {

Expand Down

0 comments on commit 60a183f

Please sign in to comment.