Feature 16 (#24)

* consolidate ACL UI view

* remove ACL Rule navigation link
This commit is contained in:
Ryan Merolle 2022-07-10 09:59:54 -04:00 committed by GitHub
parent 0f4146a8e2
commit 1f7da36e45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 137 additions and 5 deletions

View File

@ -26,9 +26,10 @@ menu_items = (
link_text='Access Lists',
buttons=accesslist_buttons
),
PluginMenuItem(
link='plugins:netbox_access_lists:accesslistrule_list',
link_text='Access List Rules',
buttons=accesslistrule_butons
),
# # Comment out Access List Rule to force creation in the ACL view
# PluginMenuItem(
# link='plugins:netbox_access_lists:accesslistrule_list',
# link_text='Access List Rules',
# buttons=accesslistrule_butons
# ),
)

View File

@ -1,6 +1,43 @@
{% extends 'generic/object.html' %}
{% load render_table from django_tables2 %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_access_lists:accesslist_list' %}">Access Lists</a></li>
{% endblock %}
{% block controls %}
<div class="pull-right noprint">
{% if perms.netbox_access_lists.change_policy %}
<a href="{% url 'plugins:netbox_access_lists:accesslistrule_add' %}?access_list={{ object.pk }}" class="btn btn-success">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Rule
</a>
{% endif %}
{% if perms.netbox_access_lists.change_policy %}
<a href="{% url 'plugins:netbox_access_lists:accesslist_edit' pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</a>
{% endif %}
{% if perms.netbox_access_lists.delete_policy %}
<a href="{% url 'plugins:netbox_access_lists:accesslist_delete' pk=object.pk %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</a>
{% endif %}
</div>
{% endblock controls %}
{% block tabs %}
<ul class="nav nav-tabs px-3">
{% block tab_items %}
<li class="nav-item" role="presentation">
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
</li>
{% endblock tab_items %}
{% if perms.extras.view_objectchange %}
<li role="presentation" class="nav-item">
<a href="{% url 'plugins:netbox_access_lists:accesslist_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
</li>
{% endif %}
</ul>
{% endblock tabs %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">

View File

@ -0,0 +1,94 @@
{% extends 'generic/object.html' %}
{% load buttons %}
{% load custom_links %}
{% load helpers %}
{% load plugins %}
{% load render_table from django_tables2 %}
{% block breadcrumbs %}
<li class="breadcrumb-item"><a href="{% url 'plugins:netbox_bgp:routingpolicy_list' %}">Routing Policies</a></li>
{% endblock %}
{% block controls %}
<div class="pull-right noprint">
{% if perms.netbox_bgp.change_policy %}
<a href="{% url 'plugins:netbox_bgp:routingpolicyrule_add' %}?routing_policy={{ object.pk }}" class="btn btn-success">
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Rule
</a>
{% endif %}
{% if perms.netbox_bgp.change_policy %}
<a href="{% url 'plugins:netbox_bgp:routingpolicy_edit' pk=object.pk %}" class="btn btn-warning">
<span class="mdi mdi-pencil" aria-hidden="true"></span> Edit
</a>
{% endif %}
{% if perms.netbox_bgp.delete_policy %}
<a href="{% url 'plugins:netbox_bgp:routingpolicy_delete' pk=object.pk %}" class="btn btn-danger">
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Delete
</a>
{% endif %}
</div>
{% endblock controls %}
{% block tabs %}
<ul class="nav nav-tabs px-3">
{% block tab_items %}
<li class="nav-item" role="presentation">
<a class="nav-link{% if not active_tab %} active{% endif %}" href="{{ object.get_absolute_url }}">{{ object|meta:"verbose_name"|bettertitle }}</a>
</li>
{% endblock tab_items %}
{% if perms.extras.view_objectchange %}
<li role="presentation" class="nav-item">
<a href="{% url 'plugins:netbox_bgp:routingpolicy_changelog' pk=object.pk %}" class="nav-link{% if active_tab == 'changelog'%} active{% endif %}">Change Log</a>
</li>
{% endif %}
</ul>
{% endblock tabs %}
{% block content %}
<div class="row mb-3">
<div class="col-md-4">
<div class="card">
<h5 class="card-header">
Routing Policy
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<td>name</td>
<td>{{ object.name }}</td>
</tr>
<tr>
<td>Description</td>
<td>{{ object.description|placeholder }}</td>
</tr>
</table>
</div>
</div>
{% include 'inc/panels/custom_fields.html' %}
{% include 'inc/panels/tags.html' %}
{% plugin_left_page object %}
</div>
<div class="col-md-8">
<div class="card">
<h5 class="card-header">
Related BGP Sessions
</h5>
<div class="card-body">
{% render_table related_session_table 'inc/table.html' %}
</div>
{% plugin_right_page object %}
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="card">
<h5 class="card-header">
Rules
</h5>
<div class="card-body">
{% render_table rules_table 'inc/table.html' %}
</div>
{% plugin_full_width_page object %}
</div>
</div>
</div>
{% endblock %}