Skip to content

[feature] Django admin view for Mass Command model - #1420

Open
dee077 wants to merge 6 commits into
gsoc26-mass-commandsfrom
feature/1345-mass-command-admin-workflow
Open

[feature] Django admin view for Mass Command model#1420
dee077 wants to merge 6 commits into
gsoc26-mass-commandsfrom
feature/1345-mass-command-admin-workflow

Conversation

@dee077

@dee077 dee077 commented Jul 2, 2026

Copy link
Copy Markdown
Member

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #1345.

Description of Changes

  • Add Django admin workflow for mass command execution with a custom change form
  • Improve admin changelist with better column layout, colored status, and link display
  • Used label (mandatory) and notes (optional) fields in the BatchCommand admin view.
  • Add affected_devices computed field to BatchCommand
  • Polish UI consistency with CSS updates for status indicators

Screenshot

Screencast.from.2026-07-03.00-47-45.webm

Todo:

  • Polish code
  • Test extensively with all edge cases
  • Write tests
  • Write docs

@dee077 dee077 self-assigned this Jul 2, 2026
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1c7cb323-6102-4bc3-ab27-340c2cb687b8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/1345-mass-command-admin-workflow

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dee077 dee077 added enhancement gsoc Part of a Google Summer of Code project labels Jul 2, 2026
@dee077 dee077 moved this to In progress in [GSoC26] Mass Commands Jul 2, 2026
@dee077
dee077 force-pushed the feature/1344-mass-command-execution-pipeline branch 3 times, most recently from 989477b to 7c80797 Compare July 3, 2026 23:58
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from dd0c0c1 to 432952e Compare July 3, 2026 23:59
@dee077
dee077 marked this pull request as ready for review July 6, 2026 21:21
@dee077
dee077 force-pushed the feature/1344-mass-command-execution-pipeline branch 2 times, most recently from c1afb08 to d8c3ea1 Compare July 11, 2026 21:54
@dee077 dee077 changed the title [feature] Django admin view for Batch command model [feature] Django admin view for Mass Command model Jul 14, 2026
@dee077
dee077 force-pushed the feature/1344-mass-command-execution-pipeline branch 5 times, most recently from ac14b28 to 8efe276 Compare July 15, 2026 23:49
@dee077
dee077 force-pushed the feature/1344-mass-command-execution-pipeline branch from 1e4e4ee to 4994e34 Compare July 16, 2026 22:03
@nemesifier

nemesifier commented Jul 22, 2026

Copy link
Copy Markdown
Member

This PR implements real-time monitoring with polling. Is polling the intended final approach? #1344 includes a Mass Command WebSocket endpoint as a requirement, although it leaves the scope open to move or split. This is confusing. Please clarify. Let's implement this asap.

Base automatically changed from feature/1344-mass-command-execution-pipeline to gsoc26-mass-commands July 22, 2026 00:54
@dee077
dee077 force-pushed the gsoc26-mass-commands branch from 2c48a5e to 0249d6a Compare July 23, 2026 09:55
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from b4dbb98 to b597697 Compare July 23, 2026 15:56
@openwisp-companion

Copy link
Copy Markdown

Code Style and QA Failures

Hello @dee077,
(Analysis for commit b597697)

The CI failed due to code style and quality issues detected by isort and flake8.

  • isort failure: Imports are incorrectly sorted or formatted.
  • flake8 failures:
  • F401 'json' imported but unused in openwisp_controller/connection/admin.py.
  • F811 redefinition of unused 'status' from line 6 in openwisp_controller/connection/api/views.py.

To fix these issues, please run the following command in your local environment:

openwisp-qa-format

This command will automatically format your code and sort imports according to the project's standards.

@dee077
dee077 force-pushed the gsoc26-mass-commands branch from 0249d6a to 49ee78c Compare July 24, 2026 13:45
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from b597697 to ec3dd20 Compare July 24, 2026 13:46
Comment thread docs/user/rest-api.rst Outdated
Comment thread docs/user/rest-api.rst Outdated
Comment thread docs/user/rest-api.rst Outdated
Comment thread docs/user/rest-api.rst Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 24, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • openwisp_controller/connection/admin.py
  • openwisp_controller/connection/templates/admin/connection/batch_command/confirm_command.html
Previous Review Summaries (5 snapshots, latest commit 43e2d47)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 43e2d47)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
openwisp_controller/connection/api/serializers.py 25 Raw passwords exposed in WebSocket payloads for batch change_password commands
openwisp_controller/connection/apps.py 89 Batch WebSocket messages sent with unredacted command input
Files Reviewed (2 files)
  • openwisp_controller/connection/api/serializers.py - 1 issue
  • openwisp_controller/connection/apps.py - 1 issue

Fix these issues in Kilo Cloud

Previous review (commit 6443749)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
openwisp_controller/connection/api/serializers.py 25 Raw passwords exposed in WebSocket payloads for batch change_password commands
openwisp_controller/connection/apps.py 89 Batch WebSocket messages sent with unredacted command input
Files Reviewed (2 files)
  • openwisp_controller/connection/api/serializers.py - 1 issue
  • openwisp_controller/connection/apps.py - 1 issue

Fix these issues in Kilo Cloud

Previous review (commit 527751d)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
docs/user/rest-api.rst 468, 564, 939, 958 Hardcoded bearer token committed to repository
Files Reviewed (10 files)
  • docs/user/rest-api.rst - 1 issue (4 occurrences)
  • docs/user/shell-commands.rst
  • openwisp_controller/connection/admin.py
  • openwisp_controller/connection/api/serializers.py
  • openwisp_controller/connection/base/models.py
  • openwisp_controller/connection/filters.py
  • openwisp_controller/connection/static/connection/css/batch-command.css
  • openwisp_controller/connection/templates/admin/connection/batch_command/batch_command_change_form.html
  • openwisp_controller/connection/tests/test_api.py
  • openwisp_controller/connection/tests/test_models.py

Fix these issues in Kilo Cloud

Previous review (commit f3f90e4)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
docs/user/rest-api.rst 468, 564, 939, 958 Hardcoded bearer token committed to repository
Files Reviewed (10 files)
  • docs/user/rest-api.rst - 1 issue (4 occurrences)
  • docs/user/shell-commands.rst
  • openwisp_controller/connection/admin.py
  • openwisp_controller/connection/api/serializers.py
  • openwisp_controller/connection/base/models.py
  • openwisp_controller/connection/filters.py
  • openwisp_controller/connection/static/connection/css/batch-command.css
  • openwisp_controller/connection/templates/admin/connection/batch_command/batch_command_change_form.html
  • openwisp_controller/connection/tests/test_api.py
  • openwisp_controller/connection/tests/test_models.py

Fix these issues in Kilo Cloud

Previous review (commit ec3dd20)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 0
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
docs/user/rest-api.rst 468, 564, 939, 958 Hardcoded bearer token committed to repository
Files Reviewed (10 files)
  • docs/user/rest-api.rst - 1 issue (4 occurrences)
  • docs/user/shell-commands.rst
  • openwisp_controller/connection/admin.py
  • openwisp_controller/connection/api/serializers.py
  • openwisp_controller/connection/base/models.py
  • openwisp_controller/connection/filters.py
  • openwisp_controller/connection/static/connection/css/batch-command.css
  • openwisp_controller/connection/templates/admin/connection/batch_command/batch_command_change_form.html
  • openwisp_controller/connection/tests/test_api.py
  • openwisp_controller/connection/tests/test_models.py

Fix these issues in Kilo Cloud


Reviewed by step-3.7-flash · Input: 76.1K · Output: 5.2K · Cached: 143.1K

@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from ec3dd20 to f3f90e4 Compare July 24, 2026 17:50
@dee077
dee077 force-pushed the gsoc26-mass-commands branch from 49ee78c to 9488123 Compare July 27, 2026 21:13
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from f3f90e4 to 527751d Compare July 27, 2026 21:13
@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3).

@openwisp-companion

Copy link
Copy Markdown

Flake8 and Migrations Failures

Hello @dee077,
(Analysis for commit 527751d)

The CI build failed due to the following issues:

  1. Code Style/QA: Flake8 reported unused local variables label and notes in openwisp_controller/connection/admin.py, and a line too long error (E501) on line 698 of the same file.
  • Fix: Remove the unused variables and manually shorten the line that exceeds 88 characters.
  1. Migrations: The migrations check failed, indicating that models have changed but the changes have not been migrated.
  • Fix: Run ./manage.py makemigrations to generate the necessary migration files and commit them.

Please address these issues and push a new commit.

@dee077
dee077 force-pushed the gsoc26-mass-commands branch from 9488123 to 9cbf467 Compare August 9, 2026 14:55
dee077 added 5 commits August 9, 2026 20:28
…al-time monitoring #1345

- Custom admin change form with filtered/paginated commands table
- Merged skipped device rows into main commands table
- Colored status using CSS variables
- Real-time polling for in-progress batches
- Custom CSS and JS for batch command admin

Fixes #1345
…admin link

- Add  cached_property on AbstractBatchCommand (excludes skipped)
- Use  in changelist list_display for consistent status colors
- Replace ID with label as the clickable link in admin changelist
- Add  CSS to command-inline.css for consistency
- Add label, notes to change form fields; reorder columns (created last, affected_devices before created)
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from 527751d to 6443749 Compare August 9, 2026 16:36
Comment thread openwisp_controller/connection/api/serializers.py
Comment thread openwisp_controller/connection/apps.py
@openwisp-companion

Copy link
Copy Markdown

QA, Migrations, and Test Failures

Hello @dee077,
(Analysis for commit 6443749)

There are three distinct failures in this CI run:

  1. Code Style/QA Failure: Prettier found code style issues in JavaScript files.
  • Fix: Run openwisp-qa-format to automatically fix these issues.
  1. Migrations Failure: Django's makemigrations command was not run for detected model changes.
  • Fix: Run ./manage.py makemigrations to generate the necessary migration files.
  1. Test Failure: The test test_creation_and_update in openwisp_controller.geo.estimated_location.tests.tests failed due to an AssertionError. It expected 16 database queries but found 17.
  • Fix: Investigate the test to identify the extra query and adjust the test or the code to match the expected query count.

@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from 6443749 to 43e2d47 Compare August 9, 2026 17:30
@dee077
dee077 force-pushed the feature/1345-mass-command-admin-workflow branch from 43e2d47 to b963e72 Compare August 9, 2026 17:55
@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (2/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3).

@openwisp-companion

Copy link
Copy Markdown

The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (3/3).

@openwisp-companion

Copy link
Copy Markdown

CI Failures: Formatting, Migrations, and Tests

Hello @dee077,
(Analysis for commit 43e2d47)

  1. Code Style/QA: Prettier check failed.
  • Fix: Run ./run-qa-checks --fix or openwisp-qa-format to automatically format the code.
  1. Migrations: Migrations check failed.
  • Fix: Run ./manage.py makemigrations to generate the missing migration file.
  1. Test Failures: Several tests failed, indicated by [31;1m in the logs.
  • Fix: Please review the test output for specific AssertionError messages and address the underlying logic issues in the failing tests. The logs show failures in various modules, including pki, subnet_division, users_integration, DeviceGroupAdminTransaction, TransactionAdmin, ConfigApiTransaction, TestConfig, TestControllerTransaction, TestDevice, TestPkiApi, TestDeviceAdmin, TestVpnTransaction, TestWireguardTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdminUnsavedChanges, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestEstimatedLocationTransaction, TestMigrationGraphIntegrity, TestDeviceAdminGeoSelenium, TestDeviceAdminReadonly, TestPkiApi, TestSubnetDivisionRule, TestDeviceAdmin, TestDeviceAdminTransaction, TestDeviceAdminGeoSelenium, TestDeviceAdminReadonly, TestPkiApi, TestSubnetDivisionRule, TestDeviceAdminTransaction, TestMigrationGraphIntegrity, TestDevice, TestUsersIntegration, TestDeviceGroupAdminTransaction, TestTransactionAdmin, TestConfigApiTransaction, TestTemplateTransaction, TestVpnTransaction, TestWireguardTransaction, TestZeroTierTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, TestTemplateTransaction, TestVxlanTransaction, TestZeroTierTransaction, TestWHOISSelenium, TestWHOISTransaction, TestBatchCommandsAPITransaction, TestModelsTransaction, TestNotificationTransaction, TestDeviceAdmin, TestDeviceGroupAdmin, TestVpnAdmin, `TestTemplate

@openwisp-companion

Copy link
Copy Markdown

CI Failures Detected

Hello @dee077,
(Analysis for commit b963e72)

  1. Code Style/QA: The Prettier check failed. Run openwisp-qa-format to fix.
  2. Build/Infrastructure/Other: Migrations check failed. Run ./manage.py makemigrations to generate the missing migration file.

Please address these issues and push a new commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement gsoc Part of a Google Summer of Code project

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants