Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve diffs for custom_fields #14329

Open
JCWasmx86 opened this issue Nov 22, 2023 · 2 comments · May be fixed by #14332
Open

Improve diffs for custom_fields #14329

JCWasmx86 opened this issue Nov 22, 2023 · 2 comments · May be fixed by #14332
Assignees
Labels
complexity: medium Requires a substantial but not unusual amount of effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@JCWasmx86
Copy link
Contributor

JCWasmx86 commented 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

@JCWasmx86 JCWasmx86 added the type: feature Introduction of new functionality to the application label Nov 22, 2023
@jeremystretch
Copy link
Member

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.

@JCWasmx86
Copy link
Contributor Author

Yes, I would implement that

@abhi1693 abhi1693 added the status: accepted This issue has been accepted for implementation label Nov 23, 2023
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Nov 23, 2023
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Nov 23, 2023
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Nov 23, 2023
@JCWasmx86 JCWasmx86 linked a pull request Nov 23, 2023 that will close this issue
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Nov 29, 2023
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Mar 14, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Apr 23, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue May 1, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue May 6, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue May 6, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue May 6, 2024
@jeremystretch jeremystretch added the complexity: medium Requires a substantial but not unusual amount of effort to implement label May 22, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue May 31, 2024
imgbot bot pushed a commit to JCWasmx86/netbox that referenced this issue May 31, 2024
JCWasmx86 added a commit to JCWasmx86/netbox that referenced this issue Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: medium Requires a substantial but not unusual amount of effort to implement status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants