Standardize usage of inc/panel_table.html

This commit is contained in:
jeremystretch 2023-01-16 14:12:36 -05:00
parent 459997ec5c
commit 4d329a7c9b
4 changed files with 13 additions and 46 deletions

View File

@ -714,7 +714,6 @@ class IPAddressView(generic.ObjectView):
return {
'parent_prefixes_table': parent_prefixes_table,
'duplicate_ips_table': duplicate_ips_table,
'more_duplicate_ips': duplicate_ips.count() > 10,
'related_ips_table': related_ips_table,
'services': services,
}

View File

@ -1,10 +1,8 @@
{% load render_table from django_tables2 %}
<div class="card {% if panel_class %}bg-{{ panel_class }}{% endif %}">
<div class="card {% if panel_class %}border-{{ panel_class }}{% endif %}">
{% if heading %}
<h5 class="card-header">
{{ heading }}
</h5>
<h5 class="card-header{% if panel_class %} text-{{ panel_class }}{% endif %}">{{ heading }}</h5>
{% endif %}
<div class="card-body table-responsive">
{% if table.rows %}

View File

@ -81,16 +81,7 @@
</div>
{% endif %}
</div>
<div class="card">
<h5 class="card-header">Members</h5>
<div class="card-body table-responsive">
{% if members_table.rows %}
{% render_table members_table 'inc/table.html' %}
{% else %}
<div class="text-muted">None</div>
{% endif %}
</div>
</div>
{% include 'inc/panel_table.html' with table=members_table heading='Members' %}
{% plugin_full_width_page object %}
</div>
</div>

View File

@ -114,30 +114,9 @@
<div class="col col-md-8">
{% include 'inc/panel_table.html' with table=parent_prefixes_table heading='Parent Prefixes' %}
{% if duplicate_ips_table.rows %}
{# Custom version of panel_table.html #}
<div class="card border-danger">
<h5 class="card-header">
<span class="text-danger">Duplicate IP Addresses</span>
{% if more_duplicate_ips %}
<div class="float-end">
<a type="button" class="btn btn-primary btn-sm"
{% if object.vrf %}
href="{% url 'ipam:ipaddress_list' %}?address={{ object.address.ip }}&vrf_id={{ object.vrf.pk }}"
{% else %}
href="{% url 'ipam:ipaddress_list' %}?address={{ object.address.ip }}&vrf_id=null"
{% include 'inc/panel_table.html' with table=duplicate_ips_table heading='Duplicate IPs' panel_class='danger' %}
{% endif %}
>Show all</a>
</div>
{% endif %}
</h5>
<div class="card-body table-responsive">
{% render_table duplicate_ips_table 'inc/table.html' %}
</div>
</div>
{% endif %}
<div class="my-3">
{% include 'inc/panel_table.html' with table=related_ips_table heading='Related IP Addresses' %}
</div>
{% include 'inc/panel_table.html' with table=related_ips_table heading='Related IPs' %}
{% include 'inc/panels/services.html' %}
{% plugin_right_page object %}
</div>