index_portlist.html 2.74 KB
Newer Older
Laouen Fernet's avatar
Laouen Fernet committed
1
{% extends 'machines/sidebar.html' %}
2 3 4

{% load bootstrap3 %}

5
{% load acl %}
6
{% load i18n %}
7

8
{% block title %}{% trans "Machines" %}{% endblock %}
9 10

{% block content %}
erdnaxe's avatar
erdnaxe committed
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
    <h2>{% trans "List of ports configurations" %}</h2>
    {% can_create OuverturePortList %}
        <a class="btn btn-primary btn-sm" role="button" href="{% url 'machines:add-portlist' %}">
            <i class="fa fa-plus"></i>{% trans " Add a configuration" %}
        </a>
    {% acl_end %}
    <table class="table table-striped">
        <thead>
        <tr>
            <th>{% trans "Name" %}</th>
            <th>{% trans "TCP (input)" %}</th>
            <th>{% trans "TCP (output)" %}</th>
            <th>{% trans "UDP (input)" %}</th>
            <th>{% trans "UDP (output)" %}</th>
            <th>{% trans "Machines" %}</th>
            <th></th>
        </tr>
        </thead>
        {% for pl in port_list %}
            <tr>
                <td>{{ pl.name }}</td>
                <td>{% for p in pl.tcp_ports_in %}{{ p.show_port }}, {% endfor %}</td>
                <td>{% for p in pl.tcp_ports_out %}{{ p.show_port }}, {% endfor %}</td>
                <td>{% for p in pl.udp_ports_in %}{{ p.show_port }}, {% endfor %}</td>
                <td>{% for p in pl.udp_ports_out %}{{ p.show_port }}, {% endfor %}</td>
                <td>
                    {% if pl.interface_set.all %}
                        <div class="dropdown">
                            <button class="btn btn-default dropdown-toggle" type="button" id="editioninterface"
                                    data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                                <span class="caret"></span>
                            </button>
                            <ul class="dropdown-menu" aria-labelledby="editioninterface">
                                {% for interface in pl.interface_set.all %}
                                    <li>
                                        <a href="{% url 'users:profil' userid=interface.machine.user.id %}">
                                            {{ interface }}
                                        </a>
                                    </li>
                                {% endfor %}
                            </ul>
                        </div>
                    {% endif %}
                <td class="text-right">
                    {% can_edit pl %}
                    {% include 'buttons/edit.html' with href='machines:edit-portlist' id=pl.id %}
                    {% acl_end %}
                    {% can_delete pl %}
                    {% include 'buttons/suppr.html' with href='machines:del-portlist' id=pl.id %}
                    {% acl_end %}
                </td>
            </tr>
        {% endfor %}
    </table>
65
{% endblock %}