summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/pages
diff options
context:
space:
mode:
authorSimon Rettberg2023-05-12 14:21:28 +0200
committerSimon Rettberg2023-05-12 14:21:28 +0200
commitdf5fd48da3a0163375e4567485b882f14baf6ead (patch)
tree35e423b91fd8a6524e06416d5092d1f716b6a364 /modules-available/locations/pages
parent[eventlog] Remove stray line (c&p error) (diff)
downloadslx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.tar.gz
slx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.tar.xz
slx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.zip
[locations] cleanup: Hide/disable move button if action not available
Hide the button entirely if there are no movable machines in the displayed list. Disable the button as long as the user selected at least one unmovable machine.
Diffstat (limited to 'modules-available/locations/pages')
-rw-r--r--modules-available/locations/pages/cleanup.inc.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules-available/locations/pages/cleanup.inc.php b/modules-available/locations/pages/cleanup.inc.php
index d10dbac0..a7562c50 100644
--- a/modules-available/locations/pages/cleanup.inc.php
+++ b/modules-available/locations/pages/cleanup.inc.php
@@ -21,6 +21,9 @@ class SubPage
$list = self::loadForLocation();
if ($list === false)
return true;
+ $list['canmove'] = array_reduce($list['clients'], function (bool $carry, array $item): bool {
+ return $carry || ($item['canmove'] ?? false);
+ }, false);
Permission::addGlobalTags($list['perms'], NULL, ['subnets.edit', 'location.view']);
Render::addTemplate('mismatch-cleanup', $list);
return true;