mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Migrate prefix, VLAN templates to new structure
This commit is contained in:
@@ -401,7 +401,7 @@ class PrefixView(generic.ObjectView):
|
|||||||
|
|
||||||
class PrefixPrefixesView(generic.ObjectView):
|
class PrefixPrefixesView(generic.ObjectView):
|
||||||
queryset = Prefix.objects.all()
|
queryset = Prefix.objects.all()
|
||||||
template_name = 'ipam/prefix_prefixes.html'
|
template_name = 'ipam/prefix/prefixes.html'
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# Child prefixes table
|
# Child prefixes table
|
||||||
@@ -439,7 +439,7 @@ class PrefixPrefixesView(generic.ObjectView):
|
|||||||
|
|
||||||
class PrefixIPAddressesView(generic.ObjectView):
|
class PrefixIPAddressesView(generic.ObjectView):
|
||||||
queryset = Prefix.objects.all()
|
queryset = Prefix.objects.all()
|
||||||
template_name = 'ipam/prefix_ipaddresses.html'
|
template_name = 'ipam/prefix/ip_addresses.html'
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
# Find all IPAddresses belonging to this Prefix
|
# Find all IPAddresses belonging to this Prefix
|
||||||
@@ -751,7 +751,7 @@ class VLANView(generic.ObjectView):
|
|||||||
|
|
||||||
class VLANInterfacesView(generic.ObjectView):
|
class VLANInterfacesView(generic.ObjectView):
|
||||||
queryset = VLAN.objects.all()
|
queryset = VLAN.objects.all()
|
||||||
template_name = 'ipam/vlan_interfaces.html'
|
template_name = 'ipam/vlan/interfaces.html'
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
interfaces = instance.get_interfaces().prefetch_related('device')
|
interfaces = instance.get_interfaces().prefetch_related('device')
|
||||||
@@ -766,7 +766,7 @@ class VLANInterfacesView(generic.ObjectView):
|
|||||||
|
|
||||||
class VLANVMInterfacesView(generic.ObjectView):
|
class VLANVMInterfacesView(generic.ObjectView):
|
||||||
queryset = VLAN.objects.all()
|
queryset = VLAN.objects.all()
|
||||||
template_name = 'ipam/vlan_vminterfaces.html'
|
template_name = 'ipam/vlan/vminterfaces.html'
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
interfaces = instance.get_vminterfaces().prefetch_related('virtual_machine')
|
interfaces = instance.get_vminterfaces().prefetch_related('virtual_machine')
|
||||||
|
@@ -1,52 +1,7 @@
|
|||||||
{% extends 'generic/object.html' %}
|
{% extends 'ipam/prefix/base.html' %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load plugins %}
|
{% load plugins %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
|
||||||
<li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
|
|
||||||
{% if object.vrf %}
|
|
||||||
<li><a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
<li>{{ object }}</li>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block buttons %}
|
|
||||||
{% include 'ipam/inc/toggle_available.html' %}
|
|
||||||
{% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
|
|
||||||
<a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ object.vrf.pk }}&site={{ object.site.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
|
||||||
<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ object.vrf.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
|
||||||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
|
|
||||||
Add an IP Address
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
{{ block.super }}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block tabs %}
|
|
||||||
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
|
||||||
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:prefix' pk=object.pk %}">Prefix</a>
|
|
||||||
</li>
|
|
||||||
<li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:prefix_prefixes' pk=object.pk %}">Child Prefixes <span class="badge">{{ object.get_child_prefixes.count }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% if perms.ipam.view_ipaddress and object.status != 'container' %}
|
|
||||||
<li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:prefix_ipaddresses' pk=object.pk %}">IP Addresses <span class="badge">{{ object.get_child_ips.count }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
{% if perms.extras.view_objectchange %}
|
|
||||||
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:prefix_changelog' pk=object.pk %}">Change Log</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
|
38
netbox/templates/ipam/prefix/base.html
Normal file
38
netbox/templates/ipam/prefix/base.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{% extends 'generic/object.html' %}
|
||||||
|
{% load buttons %}
|
||||||
|
{% load helpers %}
|
||||||
|
{% load custom_links %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<li><a href="{% url 'ipam:prefix_list' %}">Prefixes</a></li>
|
||||||
|
{% if object.vrf %}
|
||||||
|
<li><a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
<li>{{ object }}</li>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block tabs %}
|
||||||
|
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
||||||
|
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:prefix' pk=object.pk %}">Prefix</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation"{% if active_tab == 'prefixes' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:prefix_prefixes' pk=object.pk %}">Child Prefixes <span class="badge">{{ object.get_child_prefixes.count }}</span></a>
|
||||||
|
</li>
|
||||||
|
{% if perms.ipam.view_ipaddress and object.status != 'container' %}
|
||||||
|
<li role="presentation"{% if active_tab == 'ip-addresses' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:prefix_ipaddresses' pk=object.pk %}">IP Addresses <span class="badge">{{ object.get_child_ips.count }}</span></a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if perms.extras.view_journalentry %}
|
||||||
|
<li role="presentation"{% if active_tab == 'journal' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:prefix_journal' pk=object.pk %}">Journal</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if perms.extras.view_objectchange %}
|
||||||
|
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:prefix_changelog' pk=object.pk %}">Change Log</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
9
netbox/templates/ipam/prefix/ip_addresses.html
Normal file
9
netbox/templates/ipam/prefix/ip_addresses.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends 'ipam/prefix/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{% include 'utilities/obj_table.html' with table=ip_table table_template='panel_table.html' heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
25
netbox/templates/ipam/prefix/prefixes.html
Normal file
25
netbox/templates/ipam/prefix/prefixes.html
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{% extends 'ipam/prefix/base.html' %}
|
||||||
|
|
||||||
|
{% block buttons %}
|
||||||
|
{% include 'ipam/inc/toggle_available.html' %}
|
||||||
|
{% if perms.ipam.add_prefix and active_tab == 'prefixes' and first_available_prefix %}
|
||||||
|
<a href="{% url 'ipam:prefix_add' %}?prefix={{ first_available_prefix }}&vrf={{ object.vrf.pk }}&site={{ object.site.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
||||||
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Child Prefix
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if perms.ipam.add_ipaddress and active_tab == 'ip-addresses' and first_available_ip %}
|
||||||
|
<a href="{% url 'ipam:ipaddress_add' %}?address={{ first_available_ip }}&vrf={{ object.vrf.pk }}&tenant_group={{ object.tenant.group.pk }}&tenant={{ object.tenant.pk }}" class="btn btn-success">
|
||||||
|
<span class="mdi mdi-plus-thick" aria-hidden="true"></span>
|
||||||
|
Add an IP Address
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@@ -1,11 +0,0 @@
|
|||||||
{% extends 'ipam/prefix.html' %}
|
|
||||||
|
|
||||||
{% block title %}{{ block.super }} - IP Addresses{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{% include 'utilities/obj_table.html' with table=ip_table table_template='panel_table.html' heading='IP Addresses' bulk_edit_url='ipam:ipaddress_bulk_edit' bulk_delete_url='ipam:ipaddress_bulk_delete' %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@@ -1,11 +0,0 @@
|
|||||||
{% extends 'ipam/prefix.html' %}
|
|
||||||
|
|
||||||
{% block title %}{{ block.super }} - Prefixes{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{% include 'utilities/obj_table.html' with table=prefix_table table_template='panel_table.html' heading='Child Prefixes' bulk_edit_url='ipam:prefix_bulk_edit' bulk_delete_url='ipam:prefix_bulk_delete' parent=prefix %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@@ -1,39 +1,7 @@
|
|||||||
{% extends 'generic/object.html' %}
|
{% extends 'ipam/vlan/base.html' %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load plugins %}
|
{% load plugins %}
|
||||||
|
|
||||||
{% block title %}VLAN {{ object.display_name }}{% endblock %}
|
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
|
||||||
<li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
|
|
||||||
{% if object.site %}
|
|
||||||
<li><a href="{% url 'ipam:vlan_list' %}?site_id={{ object.site.pk }}">{{ object.site }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
{% if object.group %}
|
|
||||||
<li><a href="{% url 'ipam:vlan_list' %}?group_id={{ object.group.pk }}">{{ object.group }}</a></li>
|
|
||||||
{% endif %}
|
|
||||||
<li>{{ object }}</li>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block tabs %}
|
|
||||||
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
|
||||||
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:vlan' pk=object.pk %}">VLAN</a>
|
|
||||||
</li>
|
|
||||||
<li role="presentation"{% if active_tab == 'interfaces' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:vlan_interfaces' pk=object.pk %}">Device Interfaces <span class="badge">{{ object.get_interfaces.count }}</span></a>
|
|
||||||
</li>
|
|
||||||
<li role="presentation"{% if active_tab == 'vminterfaces' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:vlan_vminterfaces' pk=object.pk %}">VM Interfaces <span class="badge">{{ object.get_vminterfaces.count }}</span></a>
|
|
||||||
</li>
|
|
||||||
{% if perms.extras.view_objectchange %}
|
|
||||||
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
|
|
||||||
<a href="{% url 'ipam:vlan_changelog' pk=object.pk %}">Change Log</a>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
40
netbox/templates/ipam/vlan/base.html
Normal file
40
netbox/templates/ipam/vlan/base.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{% extends 'generic/object.html' %}
|
||||||
|
{% load helpers %}
|
||||||
|
{% load plugins %}
|
||||||
|
|
||||||
|
{% block title %}VLAN {{ object.display_name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block breadcrumbs %}
|
||||||
|
<li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
|
||||||
|
{% if object.site %}
|
||||||
|
<li><a href="{% url 'ipam:vlan_list' %}?site_id={{ object.site.pk }}">{{ object.site }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% if object.group %}
|
||||||
|
<li><a href="{% url 'ipam:vlan_list' %}?group_id={{ object.group.pk }}">{{ object.group }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
<li>{{ object }}</li>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block tabs %}
|
||||||
|
<ul class="nav nav-tabs" style="margin-bottom: 20px">
|
||||||
|
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:vlan' pk=object.pk %}">VLAN</a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation"{% if active_tab == 'interfaces' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:vlan_interfaces' pk=object.pk %}">Device Interfaces <span class="badge">{{ object.get_interfaces.count }}</span></a>
|
||||||
|
</li>
|
||||||
|
<li role="presentation"{% if active_tab == 'vminterfaces' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:vlan_vminterfaces' pk=object.pk %}">VM Interfaces <span class="badge">{{ object.get_vminterfaces.count }}</span></a>
|
||||||
|
</li>
|
||||||
|
{% if perms.extras.view_journalentry %}
|
||||||
|
<li role="presentation"{% if active_tab == 'journal' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:vlan_journal' pk=object.pk %}">Journal</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% if perms.extras.view_objectchange %}
|
||||||
|
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
|
||||||
|
<a href="{% url 'ipam:vlan_changelog' pk=object.pk %}">Change Log</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
{% endblock %}
|
9
netbox/templates/ipam/vlan/interfaces.html
Normal file
9
netbox/templates/ipam/vlan/interfaces.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends 'ipam/vlan/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='Device Interfaces' parent=vlan %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
9
netbox/templates/ipam/vlan/vminterfaces.html
Normal file
9
netbox/templates/ipam/vlan/vminterfaces.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{% extends 'ipam/vlan/base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
{% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='Virtual Machine Interfaces' parent=vlan %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
@@ -1,9 +0,0 @@
|
|||||||
{% extends 'ipam/vlan.html' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='Device Interfaces' parent=vlan %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@@ -1,9 +0,0 @@
|
|||||||
{% extends 'ipam/vlan.html' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12">
|
|
||||||
{% include 'utilities/obj_table.html' with table=members_table table_template='panel_table.html' heading='Virtual Machine Interfaces' parent=vlan %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
Reference in New Issue
Block a user