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

Hide the extensions to the device page when there is no content #78

Open
ozmusic opened this issue Jan 13, 2023 · 0 comments
Open

Hide the extensions to the device page when there is no content #78

ozmusic opened this issue Jan 13, 2023 · 0 comments

Comments

@ozmusic
Copy link

ozmusic commented Jan 13, 2023

Environment

  • Nautobot version: 1.5.7
  • nautobot-bgp-models version: 0.7.0-beta1

Proposed Functionality

Hide the 'BGP Peer Sessions' and 'BGP Routing Instances' boxes on device pages when there are no sessions or routing instances.

Use Case

Servers, PDUs, cable management, and many other devices will not have BGP sessions or instances. Having the empty boxes there clutters the device page, this could be done by checking for the existence of the filtered object before rendering the box, e.g.:

    def right_page(self):
        """Add content to the right side of the Devices detail view."""
        endpoints = PeerEndpoint.objects.filter(
            routing_instance__device=self.context["object"],
        )
        if endpoints:
            return self.render(
                "nautobot_bgp_models/inc/device_peer_endpoints.html",
                extra_context={"endpoints": endpoints},
            )
        else:
            return ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant