Skip to content

allow filtering of changelogs by types of changes #13391

@ITJamie

Description

@ITJamie

NetBox version

v3.5.7

Feature type

Data model extension

Proposed functionality

An additional json field on the changelog model which contained a dict of true/false booleans for each model field to give high level info of what changes are in each changelog. This would allow for filtering of changelogs in a sane way (and scale across all the object types)

eg: for "device" model:

{
  "name": true, # eg if name changed
  "rack": false, # eg if assigned rack changed
  "position": true, # eg if position in rack changed
  "custom_fields": # if any of the custom fields changed value
}

when the changelog entry is being created it would loop through the pre/post changed json dicts and create true/false for each field depending on if the fieldcontent changed.
part of the migration could be to backfill in these changes (or add a command to do it, similar to the command which rebuilds the search cache)

Use case

right now there is no way to filter down changelogs on an object to specific types of changes.
by extending the changelog model with a "change_metadata" it could be possible to easily add filtering to the changelog views.

trying to do this by parsing the pre/post change fields is computationally expensive

Database changes

additional jsonb field for the change metadata

External dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending closureRequires immediate attention to avoid being closed for inactivitytype: 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