]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/commitdiff
index.cgi: Remove the warnings box and show a list of warnings instead
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Aug 2024 15:28:13 +0000 (17:28 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Aug 2024 15:28:13 +0000 (17:28 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/index.cgi
html/html/themes/ipfire/include/css/style.css

index 35632ea46d279492843dfd63c24440d196c5c35a..4030de9d3f466d5075cab263d9a93f29bd41de05 100644 (file)
@@ -528,26 +528,11 @@ END
 &Header::closebox();
 }
 
+my @warnings = ();
+
 # Fireinfo
 if ( ! -e "/var/ipfire/main/send_profile") {
-       $warnmessage .= "<li><a style='color: white;' href='fireinfo.cgi'>$Lang::tr{'fireinfo please enable'}</a></li>";
-}
-
-# EOL architecture
-my ($sysname, $nodename, $release, $version, $machine) = &POSIX::uname();
-if ($machine =~ m/^arm/) {
-       $warnmessage .= "<li><a href='https://wiki.ipfire.org/hardware/requirements' style='color:white;'>$Lang::tr{'eol architecture warning'}</a></li>";
-}
-
-# 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 .= "<li>$Lang::tr{'high memory usage'}: $pct% !</li>";
+       push(@warnings, "<a href='fireinfo.cgi'>$Lang::tr{'fireinfo please enable'}</a>");
 }
 
 # 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 .= "<li>$Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$1M</b> !</li>";
+                       push(@warnings, "$Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$1M</b>");
                }
 
        } else {
@@ -572,7 +557,7 @@ foreach my $line (@df) {
                if ($1>90) {
                        @temp = split(/ /,$line);
                        $temp2=int(100-$1);
-                       $warnmessage .= "<li>$Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$temp2%</b> !</li>";
+                       push(@warnings, "$Lang::tr{'filesystem full'}: $temp[0] <b>$Lang::tr{'free'}=$temp2%</b>");
                }
        }
 }
@@ -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 .= "<li>$Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'} !</li>";
+               push(@warnings, "$Lang::tr{'smartwarn1'} /dev/$disk $Lang::tr{'smartwarn2'}");
        }
 }
 
-if ($warnmessage) {
-       &Header::openbox('100%','center', );
-       print "<table class='tbl'>";
-       print "<tr><th>$Lang::tr{'fwhost hint'}</th></tr>";
-       print "<tr><td style='color:white; background-color:$Header::colourred;'>$warnmessage</td></tr>";
-    print "</table>";
-       &Header::closebox();
+# Show any warnings
+if (@warnings) {
+       &Header::opensection();
+
+       print "<ul class=\"notes\">\n";
+
+       foreach my $warning (@warnings) {
+               print "<li class=\"is-warning\">$warning</li>\n";
+       }
+
+       print "</ul>\n";
+
+       &Header::closesection();
 }
 
 my %coredb = &Pakfire::coredbinfo();
index 9c45e9c5623733eac383272c2f97327ceefcf8b8..cbc449bac62bb1673c34e50eb3bd7a9772bf3a18 100644 (file)
@@ -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;
 }