diff options
Diffstat (limited to 'modules-available')
4 files changed, 35 insertions, 5 deletions
diff --git a/modules-available/locations/lang/de/template-tags.json b/modules-available/locations/lang/de/template-tags.json index 45464e48..2a03aa85 100644 --- a/modules-available/locations/lang/de/template-tags.json +++ b/modules-available/locations/lang/de/template-tags.json @@ -32,7 +32,8 @@ "lang_moveMachines": "In durch Subnet zugeordneten Raum verschieben", "lang_moveable": "Verschiebbar", "lang_name": "Name", - "lang_overrideCount": "Angepasst", + "lang_numMachinesWithOverrides": "Anzahl Rechner, bei denen mindestens eine Konfigurationsvariable \u00fcberschrieben wird", + "lang_overridenVarsForLocation": "Anzahl Variablen, die an diesem Ort \u00fcberschrieben werden", "lang_parentLocation": "\u00dcbergeordneter Ort", "lang_referencingLectures": "Veranstaltungen", "lang_resetMachines": "Raumzuweisung zur\u00fccksetzen", diff --git a/modules-available/locations/lang/en/template-tags.json b/modules-available/locations/lang/en/template-tags.json index abcb7606..f9bae27c 100644 --- a/modules-available/locations/lang/en/template-tags.json +++ b/modules-available/locations/lang/en/template-tags.json @@ -32,7 +32,9 @@ "lang_moveMachines": "Move to room designated by IP address", "lang_moveable": "Moveable", "lang_name": "Name", + "lang_numMachinesWithOverrides": "Number of clients where at least one variable is overridden", "lang_overrideCount": "Overridden", + "lang_overridenVarsForLocation": "Number of variables that get overridden for this location", "lang_parentLocation": "Parent location", "lang_referencingLectures": "Assigned Lectures", "lang_resetMachines": "Reset room assignment", diff --git a/modules-available/locations/pages/locations.inc.php b/modules-available/locations/pages/locations.inc.php index b1fd77d4..a8cd2e63 100644 --- a/modules-available/locations/pages/locations.inc.php +++ b/modules-available/locations/pages/locations.inc.php @@ -91,6 +91,7 @@ class SubPage // Statistics: Count machines for each subnet $unassigned = false; $unassignedLoad = 0; + $unassignedOverrides = 0; $allowedLocationIds = User::getAllowedLocations("location.view"); foreach (array_keys($locationList) as $lid) { @@ -118,8 +119,8 @@ class SubPage if (in_array(0, $allowedLocationIds)) { $extra = ' OR locationid IS NULL'; } - $res = Database::simpleQuery("SELECT locationid, Count(*) AS cnt, Sum(If(state = 'OCCUPIED', 1, 0)) AS used - FROM machine WHERE (locationid IN (:allowedLocationIds) $extra) GROUP BY locationid", compact('allowedLocationIds')); + $res = Database::simpleQuery("SELECT m.locationid, Count(*) AS cnt, Sum(If(m.state = 'OCCUPIED', 1, 0)) AS used + FROM machine m WHERE (locationid IN (:allowedLocationIds) $extra) GROUP BY locationid", compact('allowedLocationIds')); while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $locId = (int)$row['locationid']; if (isset($locationList[$locId])) { @@ -130,6 +131,16 @@ class SubPage $unassignedLoad += $row['used']; } } + $res = Database::simpleQuery("SELECT m.locationid, Count(DISTINCT sm.machineuuid) AS cnt FROM setting_machine sm + INNER JOIN machine m USING (machineuuid) GROUP BY m.locationid"); + while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + $locId = (int)$row['locationid']; + if (isset($locationList[$locId])) { + $locationList[$locId]['machineVarsOverrideCount'] = $row['cnt']; + } else { + $unassignedOverrides += $row['cnt']; + } + } unset($loc); foreach ($locationList as &$loc) { if (!in_array($loc['locationid'], $allowedLocationIds)) @@ -150,6 +161,7 @@ class SubPage } } unset($loc); + } // Show currently active sysconfig for each location $defaultConfig = false; @@ -222,6 +234,7 @@ class SubPage 'mismatchMachines' => $mismatchMachines, 'unassignedCount' => $unassigned, 'unassignedLoad' => ($unassigned ? (round(($unassignedLoad / $unassigned) * 100) . ' %') : ''), + 'unassignedOverrides' => $unassignedOverrides, 'defaultConfig' => $defaultConfig, 'addAllowedList' => array_values($addAllowedList), ); diff --git a/modules-available/locations/templates/locations.html b/modules-available/locations/templates/locations.html index a63e3b8c..f30ebcab 100644 --- a/modules-available/locations/templates/locations.html +++ b/modules-available/locations/templates/locations.html @@ -82,8 +82,16 @@ <a class="btn btn-default btn-xs" href="?do=baseconfig&module=locations&locationid={{locationid}}"><span class="glyphicon glyphicon-edit"></span></a> </div> {{#overriddenVars}} - {{lang_overrideCount}}: {{overriddenVars}}   + <span class="badge" title="{{lang_overridenVarsForLocation}}"> + <span class="glyphicon glyphicon-home"></span> {{.}} + </span> {{/overriddenVars}} + {{#machineVarsOverrideCount}} + <span class="badge" title="{{lang_numMachinesWithOverrides}}"> + <span class="glyphicon glyphicon-tasks"></span> {{.}} + </span> + {{/machineVarsOverrideCount}} +    {{/havebaseconfig}} </td> <td class="text-nowrap"> @@ -120,7 +128,13 @@ <td class="text-nowrap" align="right"> {{unassignedLoad}} </td> - <td></td> + <td> + {{#unassignedOverrides}} + <span class="badge" title="{{lang_numMachinesWithOverrides}}"> + <span class="glyphicon glyphicon-tasks"></span> {{.}} + </span> + {{/unassignedOverrides}} + </td> <td>{{defaultConfig}}</td> </tr> {{/unassignedCount}} |