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" >
< h1 class = "page-header" > {% trans "NWFilter:" %} {{ name }}< / h1 >
< ol class = "breadcrumb" >
< li class = "active" >
< i class = "fa fa-dashboard" > < / i > < a href = "{% url 'overview' compute.id %}" > {% trans "Overview" %}< / a >
< / li >
2018-09-28 10:33:21 +00:00
< li >
< i class = "fa fa-server" > < / i > < a href = "{% url 'instances' compute.id %}" > {% trans "Instances" %}< / a >
< / li >
2018-09-21 13:50:44 +00:00
< li >
< i class = "fa fa-hdd-o" > < / i > < a href = "{% url 'storages' compute.id %}" > {% trans "Storages" %}< / a >
< / li >
< li >
< i class = "fa fa-sitemap" > < / i > < a href = "{% url 'networks' compute.id %}" > {% trans "Networks" %}< / a >
< / li >
< li >
< i class = "fa fa-wifi" > < / i > < a href = "{% url 'interfaces' compute.id %}" > {% trans "Interfaces" %}< / a >
< / li >
< li >
2018-09-24 11:41:13 +00:00
< i class = "fa fa-filter" > < / i > < a href = "{% url 'nwfilters' compute.id %}" > {% trans "NWFilters" %}< / a >
2018-09-21 13:50:44 +00:00
< / li >
< li >
< i class = "fa fa-key" > < / i > < a href = "{% url 'secrets' compute.id %}" > {% trans "Secrets" %}< / a >
< / li >
< / ol >
< / div >
< / div >
<!-- /.row -->
{% include 'errors_block.html' %}
{% include 'messages_block.html' %}
2019-01-24 12:00:45 +00:00
< div class = "row" >
< div class = "col-xs-6 col-sm-4" >
< p > {% trans "UUID:" %}< / p >
< p > {% trans "Name:" %}< / p >
< / div >
< div class = "col-xs-6 col-sm-8" >
< p > {{ uuid }}< / p >
< p > {{ name }}< / p >
< / div >
< / div >
< div class = "row" >
< h3 class = "page-header" > < / h3 >
< / div >
< div class = "panel-group" id = "accordion" >
< div class = "panel panel-default" >
< div class = "panel-heading" >
< a data-toggle = "collapse" data-parent = "#accordion" href = "#collapseOne" >
{% trans 'XML' %}
< / a >
< / div >
< div id = "collapseOne" class = "panel-collapse collapse" >
< div class = "panel-body" >
2018-09-21 13:50:44 +00:00
2019-01-24 12:00:45 +00:00
< form class = "form-inline" method = "post" role = "form" > {% csrf_token %}
< div class = "col-xs-12" id = "xmlheight" >
< input type = "hidden" name = "edit_xml" / >
< textarea id = "edit_editor" > {{ xml }}< / textarea >
< / div >
< button type = "submit" class = "btn btn-primary pull-right" name = "edit_nwfilter" >
{% trans "Edit" %}
< / button >
< / form >
2018-09-21 13:50:44 +00:00
< / div >
2019-01-24 12:00:45 +00:00
< / div >
< / div >
< / div >
2019-01-25 05:49:00 +00:00
< form class = "form-inline pull-right" method = "post" role = "form" > {% csrf_token %}
< div class = "form-group" >
< label > {% trans "Filter" %}:< / label >
< select id = "nwfilter_select" name = "nwfilters_select" class = "form-control" >
< 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 pull-right" name = "add_nwfilter_ref" >
< span class = "glyphicon glyphicon-plus" aria-hidden = "true" > < / span >
< / button >
< / div >
< / form >
2018-09-21 13:50:44 +00:00
< div class = "row" >
2019-01-24 12:00:45 +00:00
< h3 class = "page-header" > {% trans "Filter References" %}< / h3 >
2018-09-21 13:50:44 +00:00
< / div >
2019-01-25 05:49:00 +00:00
< div class = "col-xs-12 col-sm-12" >
< table class = "table table-hover" >
2019-01-24 12:00:45 +00:00
< thead >
2020-03-16 13:59:45 +00:00
< tr >
< th style = "width: 45px;" > #< / th >
< th > {% trans "Reference" %}< / th >
< th > {% trans "Action" %}< / th >
< / tr >
2019-01-24 12:00:45 +00:00
< / thead >
< tbody >
{% for ref in refs %}
< tr >
< td > {{ forloop.counter }}< / td >
< td > {{ ref }}< / td >
< td style = "width:30px;" >
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 = "ref" value = "{{ ref }}" >
< button type = "submit" class = "btn btn-sm btn-default" 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 >
2018-09-21 13:50:44 +00:00
< / div >
2019-01-24 12:00:45 +00:00
2019-01-25 05:49:00 +00:00
{% include 'add_nwf_rule.html' %}
2018-09-21 13:50:44 +00:00
< div class = "row" >
2019-01-24 12:00:45 +00:00
< h3 class = "page-header" > {% trans "Rules" %}< / h3 >
< / div >
2019-01-25 05:49:00 +00:00
< div class = "col-xs-12 col-sm-12" >
< table class = "table table-hover" >
2019-01-24 12:00:45 +00:00
< thead >
2020-03-16 13:59:45 +00:00
< tr >
2019-01-25 05:49:00 +00:00
< th style = "width:45px;" > {% trans "Rule" %}< / th >
2019-01-24 12:00:45 +00:00
< th > {% trans "ActionType" %}< / th >
< th > {% trans "Direction" %}< / th >
< th > {% trans "Priority" %}< / th >
< th > {% trans "Statematch" %}< / th >
< th > {% trans "Directives" %}< / th >
< th style = "width:100px;" > {% trans "Action" %}< / th >
2020-03-16 13:59:45 +00:00
< / tr >
2019-01-24 12:00:45 +00:00
< / thead >
< tbody >
{% for rule in rules %}
< tr >
< td > {{ forloop.counter }}< / td >
< 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 }}" >
< button type = "submit" class = "btn btn-sm btn-default" name = "del_nwfilter_rule" title = "{% trans " Delete " % } " onclick = "return confirm('{% trans " Are you sure ? " % } ' ) " >
< i class = "fa fa-trash" > < / i >
< / button >
< / form >
< / td >
< / tr >
{% endfor %}
< / tbody >
< / table >
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 >
< script src = "{% static " js / ace . js " % } " > < / script >
< 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 %}