home.html 6.88 KB
Newer Older
Kálmán Viktor committed
1
{% load i18n %}
2
{% load arrowfilter %}
3 4
<div class="row">
  <div class="col-md-4">
5
    <dl id="home_name_and_description">
6
      <dt>{% trans "System" %}:</dt>
7
      <dd><i class="fa fa-{{ os_type_icon }}"></i> {{ instance.system }}</dd>
8 9
      <dt style="margin-top: 5px;">
        {% trans "Name" %}:
10 11 12
        {% if is_operator %}
          <a href="#" class="vm-details-home-edit-name-click"><i class="fa fa-pencil"></i></a>
        {% endif %}
13 14 15 16 17 18 19 20 21 22 23
      </dt>
      <dd>
        <div class="vm-details-home-edit-name-click">
          <small class="vm-details-home-edit-name">{{ instance.name }}</small>
        </div>
        <div class="js-hidden vm-details-home-rename-form-div" id="vm-details-home-rename">
          <form method="POST">
            {% csrf_token %}
            <div class="input-group">
              <input type="text" name="new_name" value="{{ instance.name }}" class="form-control input-sm"/>
              <span class="input-group-btn">
24 25 26
                <button type="submit" class="btn btn-success btn-sm vm-details-rename-submit
                  {% if not is_operator %}disabled{% endif %}" title="{% trans "Rename" %}">
                  <i class="fa fa-pencil"></i>
27 28 29 30 31 32 33
                </button>
              </span>
            </div>
          </form>
        </div>
      </dd>
      <dt style="margin-top: 5px;">
34
        {% trans "Description" %}:
35 36 37
        {% if is_operator %}
          <a href="#" class="vm-details-home-edit-description-click"><i class="fa fa-pencil"></i></a>
        {% endif %}
38 39 40 41
      </dt>
      <dd>
        {% csrf_token %}
        <div class="vm-details-home-edit-description-click">
42
          <div class="vm-details-home-edit-description">{{ instance.description|linebreaks }}</div>
43 44 45 46
        </div>
        <div id="vm-details-home-description" class="js-hidden">
          <form method="POST">
            <textarea name="new_description" class="form-control">{{ instance.description }}</textarea>
47 48
            <button type="submit" class="btn btn-xs btn-success vm-details-description-submit
              {% if not is_operator %}disabled{% endif %}">
49
              <i class="fa fa-pencil"></i> {% trans "Update" %}
50 51 52 53
            </button>
          </form>
        </div>
      </dd>
54
    </dl>
Kálmán Viktor committed
55

56 57 58 59 60 61
    <div id="home_expiration_and_lease">
      <h4>
        {% trans "Expiration" %}
        {% if instance.is_expiring %}<i class="fa fa-warning-sign text-danger"></i>{% endif %}
        <span id="vm-details-renew-op">
          {% with op=op.renew %}{% if op %}
62 63
            <a href="{{op.get_url}}" class="btn btn-xs operation operation-{{ op.op }}
              {% if op.disabled %}btn-default disabled{% else %}btn-{{op.effect}}{% endif %}">
64
              <i class="fa fa-{{op.icon}}"></i>
65 66
              {{op.name}}
            </a>
67
          {% endif %}{% endwith %}
68
        </span>
69 70 71 72 73
      </h4>
      <dl>
        <dt>{% trans "Suspended at:" %}</dt>
        <dd>
          <span title="{{ instance.time_of_suspend }}">
74
            <i class="fa fa-moon-o"></i> {{ instance.time_of_suspend|arrowfilter:LANGUAGE_CODE }}
75 76 77 78 79
          </span>
        </dd>
        <dt>{% trans "Destroyed at:" %}</dt>
        <dd>
          <span title="{{ instance.time_of_delete }}">
80
            <i class="fa fa-times"></i> {{ instance.time_of_delete|arrowfilter:LANGUAGE_CODE }}
81 82 83 84
          </span>
        </dd>
      </dl>
    </div>
85

Kálmán Viktor committed
86 87 88 89 90 91 92
    <div style="font-weight: bold;">{% trans "Tags" %}</div>
    <div id="vm-details-tags" style="margin-bottom: 20px;">
      <div id="vm-details-tags-list">
        {% if instance.tags.all %}
          {% for t in instance.tags.all %}
            <div class="label label-primary label-tag" style="display: inline-block">
              {{ t }}
93 94 95
              {% if is_operator %}
                <a href="#" class="vm-details-remove-tag"><i class="fa fa-times"></i></a>
              {% endif %}
Kálmán Viktor committed
96 97 98
            </div>
          {% endfor %}
        {% else %}
99
          <small>{% trans "No tag added." %}</small>
Kálmán Viktor committed
100 101 102 103 104 105 106
        {% endif %}
      </div>
      <form action="" method="POST">
        {% csrf_token %}
        <div class="input-group" id="vm-details-tags-form">
          <input type="text" class="form-control input-sm input-tags" name="new_tag" id="vm-details-tags-input"/>
          <!--<div class="input-group-addon">
107
            <i class="fa fa-question"></i>
Kálmán Viktor committed
108 109
          </div>-->
          <div class="input-group-btn">
110 111
            <input type="submit" class="btn btn-default btn-sm input-tags
            {% if not is_operator %}disabled{% endif %}" value="{% trans "Add tag" %}"/>
Kálmán Viktor committed
112 113 114 115
          </div>
        </div>
      </form>
    </div><!-- id:vm-details-tags -->
116 117
    {% if request.user.is_superuser %}
    <dl>
118
      <dt>{% trans "Node" %}:</dt>
119
      <dd>
120 121 122 123 124 125 126
        {% if instance.node %}
          <a href="{{ instance.node.get_absolute_url }}">
            {{ instance.node.name }}
          </a>
        {% else %}
          -
        {% endif %}
127 128
      </dd>
    {% endif %}
129
    </dl>
130 131 132 133
    <dl>
      <dt>{% trans "Template" %}:</dt>
      <dd>
        {% if instance.template %}
134 135 136 137 138 139 140
          {% if can_link_template %}
          <a href="{{ instance.template.get_absolute_url }}">
            {{ instance.template.name }}
          </a>
          {% else %}
            {{ instance.template.name }}
          {% endif %}
141 142 143 144 145
        {% else %}
          -
        {% endif %}
      </dd>
    </dl>
146 147

    {% if op.mount_store %}
148 149 150 151 152 153 154 155 156 157 158 159 160
      <dl>
        <dt>{% trans "Store" %}</dt>
        <dd>{{ op.mount_store.description }}</dd>
        <dd>
          <div class="operation-wrapper">
            <a href="{{ op.mount_store.get_url }}" class="btn btn-info btn-xs operation"
            {% if op.mount_store.disabled %}disabled{% endif %}>
              <i class="fa fa-{{op.mount_store.icon}}"></i>
              {{ op.mount_store.name }}
            </a>
          </div>
        </dd>
      </dl>
161
    {% endif %}
162
    {% if op.install_keys %}
163 164 165 166 167 168 169 170 171 172 173 174 175
      <dl>
        <dt>{% trans "SSH keys" %}</dt>
        <dd>{{ op.install_keys.description }}</dd>
        <dd>
          <div class="operation-wrapper">
            <a href="{{ op.install_keys.get_url }}" class="btn btn-info btn-xs operation"
            {% if op.install_keys.disabled %}disabled{% endif %}>
              <i class="fa fa-{{op.install_keys.icon}}"></i>
              {{ op.install_keys.name }}
            </a>
          </div>
        </dd>
      </dl>
176
    {% endif %}
177 178
  </div>
  <div class="col-md-8">
179
    {% if graphite_enabled %}
180 181 182
    <div class="text-center graph-buttons">
      {% include "dashboard/_graph-time-buttons.html" %}
    </div>
Kálmán Viktor committed
183
    <div class="graph-images text-center">
184 185 186 187 188 189
      <img src="{% url "dashboard.views.vm-graph" instance.pk "cpu" graph_time %}"
       alt="{% trans "CPU usage" %}"/>
      <img src="{% url "dashboard.views.vm-graph" instance.pk "memory" graph_time %}"
       alt="{% trans "Memory usage" %}"/>
      <img src="{% url "dashboard.views.vm-graph" instance.pk "network" graph_time %}"
       alt="{% trans "Network usage" %}"/>
190
    </div>
191
    {% endif %}
192 193
  </div>
</div>