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

custom-fields - usage counters / related objects box #12825

Closed
ITJamie opened this issue Jun 7, 2023 · 2 comments · Fixed by #13570
Closed

custom-fields - usage counters / related objects box #12825

ITJamie opened this issue Jun 7, 2023 · 2 comments · Fixed by #13570
Assignees
Labels
status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@ITJamie
Copy link
Contributor

ITJamie commented Jun 7, 2023

NetBox version

v.3.5.3

Feature type

Change to existing functionality

Proposed functionality

when viewing a custom field's config details (https://demo.netbox.dev/extras/custom-fields/1/) it would be nice if it had a "related objects" list, showing how many times that field is used/set per object type.

example of related objects view is on the tenants page https://demo.netbox.dev/tenancy/tenants/1/

Use case

when deprecating a custom field, it would be nice if the ui showed any existing usage of a field has been cleaned up

its also useful to see how popular certain custom fields are

Database changes

unknown

External dependencies

unknown

@ITJamie ITJamie added the type: feature Introduction of new functionality to the application label Jun 7, 2023
@jeremystretch
Copy link
Member

Thank you for your interest in extending NetBox. Unfortunately, the information you have provided does not constitute an actionable feature request. Per our contributing guide, a feature request must include a thorough description of the proposed functionality, including any database changes, new views or API endpoints, and so on. It must also include a detailed use case justifying its implementation. If you would like to elaborate on your proposal, please modify your post above. If sufficient detail is not added, this issue will be closed.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Jun 14, 2023
@ITJamie
Copy link
Contributor Author

ITJamie commented Jun 19, 2023

more implementation details:

call netbox/templates/inc/panels/related_objects.html from netbox/templates/extras/customfield.html to add the related_objects panel.

the viewset for the custom field CustomFieldView would need to be extended with get_extra_content and the search logic added for each model to search for objects where the custom field is used ( content_types on the CustomField model could be used as a source for limiting the number of models searched )

eg:

    def get_extra_context(self, request, instance):
        related_models = (
        <model lookups here>
        )

        return {
            'related_models': related_models,
        }

the main purpose being able to see the usage of the custom field when on the custom field view

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation and removed status: revisions needed This issue requires additional information to be actionable labels Aug 22, 2023
@abhi1693 abhi1693 self-assigned this Aug 25, 2023
@abhi1693 abhi1693 added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Aug 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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