mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Add support for displaying inodes in Disk Usage on the Dashboard too
This commit is contained in:
@@ -14,38 +14,69 @@ sub list_system_info
|
||||
my $open = 0;
|
||||
if (@disk_space) {
|
||||
&load_theme_library();
|
||||
$html = ui_columns_start(
|
||||
$html = &ui_columns_start(
|
||||
[ucwords($text{'index_dir'}), ucwords($text{'index_type'}),
|
||||
ucwords($text{'edit_free'}), ucwords($text{'sysinfo_total'}),
|
||||
ucwords($text{'edit_free'}), ucwords($text{'index_used'}),
|
||||
ucwords($text{'sysinfo_total'}),
|
||||
ucwords($text{'sysinfo_dev'}),
|
||||
]);
|
||||
foreach my $disks (@disk_space) {
|
||||
if (ref($disks)) {
|
||||
foreach my $disk (@$disks) {
|
||||
my $total = $disk->{'total'};
|
||||
my $itotal = $disk->{'itotal'};
|
||||
next if (!$total);
|
||||
my $dev_id = $disk->{'device'};
|
||||
my $dir = $disk->{'dir'};
|
||||
my $type = $disk->{'type'};
|
||||
my $total_nice = nice_size($total);
|
||||
my $total_nice = &nice_size($total);
|
||||
my $free = $disk->{'free'};
|
||||
my $free_nice = nice_size($disk->{'free'});
|
||||
my $ifree = $disk->{'ifree'};
|
||||
my $used = &nice_size($disk->{'total'} - $disk->{'free'});
|
||||
my $free_nice = &nice_size($disk->{'free'});
|
||||
my $free_percent = 100 - int(($total - $free) / $total * 100);
|
||||
my $free_percent_html;
|
||||
|
||||
# Inodes percent
|
||||
my $ifree_percent_html;
|
||||
my $itotal_full;
|
||||
my $iused;
|
||||
my $ifree_percent;
|
||||
$ifree_percent = 100 - int(($itotal - $ifree) / $itotal * 100)
|
||||
if ($itotal);
|
||||
|
||||
# Calc percents
|
||||
if ($free_percent > 49) {
|
||||
$free_percent_html = ui_text_color("$free_percent%", 'success');
|
||||
} elsif ($free_percent > 9) {
|
||||
$free_percent_html = ui_text_color("$free_percent%", 'warn');
|
||||
} else {
|
||||
$free_percent_html = &ui_text_color("$free_percent%", 'success');
|
||||
$ifree_percent_html = &ui_text_color("$ifree_percent%", 'success')
|
||||
if ($itotal);
|
||||
}
|
||||
elsif ($free_percent > 9) {
|
||||
$free_percent_html = &ui_text_color("$free_percent%", 'warn');
|
||||
$ifree_percent_html = &ui_text_color("$ifree_percent%", 'warn')
|
||||
if ($itotal);
|
||||
}
|
||||
else {
|
||||
$open = 1;
|
||||
$free_percent_html = ui_text_color("$free_percent%", 'danger');
|
||||
}
|
||||
$html .= ui_columns_row([$dir, $type, $free_percent_html . " ($free_nice)", $total_nice, $dev_id,]);
|
||||
$free_percent_html = &ui_text_color("$free_percent%", 'danger');
|
||||
$ifree_percent_html = &ui_text_color("$ifree_percent%", 'danger')
|
||||
if ($itotal);
|
||||
}
|
||||
|
||||
# Inodes total
|
||||
if ($itotal) {
|
||||
$ifree_percent_html = "<span><br>".$ifree_percent_html." ($ifree inodes)</span>";
|
||||
$itotal_full = "<span><br>$itotal inodes</span>";
|
||||
$iused = "<span><br>@{[$disk->{'itotal'} - $disk->{'ifree'}]} inodes</span>";
|
||||
}
|
||||
$html .= &ui_columns_row([$dir, $type,
|
||||
$free_percent_html . " ($free_nice)$ifree_percent_html",
|
||||
"$used$iused",
|
||||
"$total_nice$itotal_full", $dev_id,]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$html .= ui_columns_end();
|
||||
$html .= &ui_columns_end();
|
||||
}
|
||||
return (
|
||||
{ 'type' => 'html',
|
||||
|
||||
Reference in New Issue
Block a user