Skip to content

[feature:gsoc26] Link Command execution history to MassCommand history and execution tracking #1348

@dee077

Description

@dee077

Is your feature request related to a problem? Please describe.

Currently, each command execution is stored independently in the Command model, but there is no relationship between individual command executions and the mass operation that triggered them.
With the introduction of mass command execution, multiple Command objects will be created as part of a single MassCommand operation. Without an explicit relationship between these models, it would not be possible to identify from the device command history whether a command was executed individually or as part of a mass operation.

Describe the solution I would implement

I would like to add a relationship between Command and MassCommand by introducing a nullable foreign key in AbstractCommand.

mass_command = models.ForeignKey(
    get_model_name("connection", "MassCommand"),
    null=True,
    blank=True,
    on_delete=models.SET_NULL,
)
  1. Add a nullable mass_command foreign key field to AbstractCommand so that commands created as part of a batch operation can reference their parent MassCommand.
  2. Commands executed individually through the existing single-device workflow will continue to have this field set to NULL.
  3. On the device detail page, the command history should indicate whether a command was executed as part of a mass operation.
  4. If a command belongs to a MassCommand, the UI should provide a link to the corresponding mass command execution result page, allowing administrators to navigate directly to the parent batch operation.

Metadata

Metadata

Assignees

Labels

enhancementgsocPart of a Google Summer of Code project

Projects

Status

ToDo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions