1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduce generic object template

This commit is contained in:
Jeremy Stretch
2021-03-02 15:58:33 -05:00
parent 8dd7123923
commit 51120ccf31
27 changed files with 494 additions and 1324 deletions

View File

@@ -1,59 +1,18 @@
{% extends 'base.html' %}
{% extends 'generic/object.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:aggregate_list' %}">Aggregates</a></li>
<li><a href="{% url 'ipam:aggregate_list' %}?rir={{ object.rir.slug }}">{{ object.rir }}</a></li>
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:aggregate_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search aggregates" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% if perms.ipam.add_aggregate %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_aggregate %}
{% edit_button object %}
{% endif %}
{% if perms.ipam.delete_aggregate %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
{% include 'ipam/inc/toggle_available.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ object.get_absolute_url }}">Aggregate</a>
</li>
{% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:aggregate_changelog' pk=object.pk %}">Change Log</a>
</li>
{% endif %}
</ul>
{% block breadcrumbs %}
<li><a href="{% url 'ipam:aggregate_list' %}">Aggregates</a></li>
<li><a href="{% url 'ipam:aggregate_list' %}?rir={{ object.rir.slug }}">{{ object.rir }}</a></li>
<li>{{ object }}</li>
{% endblock %}
{% block buttons %}
{% include 'ipam/inc/toggle_available.html' %}
{{ block.super }}
{% endblock %}
{% block content %}

View File

@@ -1,13 +1,11 @@
{% load helpers %}
{% if show_available is not None %}
<div class="pull-right">
<div class="btn-group" role="group">
<a href="{{ request.path }}{% querystring request show_available='true' %}" class="btn btn-default{% if show_available %} active disabled{% endif %}">
<i class="mdi mdi-eye-outline"></i> Show available
</a>
<a href="{{ request.path }}{% querystring request show_available='false' %}" class="btn btn-default{% if not show_available %} active disabled{% endif %}">
<i class="mdi mdi-eye-off-outline"></i> Hide available
</a>
</div>
</div>
<div class="btn-group" role="group">
<a href="{{ request.path }}{% querystring request show_available='true' %}" class="btn btn-default{% if show_available %} active disabled{% endif %}">
<i class="mdi mdi-eye-outline"></i> Show available
</a>
<a href="{{ request.path }}{% querystring request show_available='false' %}" class="btn btn-default{% if not show_available %} active disabled{% endif %}">
<i class="mdi mdi-eye-off-outline"></i> Hide available
</a>
</div>
{% endif %}

View File

@@ -1,61 +1,14 @@
{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% load render_table from django_tables2 %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:ipaddress_list' %}">IP Addresses</a></li>
{% if object.vrf %}
<li><a href="{% url 'ipam:vrf' pk=object.vrf.pk %}">{{ object.vrf }}</a></li>
{% endif %}
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:ipaddress_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search IPs" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% if perms.ipam.add_ipaddress %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_ipaddress %}
{%edit_button object %}
{% endif %}
{% if perms.ipam.delete_ipaddress %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ object.get_absolute_url }}">IP Address</a>
</li>
{% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:ipaddress_changelog' pk=object.pk %}">Change Log</a>
</li>
{% endif %}
</ul>
{% block breadcrumbs %}
<li><a href="{% url 'ipam:ipaddress_list' %}">IP Addresses</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 content %}

View File

@@ -1,79 +1,49 @@
{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<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>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:prefix_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search prefixes" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% 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 %}
{% if perms.ipam.add_prefix %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_prefix %}
{% edit_button object %}
{% endif %}
{% if perms.ipam.delete_prefix %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
{% include 'ipam/inc/toggle_available.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
{% 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 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>
<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>
{% 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>
{% 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 %}
{% endif %}
</ul>
{% endblock %}

View File

@@ -1,57 +1,10 @@
{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:routetarget_list' %}">Route Targets</a></li>
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:routetarget_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search roue targets" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% if perms.ipam.add_routetarget %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_routetarget %}
{% edit_button object %}
{% endif %}
{% if perms.ipam.delete_routetarget %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}Route target {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ object.get_absolute_url }}">Route Target</a>
</li>
{% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:routetarget_changelog' pk=object.pk %}">Change Log</a>
</li>
{% endif %}
</ul>
{% block breadcrumbs %}
<li><a href="{% url 'ipam:routetarget_list' %}">Route Targets</a></li>
<li>{{ object }}</li>
{% endblock %}
{% block content %}

View File

@@ -1,45 +1,25 @@
{% extends 'base.html' %}
{% extends 'generic/object.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load perms %}
{% load plugins %}
{% block breadcrumbs %}
<li><a href="{% url 'ipam:service_list' %}">Services</a></li>
<li><a href="{{ object.parent.get_absolute_url }}">{{ object.parent }}</a></li>
<li>{{ object }}</li>
{% endblock %}
{% block buttons %}
{% if request.user|can_change:object %}
{% edit_button object %}
{% endif %}
{% if request.user|can_delete:object %}
{% delete_button object %}
{% endif %}
{% endblock %}
{% block content %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:service_list' %}">Services</a></li>
<li><a href="{{ object.parent.get_absolute_url }}">{{ object.parent }}</a></li>
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:service_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search Services" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right">
{% plugin_buttons object %}
{% if perms.dcim.change_service %}
{% edit_button object %}
{% endif %}
{% if perms.dcim.delete_service %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}{{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<div class="row">
<div class="col-md-6">
<div class="panel panel-default">

View File

@@ -1,69 +1,37 @@
{% extends 'base.html' %}
{% load buttons %}
{% load custom_links %}
{% extends 'generic/object.html' %}
{% load helpers %}
{% load plugins %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:vlan_list' %}">VLANs</a></li>
{% if object.site %}
<li><a href="{% url 'ipam:vlan_list' %}?site={{ object.site.slug }}">{{ object.site }}</a></li>
{% endif %}
{% if object.group %}
<li><a href="{% url 'ipam:vlan_list' %}?group={{ object.group.slug }}">{{ object.group }}</a></li>
{% endif %}
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:vlan_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search VLANs" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% if perms.ipam.add_vlan %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_vlan %}
{% edit_button object %}
{% endif %}
{% if perms.ipam.delete_vlan %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}VLAN {{ object.display_name }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<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>
{% 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={{ object.site.slug }}">{{ object.site }}</a></li>
{% endif %}
{% if object.group %}
<li><a href="{% url 'ipam:vlan_list' %}?group={{ object.group.slug }}">{{ 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 %}

View File

@@ -1,57 +1,14 @@
{% extends 'base.html' %}
{% extends 'generic/object.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}
{% block header %}
<div class="row noprint">
<div class="col-sm-8 col-md-9">
<ol class="breadcrumb">
<li><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li>
<li>{{ object }}</li>
</ol>
</div>
<div class="col-sm-4 col-md-3">
<form action="{% url 'ipam:vrf_list' %}" method="get">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Search VRFs" />
<span class="input-group-btn">
<button type="submit" class="btn btn-primary">
<span class="mdi mdi-magnify" aria-hidden="true"></span>
</button>
</span>
</div>
</form>
</div>
</div>
<div class="pull-right noprint">
{% plugin_buttons object %}
{% if perms.ipam.add_vrf %}
{% clone_button object %}
{% endif %}
{% if perms.ipam.change_vrf %}
{% edit_button object %}
{% endif %}
{% if perms.ipam.delete_vrf %}
{% delete_button object %}
{% endif %}
</div>
<h1>{% block title %}VRF {{ object }}{% endblock %}</h1>
{% include 'inc/created_updated.html' %}
<div class="pull-right noprint">
{% custom_links object %}
</div>
<ul class="nav nav-tabs">
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
<a href="{{ object.get_absolute_url }}">VRF</a>
</li>
{% if perms.extras.view_objectchange %}
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
<a href="{% url 'ipam:vrf_changelog' pk=object.pk %}">Change Log</a>
</li>
{% endif %}
</ul>
{% block title %}VRF {{ object }}{% endblock %}
{% block breadcrumbs %}
<li><a href="{% url 'ipam:vrf_list' %}">VRFs</a></li>
<li>{{ object }}</li>
{% endblock %}
{% block content %}