1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 12:04:15 +00:00
webvirtcloud/nwfilters/templates/nwfilters.html

174 lines
9.3 KiB
HTML
Raw Normal View History

2018-09-21 13:50:44 +00:00
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %}
{% block content %}
2020-05-19 16:53:54 +00:00
<!-- Page Heading -->
2019-07-31 08:03:48 +00:00
<div class="row">
<div class="col-lg-12">
{% include 'create_nwfilter_block.html' %}
2020-05-19 16:53:54 +00:00
<div class="float-right search">
<input id="filter" class="form-control" type="text" placeholder="Search">
</div>
<h2 class="page-header">{{ compute.name }} - {% trans "NWFilters" %}</h2>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<nav aria-label="breadcrumb">
<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>
2019-07-31 08:03:48 +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>
2019-07-31 08:03:48 +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>
2019-07-31 08:03:48 +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>
2019-07-31 08:03:48 +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>
2019-07-31 08:03:48 +00:00
</li>
2020-05-19 16:53:54 +00:00
<li class="breadcrumb-item">
<span class="font-weight-bold"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</span>
2019-07-31 08:03:48 +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>
2019-07-31 08:03:48 +00:00
</li>
</ol>
2020-05-19 16:53:54 +00:00
</nav>
2019-07-31 08:03:48 +00:00
</div>
</div>
<!-- /.row -->
2018-09-21 13:50:44 +00:00
2019-07-31 08:03:48 +00:00
{% include 'errors_block.html' %}
{% include 'messages_block.html' %}
2018-09-21 13:50:44 +00:00
2020-05-19 16:53:54 +00:00
<div class="row">
2019-07-31 08:03:48 +00:00
<div class="col-lg-12">
{% if nwfilters %}
2020-05-19 16:53:54 +00:00
<div class="table-responsive">
<table class="table sortable-theme-bootstrap" data-sortable>
<thead>
2018-09-21 13:50:44 +00:00
<tr>
2020-05-19 16:53:54 +00:00
<th scope="col">#</th>
2019-07-31 08:03:48 +00:00
<th>{% trans "UUID" %}</th>
<th>{% trans "Name" %}</th>
<th data-sortable="false" colspan="3">{% trans "Action" %}</th>
</tr>
2020-05-19 16:53:54 +00:00
</thead>
<tbody class="searchable">
{% for nwfilter in nwfilters %}
<tr>
<th scope="row">{{ forloop.counter }}</th>
<td><a class="text-secondary" href="{% url "nwfilter" compute.id nwfilter.name %} ">{{ nwfilter.uuid }}</a></td>
<td>{{ nwfilter.name }}</td>
<td>
<div class="modal fade" id="Show{{ forloop.counter }}" tabindex="-1" role="dialog" aria-labelledby="showNWFilter" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Details of NWFilter" %}: <span class="text-danger">{{ nwfilter.name }}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<div class="modal-body">
<textarea rows="10" class="w-100">
{{ nwfilter.xml }}
</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
</div>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
<button class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#Show{{ forloop.counter }}" title="{% trans "Show" %}">
<i class="fa fa-eye"></i>
</button>
</td>
<td>
<div class="modal fade" id="Clone{{ forloop.counter }}" tabindex="-1" role="dialog" aria-labelledby="addNwFilterLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{% trans "Clone NWFilter" %} <span class="text-danger">{{ nwfilter.name }}</span></h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
<form method="post" role="form">{% csrf_token %}
<div class="modal-body">
<div class="form-group row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="cln_name" placeholder="{% trans "Name" %}" required pattern="[a-zA-Z0-9\.\-_]+">
<input type="hidden" name="nwfiltername" value="{{ nwfilter.name }}">
2019-07-31 08:03:48 +00:00
</div>
2018-09-21 13:50:44 +00:00
</div>
2020-05-19 16:53:54 +00:00
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary" name="cln_nwfilter">{% trans "Clone" %}</button>
</div>
</form>
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
<button class="btn btn-sm btn-secondary" data-toggle="modal" data-target="#Clone{{ forloop.counter }}" title="{% trans "Clone" %}"><i class="fa fa-files-o"></i></button>
</td>
<td>
<form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="nwfiltername" value="{{ nwfilter.name }}">
<button type="submit" class="btn btn-sm btn-secondary" name="del_nwfilter" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
<i class="fa fa-trash"></i>
</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
2019-07-31 08:03:48 +00:00
{% else %}
2020-05-19 16:53:54 +00:00
<div class="row">
<div class="col-lg-12">
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning" %}:</strong> {% trans "Hypervisor doesn't have any NWFilters" %}
</div>
2019-07-31 08:03:48 +00:00
</div>
2018-09-21 13:50:44 +00:00
</div>
2019-07-31 08:03:48 +00:00
{% endif %}
2018-09-21 13:50:44 +00:00
</div>
</div>
{% endblock %}
{% block script %}
2019-07-31 08:03:48 +00:00
<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>
2018-09-21 13:50:44 +00:00
<script src="{% static "js/ace/ace.js" %}"></script>
2018-09-21 13:50:44 +00:00
<script>
var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/xml");
var input = $('input[name="nwfilter_xml"]');
editor.getSession().on("change",function () {
input.val(editor.getSession().getValue());
})
</script>
{% endblock %}