Skip to content

Commit

Permalink
Fix to print table if there is data
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Nov 6, 2024
1 parent 168c2ca commit 8ec67f7
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions sysinfo.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -185,24 +176,35 @@ if ($get_user_level ne '3') {

# Pre-load history data
print '<script type="text/javascript">vars.stats.history = ' .
convert_to_json(get_stats_history()) . ';</script>' . "\n" if ($sysinfo);
convert_to_json(get_stats_history()) . ';</script>' . "\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 '<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) 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 '<script type="text/javascript">typeof stats === "object" && stats.sys.preRender();</script>' . "\n" if ($sysinfo);
Expand Down

0 comments on commit 8ec67f7

Please sign in to comment.