detail.html 4.75 KB
Newer Older
1 2 3 4
{% extends "dashboard/base.html" %}
{% load staticfiles %}
{% load i18n %}
{% load render_table from django_tables2 %}
5
{% load arrowfilter %}
6

7
{% block title-page %}{% trans "Request" %}{% endblock %}
8 9 10 11 12 13 14 15 16 17 18

{% block content %}

<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default">
      <div class="panel-heading">
        <a href="{% url "request.views.request-list" %}" class="btn btn-default btn-xs pull-right">
          {% trans "Back" %}
        </a>
        <h3 class="no-margin">
19
          <i class="fa fa-{{ object.get_request_icon }}"></i>
20
          {{ object.get_readable_type|capfirst }}
21 22 23 24
        </h3>
      </div>
      <div class="panel-body">
        <div class="label label-{{ object.get_effect }} pull-right" style="font-size: 1.5em; margin-top: 10px;">
25
          <i class="fa fa-{{ object.get_status_icon }}"></i>
26 27 28 29
          {{ object.get_readable_status|upper }}
        </div>
        <p>
          <img src="{{ object.user.profile.get_avatar_url }}" width="50" height="50"/>
30
          <a href="{{ object.user.profile.get_absolute_url }}">
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
            {{ object.user.profile.get_display_name }}
          </a>
        </p>
        <p>
          <pre>{{ object.reason }}</pre>
        </p>
        <hr />
        {% if object.type == "lease" %}
          <dl>
            <dt>{% trans "VM name" %}</dt>
            <dd><a href="{{ action.instance.get_absolute_url }}">{{ action.instance.name }}</a></dd>
            <dt>{% trans "VM description" %}</dt>
            <dd>{{ action.instance.description }}</dd>
            <dt>{% trans "Current Lease" %}</dt>
            <dd>{{ action.instance.lease }}</dd>
            <dt>{% trans "Requested Lease" %}</dt>
            <dd>{{ action.lease_type.lease }}</dd>
          </dl>
        {% elif object.type == "template" %}
          <dl>
            <dt>
              {% trans "Template type" %}:
              <span style="font-weight: normal;">{{ action.template_type.name }}</span>
            </dt>
            <dd>
              <ul>
                {% for t in action.template_type.templates.all %}
                  <li><a href="{{ t.get_absolute_url }}">{{ t }}</a></li>
                {% endfor %}
              </ul>
            </dd>
            <dt>{% trans "Level" %}<dt>
            <dd>{{ action.get_readable_level }}</dd>
          </dl>
        {% elif object.type == "resource" %}
          <dl>
            <dt>{% trans "VM name" %}</dt>
            <dd><a href="{{ action.instance.get_absolute_url }}">{{ action.instance.name }}</a></dd>
69 70 71 72 73
            <dt>{% trans "Status" %}</dt>
            <dd>
              <i class="fa {{ action.instance.get_status_icon }}"></i>
              {{ action.instance.get_status_display|upper }}
            </dd>
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
            <dt>{% trans "VM description" %}</dt>
            <dd>{{ action.instance.description }}</dd>
            <dt>
              {% trans "Priority" %}
              <span class="text-muted" style="font-weight: normal;">{% trans "(old values in parentheses)" %}</span>
            </dt>
            <dd>{{ action.priority }} ({{ action.instance.priority }})</dd>
            <dt>{% trans "Number of cores" %}</dt>
            <dd>{{ action.num_cores }} ({{ action.instance.num_cores }})</dd>
            <dt>{% trans "Ram size" %}</dt>
            <dd>{{ action.ram_size }} ({{ action.instance.ram_size }}) MiB</dd>
          </dl>
        {% else %}
          hacks!!!
        {% endif %}

90 91 92 93 94 95 96 97
        {% if object.status == "PENDING" %}
          <hr />

          <div class="pull-right">
            <form method="POST" style="display: inline;">
              {% csrf_token %}
              <button class="btn btn-danger" type="submit">
                <i class="fa fa-thumbs-down"></i>
98
                {% trans "Decline" %}
99 100
              </button>
            </form>
101 102 103 104
            {{ acceptable_statuses }}
            {% if object.type == "resource" and action.instance.status not in accept_states %}
              {% trans "You can't accept this request because of the VM's state." %}
            {% else %}
105 106 107 108 109
            <form method="POST" style="display: inline;">
              {% csrf_token %}
              <input type="hidden" name="accept" value="1"/>
              <button class="btn btn-success">
                <i class="fa fa-thumbs-up"></i>
110
                {% trans "Accept" %}
111 112
              </button>
            </form>
113
            {% endif %}
114 115
          </div>
        {% else %}
116
          <div class="text-right">
117 118
            {% blocktrans with closed=object.modified|arrowfilter:LANGUAGE_CODE user=object.closed_by.profile.get_display_name %}
            Closed {{ closed }} by <a href="{{ user.profile.get_absolute_url }}">{{ user }}</a>
119 120
            {% endblocktrans %}
          </div>
121
        {% endif %}
122 123 124 125 126
      </div><!-- .panel-body -->
    </div>
  </div>
</div>
{% endblock %}