Improve diffs for custom_fields #8872

Open
opened 2025-12-29 20:42:23 +01:00 by adam · 4 comments
Owner

Originally created by @JCWasmx86 on GitHub (Nov 22, 2023).

NetBox version

v3.6.5

Feature type

Change to existing functionality

Proposed functionality

Currently, if you change a custom field, the changelog shows the entire "block" of custom fields as added+removed. This makes comparing changes more difficult as there is a lot of stuff that didn't change.

I would implement it like that:

def make_diffs(old_data, new_data):
    added = {}
    removed = {}
    for k in old_data.keys():
        o_d = old_data[k]
        n_d = new_data[k]
        if o_d != n_d:
            if isinstance(o_d, dict) and isinstance(n_d, dict):
                sub_added, sub_removed = make_diffs(o_d, n_d)
                added[k] = sub_added
                removed[k] = sub_removed
            else:
                removed[k] = o_d
                added[k] = n_d
    return (added, removed)

Related to #12273, #10924, I would implement that.

Use case

  • Reduces the amount of clutter
  • Changes are more visible

Database changes

None

External dependencies

None

Originally created by @JCWasmx86 on GitHub (Nov 22, 2023). ### NetBox version v3.6.5 ### Feature type Change to existing functionality ### Proposed functionality Currently, if you change a custom field, the changelog shows the entire "block" of custom fields as added+removed. This makes comparing changes more difficult as there is a lot of stuff that didn't change. I would implement it like that: ``` def make_diffs(old_data, new_data): added = {} removed = {} for k in old_data.keys(): o_d = old_data[k] n_d = new_data[k] if o_d != n_d: if isinstance(o_d, dict) and isinstance(n_d, dict): sub_added, sub_removed = make_diffs(o_d, n_d) added[k] = sub_added removed[k] = sub_removed else: removed[k] = o_d added[k] = n_d return (added, removed) ``` Related to #12273, #10924, I would implement that. ### Use case - Reduces the amount of clutter - Changes are more visible ### Database changes None ### External dependencies None
adam added the type: featurestatus: blockedcomplexity: mediumnetbox labels 2025-12-29 20:42:23 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 22, 2023):

This was initially proposed in #10924, which was closed out as stale having found no volunteer. @JCWasmx86 are you volunteering to own this implementation? If not, this can be closed out as a duplicate.

@jeremystretch commented on GitHub (Nov 22, 2023): This was initially proposed in #10924, which was closed out as stale having found no volunteer. @JCWasmx86 are you volunteering to own this implementation? If not, this can be closed out as a duplicate.
Author
Owner

@JCWasmx86 commented on GitHub (Nov 23, 2023):

Yes, I would implement that

@JCWasmx86 commented on GitHub (Nov 23, 2023): Yes, I would implement that
Author
Owner

@github-actions[bot] commented on GitHub (Jul 9, 2025):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jul 9, 2025): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/main/CONTRIBUTING.md).
Author
Owner

@jeremystretch commented on GitHub (Aug 21, 2025):

Marking this as blocked by #20122 temporarily

@jeremystretch commented on GitHub (Aug 21, 2025): Marking this as blocked by #20122 temporarily
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8872