2018-09-21 13:50:44 +00:00
{% extends "base.html" %}
{% load i18n %}
2021-06-15 06:42:55 +00:00
{% load static %}
2023-08-09 06:20:18 +00:00
{% load bootstrap_icons %}
2020-10-15 14:18:45 +00:00
2020-10-21 09:09:06 +00:00
{% block title %}{% trans "NWFilters" %} - {{ compute.name }}{% endblock %}
2020-10-15 14:18:45 +00:00
{% block page_heading %}{{ compute.name }} - {% trans "NWFilters" %}{% endblock page_heading %}
{% block page_heading_extra %}
{% include 'create_nwfilter_block.html' %}
2021-06-10 12:17:53 +00:00
{% include 'search_block.html' %}
2020-10-15 14:18:45 +00:00
{% endblock page_heading_extra %}
2018-09-21 13:50:44 +00:00
{% block content %}
2020-05-19 16:53:54 +00:00
< div class = "row" >
< div class = "col-lg-12" >
< nav aria-label = "breadcrumb" >
2021-07-07 11:12:38 +00:00
< ol class = "breadcrumb shadow-sm" >
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'overview' compute.id %}" > {% bs_icon 'laptop' %} {% trans "Overview" %}< / a >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'instances' compute.id %}" > {% bs_icon 'server' %} {% trans "Instances" %}< / a >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'storages' compute.id %}" > {% bs_icon 'device-hdd' %} {% trans "Storages" %}< / a >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'networks' compute.id %}" > {% bs_icon 'hdd-network' %} {% trans "Networks" %}< / a >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'interfaces' compute.id %}" > {% bs_icon 'wifi' %} {% trans "Interfaces" %}< / a >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< span class = "fw-bold" > {% bs_icon 'filter' %} {% trans "NWFilters" %}< / span >
2019-07-31 08:03:48 +00:00
< / li >
2020-05-19 16:53:54 +00:00
< li class = "breadcrumb-item" >
2023-08-09 06:20:18 +00:00
< a href = "{% url 'virtsecrets' compute.id %}" > {% bs_icon 'key' %} {% 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 >
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 >
2020-05-26 10:52:52 +00:00
< th scope = "col" > {% trans "UUID" %}< / th >
< th scope = "col" > {% trans "Name" %}< / th >
< th scope = "colgroup" data-sortable = "false" colspan = "3" > {% trans "Action" %}< / th >
2019-07-31 08:03:48 +00:00
< / tr >
2020-05-19 16:53:54 +00:00
< / thead >
< tbody class = "searchable" >
{% for nwfilter in nwfilters %}
< tr >
< th scope = "row" > {{ forloop.counter }}< / th >
2021-07-07 11:12:38 +00:00
< td > < a class = "link-primary" href = "{% url 'nwfilter' compute.id nwfilter.name %} " > {{ nwfilter.uuid }}< / a > < / td >
2020-05-19 16:53:54 +00:00
< 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 >
2021-07-07 11:12:38 +00:00
< button type = "button" class = "btn-close" data-bs-dismiss = "modal" aria-label = "Close" > < / button >
2020-05-19 16:53:54 +00:00
< / div >
< div class = "modal-body" >
< textarea rows = "10" class = "w-100" >
{{ nwfilter.xml }}
< / textarea >
< / div >
< div class = "modal-footer" >
2021-07-07 11:12:38 +00:00
< button type = "button" class = "btn btn-secondary" data-bs-dismiss = "modal" > {% trans "Close" %}< / button >
2020-05-19 16:53:54 +00:00
< / div >
< / div > <!-- /.modal - content -->
< / div > <!-- /.modal - dialog -->
< / div > <!-- /.modal -->
2021-07-07 11:12:38 +00:00
< button class = "btn btn-sm btn-secondary" data-bs-toggle = "modal" data-bs-target = "#Show{{ forloop.counter }}" title = "{% trans " Show " % } " >
2023-08-09 06:20:18 +00:00
{% bs_icon 'eye' %}
2020-05-19 16:53:54 +00:00
< / 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 >
2021-07-07 11:12:38 +00:00
< button type = "button" class = "btn-close" data-bs-dismiss = "modal" aria-label = "Close" > < / button >
2020-05-19 16:53:54 +00:00
< / div >
2020-05-26 13:18:38 +00:00
< form method = "post" role = "form" aria-label = "Clone NWFilter form" > {% csrf_token %}
2020-05-19 16:53:54 +00:00
< div class = "modal-body" >
2021-07-07 11:12:38 +00:00
< div class = "row" >
2020-05-19 16:53:54 +00:00
< 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" >
2021-07-07 11:12:38 +00:00
< button type = "button" class = "btn btn-secondary" data-bs-dismiss = "modal" > {% trans "Close" %}< / button >
2020-05-19 16:53:54 +00:00
< button type = "submit" class = "btn btn-primary" name = "cln_nwfilter" > {% trans "Clone" %}< / button >
< / div >
< / form >
< / div > <!-- /.modal - content -->
< / div > <!-- /.modal - dialog -->
< / div > <!-- /.modal -->
2023-08-09 06:20:18 +00:00
< button class = "btn btn-sm btn-secondary" data-bs-toggle = "modal" data-bs-target = "#Clone{{ forloop.counter }}" title = "{% trans " Clone " % } " > {% bs_icon 'files' %} < / button >
2020-05-19 16:53:54 +00:00
< / td >
< td >
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 = "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 ? " % } ' ) " >
2023-08-09 06:20:18 +00:00
{% bs_icon 'trash' %}
2020-05-19 16:53:54 +00:00
< / 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" >
2021-07-07 11:12:38 +00:00
< div class = "alert alert-warning shadow-sm" >
2023-08-09 06:20:18 +00:00
{% bs_icon 'exclamation-triangle' %} < strong > {% trans "Warning" %}:< / strong > {% trans "Hypervisor doesn't have any NWFilters" %}
2020-05-19 16:53:54 +00:00
< / 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 %}
2021-06-10 12:17:53 +00:00
< script src = "{% static 'js/sortable.min.js' %}" > < / script >
< script src = "{% static 'js/filter-table.js' %}" > < / script >
< script src = "{% static 'js/ace/ace.js' %}" > < / script >
2019-07-31 08:03:48 +00:00
< script >
2021-06-10 12:17:53 +00:00
var editor = ace.edit("editor");
2018-09-21 13:50:44 +00:00
editor.getSession().setMode("ace/mode/xml");
var input = $('input[name="nwfilter_xml"]');
editor.getSession().on("change",function () {
input.val(editor.getSession().getValue());
})
< / script >
{% endblock %}