From 38077d69a964f7cc9b2759ea8840de8a1a3f397d Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 6 Aug 2024 17:28:13 +0200 Subject: [PATCH] index.cgi: Remove the warnings box and show a list of warnings instead Signed-off-by: Michael Tremer --- html/cgi-bin/index.cgi | 47 ++++++++----------- html/html/themes/ipfire/include/css/style.css | 6 +++ 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/html/cgi-bin/index.cgi b/html/cgi-bin/index.cgi index 35632ea46..4030de9d3 100644 --- a/html/cgi-bin/index.cgi +++ b/html/cgi-bin/index.cgi @@ -528,26 +528,11 @@ END &Header::closebox(); } +my @warnings = (); + # Fireinfo if ( ! -e "/var/ipfire/main/send_profile") { - $warnmessage .= "
  • $Lang::tr{'fireinfo please enable'}
  • "; -} - -# EOL architecture -my ($sysname, $nodename, $release, $version, $machine) = &POSIX::uname(); -if ($machine =~ m/^arm/) { - $warnmessage .= "
  • $Lang::tr{'eol architecture warning'}
  • "; -} - -# Memory usage warning -my @free = `/usr/bin/free`; -$free[1] =~ m/(\d+)/; -my $mem = $1; -$free[2] =~ m/(\d+)/; -my $used = $1; -my $pct = int 100 * ($mem - $used) / $mem; -if ($used / $mem > 90) { - $warnmessage .= "
  • $Lang::tr{'high memory usage'}: $pct% !
  • "; + push(@warnings, "$Lang::tr{'fireinfo please enable'}"); } # Diskspace usage warning @@ -563,7 +548,7 @@ foreach my $line (@df) { if ($1<5) { # available:plain value in MB, and not %used as 10% is too much to waste on small disk # and root size should not vary during time - $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$1M !
  • "; + push(@warnings, "$Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$1M"); } } else { @@ -572,7 +557,7 @@ foreach my $line (@df) { if ($1>90) { @temp = split(/ /,$line); $temp2=int(100-$1); - $warnmessage .= "
  • $Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$temp2% !
  • "; + push(@warnings, "$Lang::tr{'filesystem full'}: $temp[0] $Lang::tr{'free'}=$temp2%"); } } } @@ -584,17 +569,23 @@ foreach my $file (@files) { my $disk=`echo $file | cut -d"-" -f2`; chomp ($disk); if (`/bin/grep "SAVE ALL DATA" $file`) { - $warnmessage .= "
  • $Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !
  • "; + push(@warnings, "$Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'}"); } } -if ($warnmessage) { - &Header::openbox('100%','center', ); - print ""; - print ""; - print ""; - print "
    $Lang::tr{'fwhost hint'}
    $warnmessage
    "; - &Header::closebox(); +# Show any warnings +if (@warnings) { + &Header::opensection(); + + print "\n"; + + &Header::closesection(); } my %coredb = &Pakfire::coredbinfo(); diff --git a/html/html/themes/ipfire/include/css/style.css b/html/html/themes/ipfire/include/css/style.css index 9c45e9c56..cbc449bac 100644 --- a/html/html/themes/ipfire/include/css/style.css +++ b/html/html/themes/ipfire/include/css/style.css @@ -417,6 +417,12 @@ table { color: var(--color-green-invert); } +/* Notes */ + +.notes .is-warning { + color: var(--color-yellow); +} + table.fw-nat tbody tr td { height: 2.25em; } -- 2.39.5