network.html 5.35 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
    {% 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" %}
29
      </a>
30 31
    </span>
    {% endif %}{% endwith %}
32 33
  </h3>
  {% if i.host %}
34 35 36
    <div class="row">
      <div class="col-md-5">
        <dl>
37 38 39 40 41 42 43
          <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 %}
44 45
            {% empty %}
            -
46 47
          {% endfor %}
          </dd>
48 49 50 51
        </dl>
      </div>
      <div class="col-md-7">
        <ul class="nav nav-pills pull-right">
Őry Máté committed
52 53
          <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>
54
        </ul>
Őry Máté committed
55
        <h4>{% trans "Port access" %}</h4>
56
        <div class="tab-content" style="padding-top: 10px;">
57
          <div class="tab-pane active" id="ipv4_{{ i.host.vlan.pk }}">
58 59 60
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
61 62
                  <i class="fa fa-globe fa-2x"></i>
                  <i class="fa fa-long-arrow-right fa-2x"></i>
63
                  </th><th>
64
                  <i class="fa fa-shield fa-2x"></i>
65
                  </th><th colspan="2">
66 67
                  <i class="fa fa-long-arrow-right fa-2x"></i>
                  <i class="fa fa-desktop fa-2x"></i>
68 69 70
                </th></tr>
              </thead>
              <tbody>
71 72 73 74
                {% for l in i.host.list_ports %}
                  {% if l.ipv4 %}
                    <tr>
                      <td>
75
                        {% display_portforward4 l %}
76
                      </td>
77
                      <td><i class="fa fa-long-arrow-right"></i></td>
78
                      <td>
79 80 81
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
Bach Dániel committed
82 83 84 85 86 87 88
                        <span class="operation-wrapper">
                          <a href="{{ op.remove_port.get_url }}?rule={{ l.ipv4.pk }}"
                             class="btn btn-link btn-xs operation"
                             title="{% trans "Remove" %}">
                            <i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i>
                          </a>
                        </span>
89 90 91 92
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
93 94 95
              </tbody>
            </table>
          </div> <!-- /ipv4 -->
96
          <div class="tab-pane" id="ipv6_{{ i.host.vlan.pk }}">
97
            {% if i.host.ipv6 %}
98 99 100
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
101
                  <i class="fa fa-globe fa-2x"></i>
102
                </th><th>
103
                  <i class="fa fa-long-arrow-right fa-2x"></i>
104
                </th><th colspan="2">
105
                  <i class="fa fa-desktop fa-2x"></i>
106 107 108
                </th></tr>
              </thead>
              <tbody>
109 110 111 112
                {% for l in i.host.list_ports %}
                  {% if l.ipv6 %}
                    <tr>
                      <td>
113
                        {% display_portforward6 l %}
114
                      </td>
115
                      <td><i class="fa fa-long-arrow-right"></i></td>
116
                      <td>
117 118 119
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
120
                        <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" %}"><i class="fa fa-times"><span class="sr-only">{% trans "Remove" %}</span></i></a>
121 122 123 124
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
125 126
              </tbody>
            </table>
127 128 129 130
            {% else %}
              <h4>{% trans "This VM doesn't have an IPv6 address!" %}</h4>
            {% endif %}
          </div><!-- /ipv6 -->
131
          {% include "dashboard/vm-detail/_network-port-add.html" %}
132 133 134
        </div>
      </div>
    </div>
135
  {% endif %}
136
</div>
137
{% endfor %}