network.html 4.34 KB
Newer Older
1 2 3 4 5
{% load i18n %}
<h2><a href="#" class="btn btn-success pull-right"><i class="icon-plus"></i> add interface</a>

Interfaces</h2>

6 7 8 9 10 11
{% for i in instance.interface_set.all %}
  <h3 class="list-group-item-heading">
    <i class="icon-{% if i.host %}globe{% else %}link{% endif %}"></i> {{ i.vlan }} 
    {% if not i.host %}(unmanaged) <a href="#" class="btn btn-danger btn-xs">remove</a>{% endif %}
  </h3>
  {% if i.host %}
12 13 14
    <div class="row">
      <div class="col-md-5">
        <dl>
15 16 17 18 19 20 21 22 23
          <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 %}
          {% endfor %}
          </dd>
24 25 26 27 28 29 30 31
        </dl>
      </div>
      <div class="col-md-7">
        <ul class="nav nav-pills pull-right">
          <li class="active"><a href="#ipv4" data-toggle="pill" class="text-center">IPv4</a></li>
          <li><a href="#ipv6" data-toggle="pill" class="text-center">IPv6</a></li>
        </ul>
        <h4>Port access</h4>
32
        <div class="tab-content" style="padding-top: 10px;">
33 34 35 36 37 38 39 40 41 42 43 44 45 46
          <div class="tab-pane active" id="ipv4">
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
                  <i class="icon-globe icon-2x"></i>
                  <i class="icon-long-arrow-right icon-2x"></i>
                  </th><th>
                  <i class="icon-shield icon-2x"></i>
                  </th><th colspan="2">
                  <i class="icon-long-arrow-right icon-2x"></i>
                  <i class="icon-desktop icon-2x"></i>
                </th></tr>
              </thead>
              <tbody>
47 48 49 50 51 52
                {% for l in i.host.list_ports %}
                  {% if l.ipv4 %}
                    <tr>
                      <td>
                        {{ l.ipv4.host }}:{{ l.ipv4.port }}
                      </td>
53 54
                      <td><i class="icon-long-arrow-right"></i></td>
                      <td>
55 56 57
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
58
                        <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="icon-remove"><span class="sr-only">{% trans "Remove" %}</span></i></a>
59 60 61 62
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
63 64 65 66
              </tbody>
            </table>
          </div> <!-- /ipv4 -->
          <div class="tab-pane" id="ipv6">
67
            {% if i.host.ipv6 %} 
68 69 70 71 72 73 74 75 76 77 78
            <table class="table table-striped rule-table">
              <thead>
                <tr><th>
                  <i class="icon-globe icon-2x"></i>
                </th><th>
                  <i class="icon-long-arrow-right icon-2x"></i>
                </th><th colspan="2">
                  <i class="icon-desktop icon-2x"></i>
                </th></tr>
              </thead>
              <tbody>
79 80 81 82 83 84
                {% for l in i.host.list_ports %}
                  {% if l.ipv6 %}
                    <tr>
                      <td>
                        {{ l.ipv6.host }}:{{ l.ipv6.port }}
                      </td>
85 86
                      <td><i class="icon-long-arrow-right"></i></td>
                      <td>
87 88 89
                        {{ l.private }}/{{ l.proto }}
                      </td>
                      <td>
90
                        <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="icon-remove"><span class="sr-only">{% trans "Remove" %}</span></i></a>
91 92 93 94
                      </td>
                    </tr>
                  {% endif %}
                {% endfor %}
95 96
              </tbody>
            </table>
97 98 99 100
            {% else %}
              <h4>{% trans "This VM doesn't have an IPv6 address!" %}</h4>
            {% endif %}
          </div><!-- /ipv6 -->
101
          {% include "dashboard/vm-detail/network-port-add.html" %}
102 103 104
        </div>
      </div>
    </div>
105 106
  {% endif %}
{% endfor %}