2018-09-21 13:50:44 +00:00
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %}
{% block content %}
<!-- Page Heading -->
< div class = "row" >
< div class = "col-lg-12" >
2020-05-19 16:53:54 +00:00
< h3 class = "page-header" > {% trans "NWFilter" %}: {{ name }}< / h3 >
< ol class = "breadcrumb bg-light shadow-sm" >
< li class = "breadcrumb-item active" >
< a href = "{% url 'overview' compute.id %}" > < i class = "fa fa-dashboard" > < / i > {% 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 %}" > < i class = "fa fa-server" > < / i > {% trans "Instances" %}< / a >
2018-09-28 10:33:21 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
< a href = "{% url 'storages' compute.id %}" > < i class = "fa fa-hdd-o" > < / i > {% 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 %}" > < i class = "fa fa-sitemap" > < / i > {% 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 %}" > < i class = "fa fa-wifi" > < / i > {% 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 %}" > < i class = "fa fa-filter" > < / i > {% 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 'secrets' compute.id %}" > < i class = "fa fa-key" > < / i > {% trans "Secrets" %}< / a >
2018-09-21 13:50:44 +00:00
< / li >
< / ol >
< / div >
< / div >
<!-- /.row -->
{% include 'errors_block.html' %}
{% include 'messages_block.html' %}
2020-05-19 16:53:54 +00:00
< dl class = "ml-3 row" >
< 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 = "col-lg-12" >
2020-05-20 13:18:27 +00:00
< button class = "btn btn-block btn-light mb-3" role = "button" data-toggle = "collapse" data-target = "#collapseXML" aria-expanded = "true" aria-controls = "collapseXML" >
< span class = "fa fa-chevron-down" > < / span >
2020-05-19 16:53:54 +00:00
{% trans 'XML' %}
2020-05-20 13:18:27 +00:00
< / 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-right" name = "edit_nwfilter" >
2019-01-24 12:00:45 +00:00
{% trans "Edit" %}
< / button >
< / form >
2018-09-21 13:50:44 +00:00
< / div >
2019-01-24 12:00:45 +00:00
< / div >
< / div >
< / div >
2018-09-21 13:50:44 +00:00
< div class = "row" >
2020-05-20 13:18:27 +00:00
< div class = "col-lg-12" >
< h5 class = "page-header mr-auto" > {% trans "Filter References" %}
< form class = "form-inline float-right" method = "post" role = "form" > {% csrf_token %}
< div class = "form-group" >
< div class = "input-group" >
< div class = "input-group-prepend" >
< span class = "input-group-text" > {% trans "Filter" %}< / span >
< / div >
< select id = "nwfilter_select" name = "nwfilters_select" class = "custom-select" >
< option value = "" selected > {% trans 'None' %}< / option >
{% for nwf in nwfilters_all %}
< option value = "{{ nwf.name }}" > {{ nwf.name }}< / option >
{% endfor %}
< / select >
< div class = "input-group-append" >
< button type = "submit" class = "btn btn-success float-right" name = "add_nwfilter_ref" >
< span class = "fa fa-plus" aria-hidden = "true" > < / span >
< / button >
< / div >
< / div >
2020-05-19 16:53:54 +00:00
< / div >
2020-05-20 13:18:27 +00:00
< / 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" >
2020-05-20 13:18:27 +00:00
< table class = "table table-hover mb-3" >
2020-05-19 16:53:54 +00:00
< thead >
< th scope = "col" > #< / th >
2020-03-16 13:59:45 +00:00
< th > {% trans "Reference" %}< / th >
< th > {% 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;" >
< form action = "" method = "post" role = "form" > {% csrf_token %}
< input type = "hidden" name = "ref" value = "{{ ref }}" >
< button type = "submit" class = "btn btn-sm btn-danger" name = "del_nwfilter_ref" title = "{% trans " Delete " % } " onclick = "return confirm('{% trans " Are you sure ? " % } ' ) " >
< i class = "fa fa-trash" > < / i >
< / 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 >
2019-01-24 12:00:45 +00:00
2019-01-25 05:49:00 +00:00
< table class = "table table-hover" >
2019-01-24 12:00:45 +00:00
< thead >
2020-05-19 16:53:54 +00:00
< th scope = "col" > {% trans "Rule" %}< / th >
< th class = "text-nowrap" > {% trans "Action Type" %}< / th >
2019-01-24 12:00:45 +00:00
< th > {% trans "Direction" %}< / th >
< th > {% trans "Priority" %}< / th >
< th > {% trans "Statematch" %}< / th >
< th > {% trans "Directives" %}< / th >
2020-05-19 16:53:54 +00:00
< th style = "width:30px;" > {% trans "Action" %}< / th >
2019-01-24 12:00:45 +00:00
< / thead >
< tbody >
{% for rule in rules %}
< tr >
2020-05-19 16:53:54 +00:00
< td scope = "row" > {{ forloop.counter }}< / td >
2019-01-24 12:00:45 +00:00
< td > {{ rule.action }}< / td >
< td > {{ rule.direction }}< / td >
< td > {{ rule.priority }}< / td >
< td > {{ rule.statematch }}< / td >
< td > {{ rule.directives }}< / td >
< td >
2019-01-25 05:49:00 +00:00
< form action = "" method = "post" role = "form" > {% csrf_token %}
2019-01-24 12:00:45 +00:00
< input type = "hidden" name = "action" value = "{{ rule.action }}" >
< input type = "hidden" name = "direction" value = "{{ rule.direction }}" >
< input type = "hidden" name = "priority" value = "{{ rule.priority }}" >
2020-05-19 16:53:54 +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 ? " % } ' ) " >
2019-01-24 12:00:45 +00:00
< i class = "fa fa-trash" > < / i >
< / 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 %}
< script src = "{% static " js / sortable . min . js " % } " > < / script >
< script >
$(document).ready(function () {
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('.searchable tr').hide();
$('.searchable tr').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
< / script >
2020-05-14 16:59:22 +00:00
< 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());
2019-01-24 12:00:45 +00:00
});
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());
2019-01-24 12:00:45 +00:00
});
2018-09-21 13:50:44 +00:00
< / script >
{% endblock %}