summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/pages
diff options
context:
space:
mode:
authorSimon Rettberg2022-11-15 17:21:05 +0100
committerSimon Rettberg2022-11-15 17:21:05 +0100
commit5db4480e30bbdaba680dfde36b2fdc258b17844c (patch)
treea25c38cd6edb9f217c4b27418f3f129357c3a501 /modules-available/statistics/pages
parent[inc/Dictionary] Add locale-aware number formatting method (diff)
downloadslx-admin-5db4480e30bbdaba680dfde36b2fdc258b17844c.tar.gz
slx-admin-5db4480e30bbdaba680dfde36b2fdc258b17844c.tar.xz
slx-admin-5db4480e30bbdaba680dfde36b2fdc258b17844c.zip
[statistics] Add NIC Speed to client list, switch to Dictionary::number()
Diffstat (limited to 'modules-available/statistics/pages')
-rw-r--r--modules-available/statistics/pages/list.inc.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php
index ce686d56..db5f262a 100644
--- a/modules-available/statistics/pages/list.inc.php
+++ b/modules-available/statistics/pages/list.inc.php
@@ -54,6 +54,13 @@ class SubPage
AND mxx.disconnecttime = 0 AND mxx.machineuuid IN (:ids))
GROUP BY mxx.machineuuid",
['type' => HardwareInfo::HDD, 'ids' => $uuids]);
+ $machineNicSpeed = Database::queryKeyValueList("SELECT mxx.machineuuid, Max(mxhp.`numeric`) AS num
+ FROM statistic_hw s
+ INNER JOIN machine_x_hw AS mxx ON (s.hwid = mxx.hwid AND s.hwtype = :type
+ AND mxx.disconnecttime = 0 AND mxx.machineuuid IN (:ids))
+ INNER JOIN machine_x_hw_prop mxhp ON (mxx.machinehwid = mxhp.machinehwid AND mxhp.prop = :prop)
+ GROUP BY mxx.machineuuid",
+ ['type' => HardwareInfo::MAINBOARD, 'prop' => 'nic-speed', 'ids' => $uuids]);
$machineWithConfigOverrides = Database::queryKeyValueList("SELECT machineuuid, Count(machineuuid) AS num
FROM setting_machine WHERE machineuuid IN (:ids) GROUP BY machineuuid", ['ids' => $uuids]);
// TODO: Cannot disable checkbox for those where user has no permission, since we got multiple actions now
@@ -76,9 +83,9 @@ class SubPage
$row['lastseen_int'] = $row['lastseen'];
$row['lastseen'] = Util::prettyTime($row['lastseen']);
//$row['lastboot'] = Util::prettyTime($row['lastboot']);
- $row['gbram'] = round(ceil($row['mbram'] / 512) / 2, 1); // Trial and error until we got "expected" rounding..
- $row['gbtmp'] = round($row['id44mb'] / 1024);
- $row['gbpersist'] = round($row['id45mb'] / 1024);
+ $row['gbram'] = Dictionary::number(ceil($row['mbram'] / 512) / 2, 1); // Trial and error until we got "expected" rounding..
+ $row['gbtmp'] = Dictionary::number($row['id44mb'] / 1024);
+ $row['gbpersist'] = Dictionary::number($row['id45mb'] / 1024);
$octets = explode('.', $row['clientip']);
if (count($octets) === 4) {
$row['subnet'] = "$octets[0].$octets[1].$octets[2]";
@@ -100,6 +107,13 @@ class SubPage
// If we have ID44 space in our main table, we most likely got an HDD, so fake a count of 1
$row['hddcount'] = 1;
}
+ if (!isset($machineNicSpeed[$row['machineuuid']])) {
+ $row['nic-speed'] = 0;
+ $row['nic-speed_s'] = '???';
+ } else {
+ $row['nic-speed'] = $machineNicSpeed[$row['machineuuid']];
+ $row['nic-speed_s'] = Dictionary::number($machineNicSpeed[$row['machineuuid']]);
+ }
if (isset($row['data']) && !$row['data']) {
$row['nohdd'] = true;
}