[feature] Mass command execution from the device changelist selection - #1462
[feature] Mass command execution from the device changelist selection#1462dee077 wants to merge 2 commits into
Conversation
- Execute mass command action on the device changelist - Device selection carried in a hidden form field, not the session - Organization prefilled and disabled when devices are selected - Group and location hidden when devices are selected - Selected device count shown as a message above the targets - Mixed organization selections refused on both entry points Fixes #1347
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Reviewed by balanced · Input: 71.9K · Output: 28.7K · Cached: 711.9K |
Checklist
Reference to Existing Issue
Closes #1347.
Description of Changes
Until now a mass command could only target devices by organization, group or
location. This adds the second entry point of the workflow: the devices are
picked one by one on the device changelist and handed over to the same two step
wizard.
1. Action on the device changelist
New action on the
ModelAdminregistered forDevice:connection.add_batchcommand),so the action follows the permissions of the wizard it opens
message on the changelist, the same way the Change group action does; the
wording matches the model and the REST API:
All devices must belong to the same organization, unless it is a system wide
command.
DeviceAdminitself, so it is available in the admin of theother modules too (eg. openwisp-monitoring)
2. Execute page (step 1)
The action renders the existing execute page, so both entry points share one
view, one form and one template:
the wizard it belongs to, and two tabs cannot overwrite each other
organizationis prefilled and disabled,groupandlocationare notrendered at all: the targets are already known, so the fields would only be
decoration
Targets heading
devices of the organizations they manage, and a device deleted in the meantime
invalidates the form instead of being silently dropped
3. Confirm page (step 2)
The selection is stored in the session together with the rest of the wizard, and
the device table of the confirm page is built from those UUIDs instead of
BatchCommand.dry_run(). Everything else is unchanged: the table is still thechangelist of the currently registered
DeviceAdmin, devices can still beexcluded one by one, and the summary of the targets shows N selected devices.
4. Flow
Screenshots
Mass command executed from the device changelist selection
Admin.action.webm