network.html 5.83 KB
Newer Older
1
{% load i18n %}
2
{% load network_tags %}
3 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>
11
<h2>
Őry Máté committed
12
  {% trans "Interfaces" %}
13
</h2>
14

15

16
{% for i in instance.interface_set.all %}
17
<div>
18
  <h3 class="list-group-item-heading dashboard-vm-details-network-h3">
19
    <i class="fa fa-{% if i.host %}globe{% else %}link{% endif %}"></i> {{ i.vlan.name }}
20
    {% if not i.host%}({% trans "unmanaged" %}){% endif %}
21
    {% if user.is_superuser and i.host %}
22
      <a href="{{ i.host.get_absolute_url }}"
23 24
        class="btn btn-default btn-xs">{% trans "edit" %}</a>
    {% endif %}
25 26 27 28 29
    {% with op=op.remove_interface %}{% if op %}
    <span class="operation-wrapper">
      <a href="{{op.get_url}}?interface={{ i.pk }}"
         class="btn btn-{{op.effect}} btn-xs operation interface-remove"
         {% if op.disabled %}disabled{% endif %}>{% trans "remove" %}
30
      </a>
31 32
    </span>
    {% endif %}{% endwith %}
33 34
  </h3>
  {% if i.host %}
35 36 37
    <div class="row">
      <div class="col-md-5">
        <dl>
38 39
          <dt>{% trans "IPv4 address" %}:</dt> <dd>{{ i.host.ipv4 }}</dd>
          <dt>{% trans "IPv6 address" %}:</dt> <dd>{{ i.host.ipv6 }}</dd>
40 41 42
          {% if request.user.is_superuser %}
          <dt>{% trans "MAC address" %}:</dt> <dd>{{ i.host.mac }}</dd>
          {% endif %}
43 44 45 46 47
          <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 %}
48 49
            {% empty %}
            -
50 51
          {% endfor %}
          </dd>
52 53 54 55
        </dl>
      </div>
      <div class="col-md-7">
        <ul class="nav nav-pills pull-right">
Őry Máté committed
56 57
          <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>
58
        </ul>
Őry Máté committed
59
        <h4>{% trans "Port access" %}</h4>
60
        <div class="tab-content" style="padding-top: 10px;">
61
          <div class="tab-pane active" id="ipv4_{{ i.host.vlan.pk }}">
62 63 64
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
65 66
                  <i class="fa fa-globe fa-2x"></i>
                  <i class="fa fa-long-arrow-right fa-2x"></i>
67
                  </th><th>
68
                  <i class="fa fa-shield fa-2x"></i>
69
                  </th><th colspan="2">
70 71
                  <i class="fa fa-long-arrow-right fa-2x"></i>
                  <i class="fa fa-desktop fa-2x"></i>
72 73 74
                </th></tr>
              </thead>
              <tbody>
75 76 77 78
                {% for l in i.host.list_ports %}
                  {% if l.ipv4 %}
                    <tr>
                      <td>
79 80 81
                        {% autoescape off %}
                          {% display_portforward4 l %}
                        {% endautoescape %}
82
                      </td>
83
                      <td><i class="fa fa-long-arrow-right"></i></td>
84
                      <td>
85 86 87
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
Bach Dániel committed
88 89 90
                        <span class="operation-wrapper">
                          <a href="{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
                             class="btn btn-link btn-xs operation"
91 92
                             title="{% trans "Remove" %}"
                             {% if not op.remove_port %}disabled{% endif %}>
Bach Dániel committed
93 94 95
                            <i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i>
                          </a>
                        </span>
96 97 98 99
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
100 101 102
              </tbody>
            </table>
          </div> <!-- /ipv4 -->
103
          <div class="tab-pane" id="ipv6_{{ i.host.vlan.pk }}">
104
            {% if i.host.ipv6 %}
105 106 107
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
108
                  <i class="fa fa-globe fa-2x"></i>
109
                </th><th>
110
                  <i class="fa fa-long-arrow-right fa-2x"></i>
111
                </th><th colspan="2">
112
                  <i class="fa fa-desktop fa-2x"></i>
113 114 115
                </th></tr>
              </thead>
              <tbody>
116 117 118 119
                {% for l in i.host.list_ports %}
                  {% if l.ipv6 %}
                    <tr>
                      <td>
Chif Gergő committed
120 121 122
                        {% autoescape off %}
                          {% display_portforward6 l %}
                        {% endautoescape %}
123
                      </td>
124
                      <td><i class="fa fa-long-arrow-right"></i></td>
125
                      <td>
126 127 128
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
129 130 131
                        <a href="{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}" class="btn btn-link btn-xs vm-details-remove-port" data-rule="{{ l.ipv6.pk }}" title="{% trans "Remove" %}" {% if not op.remove_port %}disabled{% endif %}>
                          <i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i>
                        </a>
132 133 134 135
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
136 137
              </tbody>
            </table>
138 139 140 141
            {% else %}
              <h4>{% trans "This VM doesn't have an IPv6 address!" %}</h4>
            {% endif %}
          </div><!-- /ipv6 -->
142
          {% include "dashboard/vm-detail/_network-port-add.html" %}
143 144 145
        </div>
      </div>
    </div>
146
  {% endif %}
147
</div>
148
{% endfor %}