mirror of
				https://github.com/retspen/webvirtcloud
				synced 2025-07-31 12:41:08 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			171 lines
		
	
	
	
		
			9.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			171 lines
		
	
	
	
		
			9.5 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {% 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">
 | |
|                     {% include 'create_nwfilter_block.html' %}
 | |
|                     <h1 class="page-header">{{ compute.name }}</h1>
 | |
|                     <ol class="breadcrumb">
 | |
|                         <li class="active">
 | |
|                             <i class="fa fa-dashboard"></i> <a href="{% url 'overview' compute.id %}">{% trans "Overview" %}</a>
 | |
|                         </li>
 | |
|                         <li>
 | |
|                             <i class="fa fa-server"></i> <a href="{% url 'instances' compute.id %}">{% trans "Instances" %}</a>
 | |
|                         </li>
 | |
|                         <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>
 | |
|                             <i class="fa fa-filter"></i> {% trans "NWFilters" %}
 | |
|                         </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' %}
 | |
| 
 | |
| <div class="row">
 | |
|     <div class="col-lg-12">
 | |
|         <div class="row">
 | |
|             <div class="pull-right">
 | |
|                 <input id="filter" class="form-control" type="text" placeholder="Search">
 | |
|             </div>
 | |
|             <h3 class="page-header">{% trans "NWFilters" %}</h3>
 | |
| 
 | |
|         </div>
 | |
|         {% if nwfilters %}
 | |
|             <div class="table-responsive">
 | |
|                 <table class="table table-striped sortable-theme-bootstrap" data-sortable>
 | |
|                     <thead>
 | |
|                     <tr>
 | |
|                         <th style="width: 45px;">#</th>
 | |
|                         <th>{% trans "UUID" %}</th>
 | |
|                         <th>{% trans "Name" %}</th>
 | |
|                         <th data-sortable="false" colspan="3">{% trans "Action" %}</th>
 | |
|                     </tr>
 | |
|                     </thead>
 | |
|                     <tbody class="searchable">
 | |
|                     {% for nwfilter in nwfilters %}
 | |
|                         <tr>
 | |
|                             <td>{{ forloop.counter }}</td>
 | |
|                             <td><a href="{% url "nwfilter" compute.id nwfilter.name %} ">{{ nwfilter.uuid }}</a></td>
 | |
|                             <td>{{ nwfilter.name }}</td>
 | |
|                             <td style="width:30px;">
 | |
|                                 <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">
 | |
|                                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
 | |
|                                                 <h4 class="modal-title">{% trans "Details of NWFilter" %}: <span class="text-danger">{{ nwfilter.name }}</span></h4>
 | |
|                                             </div>
 | |
|                                                 <div class="modal-body">
 | |
|                                                     <pre>
 | |
|                                                         <code>
 | |
|                                                             {{ nwfilter.xml }}
 | |
|                                                         </code>
 | |
|                                                     </pre>
 | |
|                                                 </div>
 | |
|                                                 <div class="modal-footer">
 | |
|                                                     <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Close" %}</button>
 | |
|                                                 </div>
 | |
|                                         </div> <!-- /.modal-content -->
 | |
|                                     </div> <!-- /.modal-dialog -->
 | |
|                                 </div> <!-- /.modal -->
 | |
|                                 <a data-toggle="modal" href="#Show{{ forloop.counter }}" class="btn btn-sm btn-default" title="{% trans "Show" %}"><i class="fa fa-eye"></i></a>
 | |
|                             </td>
 | |
|                             <td style="width:30px;">
 | |
|                                 <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">
 | |
|                                                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
 | |
|                                                 <h4 class="modal-title">{% trans "Clone nwfilter" %} <span class="text-danger">{{ nwfilter.name }}</span></h4>
 | |
|                                             </div>
 | |
|                                             <form class="form-horizontal" method="post" role="form">{% csrf_token %}
 | |
|                                                 <div class="modal-body">
 | |
|                                                     <div class="form-group">
 | |
|                                                         <label class="col-sm-3 control-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 }}">
 | |
|                                                         </div>
 | |
|                                                     </div>
 | |
|                                                 </div>
 | |
|                                                 <div class="modal-footer">
 | |
|                                                     <button type="button" class="btn btn-default" 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 -->
 | |
|                                 <a data-toggle="modal" href="#Clone{{ forloop.counter }}" class="btn btn-sm btn-default" title="{% trans "Clone" %}"><i class="fa fa-files-o"></i></a>
 | |
|                             </td>
 | |
|                             <td style="width:30px;">
 | |
|                                 <form action="" method="post" style="height:10px" role="form">{% csrf_token %}
 | |
|                                     <input type="hidden" name="nwfiltername" value="{{ nwfilter.name }}">
 | |
|                                     <button type="submit" class="btn btn-sm btn-default" 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>
 | |
|         {% else %}
 | |
|         <div class="col-lg-12">
 | |
|             <div class="alert alert-warning alert-dismissable">
 | |
|                 <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
 | |
|                 <i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "Hypervisor doesn't have any NWFilters" %}
 | |
|             </div>
 | |
|         </div>
 | |
|         {% endif %}
 | |
|     </div>
 | |
| </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("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 %}
 |