diff options
author | Simon Rettberg | 2020-09-21 11:30:14 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-09-21 11:30:14 +0200 |
commit | e12a02856e49ce3f18bc49080dd442bed06e868e (patch) | |
tree | 145a91681a770dbfa7a77bc052e39f108c5da7b1 /modules-available | |
parent | [Module] Add phpdoc (diff) | |
download | slx-admin-e12a02856e49ce3f18bc49080dd442bed06e868e.tar.gz slx-admin-e12a02856e49ce3f18bc49080dd442bed06e868e.tar.xz slx-admin-e12a02856e49ce3f18bc49080dd442bed06e868e.zip |
[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.
Diffstat (limited to 'modules-available')
4 files changed, 27 insertions, 2 deletions
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}} <div class="small uuid">{{machineuuid}}</div> {{#rmmodule}} - <div class="small">{{lang_runMode}}: + <div class="small">{{lang_configuredRunMode}}: <a class="slx-bold" href="?do=runmode&module={{rmmodule}}">{{moduleName}}</a> / {{modeName}} </div> {{/rmmodule}} + {{#wrongRunMode}} + <div class="small text-danger"> + {{lang_clientInDifferentRunmode}}: {{currentrunmode}} + {{^currentrunmode}} + {{lang_bootedWithoutAnyRunmode}} + {{/currentrunmode}} + </div> + {{/wrongRunMode}} {{#currentuser}} <div class="small"> {{lang_user}}: |