From 5fbefb28a5f69646751d0bb452edf84a6d4f69f7 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sat, 27 May 2023 16:42:48 +0200 Subject: [PATCH] Fixed #1296 formatting numbers on the admin health page Signed-off-by: Janos SUTO --- config.php.in | 2 + webui/system/misc.php | 5 + .../theme/default/templates/health/worker.tpl | 188 +++++++++--------- 3 files changed, 100 insertions(+), 95 deletions(-) diff --git a/config.php.in b/config.php.in index ab8867cd..cae10792 100644 --- a/config.php.in +++ b/config.php.in @@ -274,6 +274,8 @@ $config['SIZE_Y'] = 250; $config['DATE_TEMPLATE'] = 'Y.m.d'; $config['DATE_FORMAT'] = 'YYYY-MM-DD'; $config['JQUERY_DATE_FORMAT'] = 'yy-mm-dd'; +$config['DECIMAL_SEPARATOR'] = "."; // See https://www.php.net/manual/en/function.number-format +$config['THOUSANDS_SEPARATOR'] = ","; // for the format options $config['FROM_LENGTH_TO_SHOW'] = 28; diff --git a/webui/system/misc.php b/webui/system/misc.php index 879d8a19..2e57bd32 100644 --- a/webui/system/misc.php +++ b/webui/system/misc.php @@ -291,6 +291,11 @@ function my_qp_encode($s){ } +function format_number($n) { + return number_format($n, 0, DECIMAL_SEPARATOR, THOUSANDS_SEPARATOR); +} + + function nice_size($size = 0, $space = '') { if($size < 1000) return "1k"; if($size < 1000000) return round($size/1000) . $space . "k"; diff --git a/webui/view/theme/default/templates/health/worker.tpl b/webui/view/theme/default/templates/health/worker.tpl index cb94c759..b431929d 100644 --- a/webui/view/theme/default/templates/health/worker.tpl +++ b/webui/view/theme/default/templates/health/worker.tpl @@ -1,9 +1,9 @@
-
: sec
+
: sec
-
- -
+
+ +

Up For:

@@ -15,22 +15,22 @@ - - - - - - - - - + + + + - + + + + + + - + @@ -38,18 +38,18 @@ - -
:
:
 %
:
 % / MB
:
 %
::
 % / MB
:
 % / MB
- -

 

- - - - - - - +
:B (B)
:
+ +

 

+ + + + + + + + - - - - - - + - - - + + + + + + + - + @@ -99,62 +98,61 @@ -
:B (B)
: @@ -64,32 +64,31 @@
: - -
, ', BALLOON, true, ABOVE, true)" onmouseout="UnTip()">:
- -
+
: + +
, ', BALLOON, true, ABOVE, true)" onmouseout="UnTip()">:
+ +
. : , : .
-
- -
- - - - +
+
+ +
+ + + + - - - + + + - - - - - $v) { - if(!is_numeric($k)) { ?> - - - - - - -
- ()
- ()
- ()
- () + ()
+ ()
+ ()
+ ()
- + + + + + $v) { if(!is_numeric($k)) { ?> + + + + + + + +

- - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + SPHINX_MAIN_INDEX_THRESHOLD) { ?> class="text-error"> ()
+ +
"" years, months, days
0) { print $text_usage_increasing; } elseif($health['usagetrend'] < 0) { print $text_usage_decreasing; } else { print $text_usage_neutral; } ?>
+ +
"" years, months, days
0) { print $text_usage_increasing; } elseif($health['usagetrend'] < 0) { print $text_usage_decreasing; } else { print $text_usage_neutral; } ?>
Sphinx main (total) index