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

Related Objects card rendering, omit empty #17309

Closed
ross-cello opened this issue Aug 29, 2024 · 6 comments · Fixed by #18603
Closed

Related Objects card rendering, omit empty #17309

ross-cello opened this issue Aug 29, 2024 · 6 comments · Fixed by #18603
Assignees
Labels
complexity: low Requires minimal effort to implement netbox status: accepted This issue has been accepted for implementation type: feature Introduction of new functionality to the application

Comments

@ross-cello
Copy link

ross-cello commented Aug 29, 2024

NetBox version

v3.7.8

Feature type

Change to existing functionality

Proposed functionality

Proposing a change in behaviour (toggleable or otherwise) that omits rendering Related Objects where said object relations don't exist.

I have naively achieved this (superficially?) with modification to /netbox/templates/inc/panels/related_objects.html
Bearing in mind that this was an educated guess at best and not necessarily considering efficient implementation, wider compatibility or design intent.

Note this code is from v3.7.8. However the behaviour looks to be unchanged on 4.0 and 4.1beta when looking at the demo instances and code.
Have also chased some of discussions/issues/pulls related to these changes in behaviour to gain insights.
e.g. #14510

From v3.7.8 netbox/templates/inc/panels/related_objects.html

{% load helpers %}
... <brevity omit>
    {% for qs, filter_param in related_models %}
      {% if qs %} <-------------------- insertion
      {% with viewname=qs.model|viewname:"list" %}
        <a href="{% url viewname %}?{{ filter_param }}={{ object.pk }}" class="list-group-item list-group-item-action d-flex justify-content-between">
          {{ qs.model|meta:"verbose_name_plural"|bettertitle }}
          {% with count=qs.count %}
...<brevity omit>
          {% endwith %}
        </a>
      {% endwith %}
      {% endif %} <-------------------- insertion
    {% endfor %}
...<brevity omit>

EDIT: removed some snippet code I had snuck in from #16825 while testing.

Outcome on viewing an arbitrary Tenant:
netbox_related_objects

If I have a case and am barking up the right tree, then can attempt contribution.

Use case

Reduction of scroll fatigue in page views. We only recently shifted from v3.6.9 -> v3.7.8 and had a lot of feedback internally about the change in behaviour. Our user base aren't necessarily highly technical.

Database changes

Highly unlikely.

External dependencies

Highly unlikely.

@ross-cello ross-cello added status: needs triage This issue is awaiting triage by a maintainer type: feature Introduction of new functionality to the application labels Aug 29, 2024
@arthanson
Copy link
Collaborator

@ross-cello can you please add where this is occurring, perhaps with screenshots to make it clear.

@ross-cello
Copy link
Author

@ross-cello can you please add where this is occurring, perhaps with screenshots to make it clear.

Sorry good point. I had a screenshot but forgot to include it. Have edited it in above.

Basically though, I think everywhere that the Related Objects card is rendered. I have checked through Tenant, Region, Site, VRF, ASN and a few others and observed difference we desire.

@sleepinggenius2
Copy link
Contributor

If this does get implemented, I would also propose some placeholder value for the case where there are no related objects at all, as having a card with just a header and no body would look like something is broken to me. An example would be something like what is done for tags today.

@arthanson arthanson added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation complexity: low Requires minimal effort to implement and removed status: needs triage This issue is awaiting triage by a maintainer labels Sep 3, 2024
@jeremystretch jeremystretch added the netbox label Nov 1, 2024 — with Linear
@alehaa
Copy link
Contributor

alehaa commented Jan 1, 2025

I volunteer for this issue.

@alehaa
Copy link
Contributor

alehaa commented Feb 1, 2025

@jeremystretch @arthanson can you assign this to me please?

@jeremystretch jeremystretch 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 Feb 3, 2025
@jeremystretch
Copy link
Member

@alehaa assigned to you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity: low Requires minimal effort to implement netbox 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.

5 participants