Add color mapping to ChangeActionChoices #8172

Closed
opened 2025-12-29 20:33:24 +01:00 by adam · 0 comments
Owner

Originally created by @ingvaldlorentzen on GitHub (Jun 7, 2023).

Originally assigned to: @abhi1693 on GitHub.

NetBox version

v3.5.3

Feature type

Change to existing functionality

Proposed functionality

The ChangeActionChoices in choices.py class does not have color mapping like ObjectChangeActionChoices.

ChangeActionChoices is used by the StagedChanges feature. It makes some sense that it doesn't have the color mapping, since there is no frontend, or even API for this feature yet, but adding it shouldn't break anything and would make it more consistent with ObjectChangeActionChoices.

The StagedChange model also needs the get_action_color function defined, if this is to work. I'll gladly submit a PR with these changes, I've basically got one ready just waiting to submit until getting approval in this issue, per the contributor guidelines.

Use case

I am currently working on a plugin that will visualize Staged Changes, and adding the color mapping would be handy. Obviously I can override the rendering of a table for this field and do it manually, but I think adding the colors would be nice for my use case and others wanting to utilize and visualize the Staged Changes feature for plugins.

Database changes

None

External dependencies

None

Originally created by @ingvaldlorentzen on GitHub (Jun 7, 2023). Originally assigned to: @abhi1693 on GitHub. ### NetBox version v3.5.3 ### Feature type Change to existing functionality ### Proposed functionality The [`ChangeActionChoices` in `choices.py`](https://github.com/netbox-community/netbox/blob/develop/netbox/extras/choices.py#L206) class does not have color mapping like [`ObjectChangeActionChoices`](https://github.com/netbox-community/netbox/blob/develop/netbox/extras/choices.py#L87). `ChangeActionChoices` is used by the [StagedChanges](https://docs.netbox.dev/en/stable/plugins/development/staged-changes/) feature. It makes some sense that it doesn't have the color mapping, since there is no frontend, or even API for this feature yet, but adding it shouldn't break anything and would make it more consistent with `ObjectChangeActionChoices`. The `StagedChange` model also needs the `get_action_color` function defined, if this is to work. I'll gladly submit a PR with these changes, I've basically got one ready just waiting to submit until getting approval in this issue, per the contributor guidelines. ### Use case I am currently working on a plugin that will visualize Staged Changes, and adding the color mapping would be handy. Obviously I can override the rendering of a table for this field and do it manually, but I think adding the colors would be nice for my use case and others wanting to utilize and visualize the Staged Changes feature for plugins. ### Database changes None ### External dependencies None
adam added the status: acceptedtype: feature labels 2025-12-29 20:33:24 +01:00
adam closed this issue 2025-12-29 20:33:25 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8172