From df5fd48da3a0163375e4567485b882f14baf6ead Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 12 May 2023 14:21:28 +0200 Subject: [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. --- modules-available/locations/pages/cleanup.inc.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules-available/locations/pages') 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; -- cgit v1.2.3-55-g7522