Skip to content

Add color mapping to ChangeActionChoices #12828

@ingvaldlorentzen

Description

@ingvaldlorentzen

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

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions