mirror of
https://github.com/lucaspalomodevelop/netbox-acls.git
synced 2026-03-12 23:27:23 +00:00
Add templates
This commit is contained in:
parent
b2f1369029
commit
d776b0a0f0
@ -0,0 +1,43 @@
|
||||
{% extends 'generic/object.html' %}
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Access List</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">Name</th>
|
||||
<td>{{ object.name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Default Action</th>
|
||||
<td>{{ object.get_default_action_display }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Rules</th>
|
||||
<td>{{ object.rules.count }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
</div>
|
||||
<div class="col col-md-6">
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
{% include 'inc/panels/comments.html' %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Rules</h5>
|
||||
<div class="card-body table-responsive">
|
||||
{% render_table rules_table %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@ -0,0 +1,76 @@
|
||||
{% extends 'generic/object.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row mb-3">
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Access List Rule</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">Access List</th>
|
||||
<td>
|
||||
<a href="{{ object.access_list.get_absolute_url }}">{{ object.access_list }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Index</th>
|
||||
<td>{{ object.index }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Description</th>
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
{% include 'inc/panels/tags.html' %}
|
||||
</div>
|
||||
<div class="col col-md-6">
|
||||
<div class="card">
|
||||
<h5 class="card-header">Details</h5>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">Protocol</th>
|
||||
<td>{{ object.get_protocol_display }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Source Prefix</th>
|
||||
<td>
|
||||
{% if object.source_prefix %}
|
||||
<a href="{{ object.source_prefix.get_absolute_url }}">{{ object.source_prefix }}</a>
|
||||
{% else %}
|
||||
{{ ''|placeholder }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Source Ports</th>
|
||||
<td>{{ object.source_ports|join:", "|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Destination Prefix</th>
|
||||
<td>
|
||||
{% if object.destination_prefix %}
|
||||
<a href="{{ object.destination_prefix.get_absolute_url }}">{{ object.destination_prefix }}</a>
|
||||
{% else %}
|
||||
{{ ''|placeholder }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Destination Ports</th>
|
||||
<td>{{ object.destination_ports|join:", "|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Action</th>
|
||||
<td>{{ object.get_action_display }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
@ -11,6 +11,14 @@ from . import forms, models, tables
|
||||
class AccessListView(generic.ObjectView):
|
||||
queryset = models.AccessList.objects.all()
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
table = tables.AccessListRuleTable(instance.rules.all())
|
||||
table.configure(request)
|
||||
|
||||
return {
|
||||
'rules_table': table,
|
||||
}
|
||||
|
||||
|
||||
class AccessListListView(generic.ObjectListView):
|
||||
queryset = models.AccessList.objects.annotate(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user