From e12a02856e49ce3f18bc49080dd442bed06e868e Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 21 Sep 2020 11:30:14 +0200 Subject: [statistics] Show if current runmode is different from configured one This isn't accounting for fake runmodes like "remoteaccess" or "exams", which aren't stored in the database, but actually, this might be beneficial, as you want to actually see if the clients are in this mode. --- modules-available/statistics/lang/de/template-tags.json | 3 +++ modules-available/statistics/lang/en/template-tags.json | 3 +++ modules-available/statistics/pages/list.inc.php | 13 ++++++++++++- modules-available/statistics/templates/clientlist.html | 10 +++++++++- 4 files changed, 27 insertions(+), 2 deletions(-) (limited to 'modules-available') diff --git a/modules-available/statistics/lang/de/template-tags.json b/modules-available/statistics/lang/de/template-tags.json index b2d2afa3..d152390f 100644 --- a/modules-available/statistics/lang/de/template-tags.json +++ b/modules-available/statistics/lang/de/template-tags.json @@ -7,8 +7,11 @@ "lang_biosUpdate": "BIOS Update", "lang_biosUpdateLink": "Zur Herstellerseite", "lang_biosVersion": "BIOS-Version", + "lang_bootedWithoutAnyRunmode": "Ohne besonderen Betriebsmodus gestartet", + "lang_clientInDifferentRunmode": "Aktueller Betriebsmodus", "lang_clientList": "Liste ausgew\u00e4hlter Rechner", "lang_configVars": "Konfigurationsvariablen", + "lang_configuredRunMode": "Konfigurierter Betriebsmodus", "lang_cores": "Kerne", "lang_cpuCores": "CPU-Kerne", "lang_cpuModel": "CPU", diff --git a/modules-available/statistics/lang/en/template-tags.json b/modules-available/statistics/lang/en/template-tags.json index 152da3e7..6a9b0623 100644 --- a/modules-available/statistics/lang/en/template-tags.json +++ b/modules-available/statistics/lang/en/template-tags.json @@ -7,8 +7,11 @@ "lang_biosUpdate": "BIOS update", "lang_biosUpdateLink": "Go to vendor's site", "lang_biosVersion": "BIOS version", + "lang_bootedWithoutAnyRunmode": "Booted without any mode", + "lang_clientInDifferentRunmode": "Current mode", "lang_clientList": "List of selected machines", "lang_configVars": "Config Variables", + "lang_configuredRunMode": "Configured mode of operation", "lang_cores": "Cores", "lang_cpuCores": "CPU cores", "lang_cpuModel": "CPU", diff --git a/modules-available/statistics/pages/list.inc.php b/modules-available/statistics/pages/list.inc.php index 2dab152d..9f2df897 100644 --- a/modules-available/statistics/pages/list.inc.php +++ b/modules-available/statistics/pages/list.inc.php @@ -40,7 +40,8 @@ class SubPage } } $res = Database::simpleQuery("SELECT m.machineuuid, m.locationid, m.macaddr, m.clientip, m.lastseen, - m.logintime, m.state, m.currentuser, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, m.hostname, m.notes IS NOT NULL AS hasnotes, + m.logintime, m.state, m.currentuser, m.currentrunmode, m.realcores, m.mbram, m.kvmstate, m.cpumodel, m.id44mb, + m.hostname, m.notes IS NOT NULL AS hasnotes, m.badsectors, Count(s.machineuuid) AS confvars $xtra FROM machine m LEFT JOIN setting_machine s USING (machineuuid) $join WHERE $where GROUP BY m.machineuuid", $args); @@ -101,6 +102,16 @@ class SubPage unset($row['currentuser']); } } + if ($row['state'] === 'IDLE' || $row['state'] === 'OCCUPIED') { + if ((!empty($row['currentrunmode']) || !empty($row['rmmodule'])) + && $row['currentrunmode'] !== $row['rmmodule']) { + $row['wrongRunMode'] = true; + if (!empty($row['currentrunmode'])) { + $wrongModule = Module::get($row['currentrunmode']); + $row['currentrunmode'] = $wrongModule === false ? $row['currentrunmode'] : $wrongModule->getDisplayName(); + } + } + } $row['state_' . $row['state']] = true; if ($row['locationid'] > 0) { $row['location'] = $location[$row['locationid']]; diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index 3d49a770..aeca368d 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -98,10 +98,18 @@ {{/link_details}}
{{machineuuid}}
{{#rmmodule}} -
{{lang_runMode}}: +
{{lang_configuredRunMode}}: {{moduleName}} / {{modeName}}
{{/rmmodule}} + {{#wrongRunMode}} +
+ {{lang_clientInDifferentRunmode}}: {{currentrunmode}} + {{^currentrunmode}} + {{lang_bootedWithoutAnyRunmode}} + {{/currentrunmode}} +
+ {{/wrongRunMode}} {{#currentuser}}
{{lang_user}}: -- cgit v1.2.3-55-g7522