1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-10-31 19:44:16 +00:00
webvirtcloud/nwfilters/templates/nwfilter.html

179 lines
7.8 KiB
HTML
Raw Normal View History

2018-09-21 13:50:44 +00:00
{% extends "base.html" %}
{% load i18n %}
2021-06-15 06:42:55 +00:00
{% load static %}
{% load bootstrap_icons %}
2020-10-15 14:18:45 +00:00
{% block title %}{% trans "NWFilter" %}: {{ name }}{% endblock %}
{% block page_heading %}{% trans "NWFilter" %}: {{ name }}{% endblock page_heading %}
2018-09-21 13:50:44 +00:00
{% block content %}
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb shadow-sm">
<li class="breadcrumb-item">
<a href="{% url 'overview' compute.id %}">{% bs_icon 'laptop' %} {% trans "Overview" %}</a>
2018-09-21 13:50:44 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'instances' compute.id %}">{% bs_icon 'server' %} {% trans "Instances" %}</a>
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'storages' compute.id %}">{% bs_icon 'device-hdd' %} {% trans "Storages" %}</a>
2018-09-21 13:50:44 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'networks' compute.id %}">{% bs_icon 'hdd-network' %} {% trans "Networks" %}</a>
2018-09-21 13:50:44 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'interfaces' compute.id %}">{% bs_icon 'wifi' %} {% trans "Interfaces" %}</a>
2018-09-21 13:50:44 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'nwfilters' compute.id %}">{% bs_icon 'filter' %} {% trans "NWFilters" %}</a>
2018-09-21 13:50:44 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<a href="{% url 'virtsecrets' compute.id %}">{% bs_icon 'key' %} {% trans "Secrets" %}</a>
2018-09-21 13:50:44 +00:00
</li>
</ol>
</div>
</div>
<dl class="ms-3 row">
2020-05-19 16:53:54 +00:00
<dt class="col-4">{% trans "UUID" %}:</dt>
<dd class="col-8">{{ uuid }}</dd>
<dt class="col-4">{% trans "Name" %}:</dt>
<dd class="col-8">{{ name }}</dd>
</dl>
<div class="row">
<div class="d-grid col-lg-12">
<button class="btn btn-light mb-3" role="button" data-bs-toggle="collapse" data-bs-target="#collapseXML" aria-expanded="true" aria-controls="collapseXML">
<span>{% bs_icon 'chevron-down' %} </span>
2020-05-19 16:53:54 +00:00
{% trans 'XML' %}
</button>
2020-05-19 16:53:54 +00:00
<div class="collapse" id="collapseXML">
<div class="card card-body">
<form class="form" method="post" role="form">{% csrf_token %}
<div class="col-12" id="xmlheight">
<input type="hidden" name="edit_xml"/>
<textarea id="edit_editor">{{ xml }}</textarea>
</div>
<button type="submit" class="btn btn-primary float-end" name="edit_nwfilter">
{% trans "Edit" %}
</button>
</form>
2018-09-21 13:50:44 +00:00
</div>
</div>
</div>
</div>
2018-09-21 13:50:44 +00:00
<div class="row">
<div class="col-lg-12">
<h5 class="page-header mr-auto">{% trans "Filter References" %}
<form class="float-end" method="post" role="form" aria-label="Add NWFilter form">{% csrf_token %}
<div class="input-group">
<span class="input-group-text">{% trans "Filter" %}</span>
<select id="nwfilter_select" name="nwfilters_select" class="form-select">
<option value="" selected>{% trans 'None' %}</option>
{% for nwf in nwfilters_all %}
<option value="{{ nwf.name }}">{{ nwf.name }}</option>
{% endfor %}
</select>
<button type="submit" class="btn btn-success float-end" name="add_nwfilter_ref">
<span aria-hidden="true">{% bs_icon 'plus' %} </span>
</button>
2020-05-19 16:53:54 +00:00
</div>
</form>
</h5>
</div>
2018-09-21 13:50:44 +00:00
</div>
2020-05-19 16:53:54 +00:00
<div class="row">
<div class="col-12 col-sm-12">
<table class="table table-hover mb-3">
2020-05-19 16:53:54 +00:00
<thead>
<th scope="col">#</th>
<th scope="col">{% trans "Reference" %}</th>
<th scope="col">{% trans "Action" %}</th>
2020-05-19 16:53:54 +00:00
</thead>
<tbody>
{% for ref in refs %}
<tr>
<th scope="row">{{ forloop.counter }}</th>
<td>{{ ref }}</td>
<td style="width:30px;">
2020-05-26 13:18:38 +00:00
<form action="" method="post" role="form" aria-label="Delete NWFilter form">{% csrf_token %}
2020-05-19 16:53:54 +00:00
<input type="hidden" name="ref" value="{{ ref }}">
2021-06-10 12:17:53 +00:00
<button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_ref" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}');">
{% bs_icon 'trash' %}
2020-05-19 16:53:54 +00:00
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
2018-09-21 13:50:44 +00:00
</div>
2020-05-19 16:53:54 +00:00
{% include 'add_nwf_rule.html' %}
<h5 class="page-header">{% trans "Rules" %}</h5>
<table class="table table-hover">
<thead>
2020-05-19 16:53:54 +00:00
<th scope="col">{% trans "Rule" %}</th>
<th scope="col" class="text-nowrap">{% trans "Action Type" %}</th>
<th scope="col">{% trans "Direction" %}</th>
<th scope="col">{% trans "Priority" %}</th>
<th scope="col">{% trans "Statematch" %}</th>
<th scope="col">{% trans "Directives" %}</th>
<th scope="col" style="width:30px;">{% trans "Action" %}</th>
</thead>
<tbody>
{% for rule in rules %}
<tr>
<th scope="row">{{ forloop.counter }}</th>
<td>{{ rule.action }}</td>
<td>{{ rule.direction }}</td>
<td>{{ rule.priority }}</td>
<td>{{ rule.statematch }}</td>
<td>{{ rule.directives }}</td>
<td>
2020-05-26 13:18:38 +00:00
<form action="" method="post" role="form" aria-label="Delete NWFilter rule">{% csrf_token %}
<input type="hidden" name="action" value="{{ rule.action }}">
<input type="hidden" name="direction" value="{{ rule.direction }}">
<input type="hidden" name="priority" value="{{ rule.priority }}">
2021-06-10 12:17:53 +00:00
<button type="submit" class="btn btn-sm btn-danger" name="del_nwfilter_rule" title="{% trans 'Delete' %}" onclick="return confirm('{% trans "Are you sure?" %}');">
{% bs_icon 'trash' %}
</button>
</form>
</td>
</tr>
2020-05-19 16:53:54 +00:00
{% endfor %}
</tbody>
</table>
</div>
2018-09-21 13:50:44 +00:00
</div>
{% endblock %}
{% block script %}
2021-06-10 12:17:53 +00:00
<script src="{% static 'js/sortable.min.js' %}"></script>
<script src="{% static 'js/ace/ace.js' %}"></script>
2018-09-21 13:50:44 +00:00
<script>
var editor = ace.edit("edit_editor");
editor.getSession().setMode("ace/mode/xml");
var edit_input = $('input[name="edit_xml"]');
editor.getSession().on("change",function () {
edit_input.val(editor.getSession().getValue());
});
2018-09-21 13:50:44 +00:00
var rule_editor = ace.edit("rule_editor");
rule_editor.getSession().setMode("ace/mode/xml");
var rule_input = $('input[name="nwfilterrule_xml"]');
rule_editor.getSession().on("change",function () {
rule_input.val(rule_editor.getSession().getValue());
});
2018-09-21 13:50:44 +00:00
</script>
{% endblock %}