network.html 5.17 KB
Newer Older
1
{% load i18n %}
2
{% load network_tags %}
3
<h2>
4 5 6 7 8 9 10
    <div id="vm-details-add-interface">
    {% with op=op.add_interface %}{% if op %}
    <a href="{{op.get_url}}" class="btn btn-{{op.effect}} operation pull-right"
        {% if op.disabled %}disabled{% endif %}>
    <i class="fa fa-{{op.icon}}"></i> {% trans "add interface" %}</a>
    {% endif %}{% endwith %}
    </div>
Őry Máté committed
11
  {% trans "Interfaces" %}
12
</h2>
13

14

15
{% for i in instance.interface_set.all %}
16
<div>
17
  <h3 class="list-group-item-heading dashboard-vm-details-network-h3">
18
    <i class="fa fa-{% if i.host %}globe{% else %}link{% endif %}"></i> {{ i.vlan.name }}
19
    {% if not i.host%}({% trans "unmanaged" %}){% endif %}
20
    {% if user.is_superuser %}
21
      <a href="{{ i.host.get_absolute_url }}"
22 23
        class="btn btn-default btn-xs">{% trans "edit" %}</a>
    {% endif %}
24 25 26 27 28 29 30
    {% if is_owner %}
      <a href="{% url "dashboard.views.interface-delete" pk=i.pk %}?next={{ request.path }}"
        class="btn btn-danger btn-xs interface-remove"
        data-interface-pk="{{ i.pk }}">
        {% trans "remove" %}
      </a>
    {% endif %}
31 32
  </h3>
  {% if i.host %}
33 34 35
    <div class="row">
      <div class="col-md-5">
        <dl>
36 37 38 39 40 41 42
          <dt>{% trans "IPv4 address" %}:</dt> <dd>{{ i.host.ipv4 }}</dd>
          <dt>{% trans "IPv6 address" %}:</dt> <dd>{{ i.host.ipv6 }}</dd>
          <dt>{% trans "DNS name" %}:</dt> <dd>{{ i.host.get_fqdn }}</dd>
          <dt>{% trans "Groups" %}:</dt>
          <dd>
          {% for g in i.host.groups.all %}
            {{ g }}{% if not forloop.last %},{% endif %}
43 44
            {% empty %}
            -
45 46
          {% endfor %}
          </dd>
47 48 49 50
        </dl>
      </div>
      <div class="col-md-7">
        <ul class="nav nav-pills pull-right">
Őry Máté committed
51 52
          <li class="active"><a href="#ipv4_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">{% trans "IPv4" %}</a></li>
          <li><a href="#ipv6_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">{% trans "IPv6" %}</a></li>
53
        </ul>
Őry Máté committed
54
        <h4>{% trans "Port access" %}</h4>
55
        <div class="tab-content" style="padding-top: 10px;">
56
          <div class="tab-pane active" id="ipv4_{{ i.host.vlan.pk }}">
57 58 59
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
60 61
                  <i class="fa fa-globe fa-2x"></i>
                  <i class="fa fa-long-arrow-right fa-2x"></i>
62
                  </th><th>
63
                  <i class="fa fa-shield fa-2x"></i>
64
                  </th><th colspan="2">
65 66
                  <i class="fa fa-long-arrow-right fa-2x"></i>
                  <i class="fa fa-desktop fa-2x"></i>
67 68 69
                </th></tr>
              </thead>
              <tbody>
70 71 72 73
                {% for l in i.host.list_ports %}
                  {% if l.ipv4 %}
                    <tr>
                      <td>
74
                        {% display_portforward4 l %}
75
                      </td>
76
                      <td><i class="fa fa-long-arrow-right"></i></td>
77
                      <td>
78 79 80
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
81
                        <a href="{% url "dashboard.views.remove-port" pk=instance.pk rule=l.ipv4.pk %}" class="btn btn-link btn-xs vm-details-remove-port" data-rule="{{ l.ipv4.pk }}" title="{% trans "Remove" %}"><i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i></a>
82 83 84 85
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
86 87 88
              </tbody>
            </table>
          </div> <!-- /ipv4 -->
89
          <div class="tab-pane" id="ipv6_{{ i.host.vlan.pk }}">
90
            {% if i.host.ipv6 %}
91 92 93
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
94
                  <i class="fa fa-globe fa-2x"></i>
95
                </th><th>
96
                  <i class="fa fa-long-arrow-right fa-2x"></i>
97
                </th><th colspan="2">
98
                  <i class="fa fa-desktop fa-2x"></i>
99 100 101
                </th></tr>
              </thead>
              <tbody>
102 103 104 105
                {% for l in i.host.list_ports %}
                  {% if l.ipv6 %}
                    <tr>
                      <td>
106
                        {% display_portforward6 l %}
107
                      </td>
108
                      <td><i class="fa fa-long-arrow-right"></i></td>
109
                      <td>
110 111 112
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
113
                        <a href="{% url "dashboard.views.remove-port" pk=instance.pk rule=l.ipv4.pk %}" class="btn btn-link btn-xs vm-details-remove-port" data-rule="{{ l.ipv6.pk }}" title="{% trans "Remove" %}"><i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i></a>
114 115 116 117
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
118 119
              </tbody>
            </table>
120 121 122 123
            {% else %}
              <h4>{% trans "This VM doesn't have an IPv6 address!" %}</h4>
            {% endif %}
          </div><!-- /ipv6 -->
124
          {% include "dashboard/vm-detail/_network-port-add.html" %}
125 126 127
        </div>
      </div>
    </div>
128
  {% endif %}
129
</div>
130
{% endfor %}