From 7123ae1ac665a8cde5428631093399d7a4a20002 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 17 Jun 2022 14:51:27 +0200 Subject: [statistics] Hide clients with isclient==false from low RAM list --- modules-available/statistics/pages/hints.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules-available/statistics/pages') diff --git a/modules-available/statistics/pages/hints.inc.php b/modules-available/statistics/pages/hints.inc.php index 5092157c..935315d6 100644 --- a/modules-available/statistics/pages/hints.inc.php +++ b/modules-available/statistics/pages/hints.inc.php @@ -20,6 +20,19 @@ class SubPage self::showMemorySlow($locs); } + private static function isNonClientRunmode(string $machineUuid) + { + static $cache = null; + if ($cache === null) { + if (!Module::isAvailable('runmode')) { + $cache = []; + } else { + $cache = RunMode::getAllClients(false, false); + } + } + return isset($cache[$machineUuid]); + } + /** * Machines that have less than 8GB of RAM. Highlight those * that still have free memory slots. @@ -38,6 +51,8 @@ class SubPage $q->addLocalColumn('Memory Installed Capacity')->addCondition('<', 8 * 1024 * 1024 * 1024); $list = []; foreach ($q->query() as $row) { + if (self::isNonClientRunmode($row['machineuuid'])) + continue; if (HardwareParser::convertSize($row['Memory Installed Capacity'], 'M', false) >= HardwareParser::convertSize($row['Memory Maximum Capacity'], 'M', false)) { $row['size_class'] = 'danger'; -- cgit v1.2.3-55-g7522