mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 16:55:05 +02:00
Minor fix for show better only booleans modules
This commit is contained in:
parent
118b845fa0
commit
b1c87d6a40
@ -456,6 +456,15 @@ class TopNWidget extends Widget
|
|||||||
$data_hbar = [];
|
$data_hbar = [];
|
||||||
$valueMax = 0;
|
$valueMax = 0;
|
||||||
$valueMin = 0;
|
$valueMin = 0;
|
||||||
|
$booleanModulesCount = 0;
|
||||||
|
$booleanModulesTypes = [
|
||||||
|
2,
|
||||||
|
6,
|
||||||
|
9,
|
||||||
|
18,
|
||||||
|
35,
|
||||||
|
];
|
||||||
|
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
|
$module['aliasAgent'] = ui_print_truncate_text($module['aliasAgent'], 20);
|
||||||
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
|
$item_name = $module['aliasAgent'].' - '.$module['nameModule'];
|
||||||
@ -465,10 +474,17 @@ class TopNWidget extends Widget
|
|||||||
// Set of max-min values for graph.
|
// Set of max-min values for graph.
|
||||||
$valueMax = ((int) $module[$display] >= $valueMax) ? $calc : (int) $valueMax;
|
$valueMax = ((int) $module[$display] >= $valueMax) ? $calc : (int) $valueMax;
|
||||||
$valueMin = ((int) $module[$display] < $valueMin) ? $calc : (int) $valueMin;
|
$valueMin = ((int) $module[$display] < $valueMin) ? $calc : (int) $valueMin;
|
||||||
|
// Count if all modules are booleans (for visual representation).
|
||||||
|
if (in_array($module['type_module'], $booleanModulesTypes) === true) {
|
||||||
|
$booleanModulesCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This change is for get more space between values.
|
if ($booleanModulesCount === count($modules)) {
|
||||||
if ((int) $valueMax === (int) $valueMin) {
|
// All modules are booleans. By this, only are allowed 0 or 1.
|
||||||
|
$valueMax = 1;
|
||||||
|
} else if ((int) $valueMax === (int) $valueMin) {
|
||||||
|
// This change is for get more space between values.
|
||||||
$valueMax += 10;
|
$valueMax += 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user