resources.html 3.15 KB
Newer Older
1
{% load i18n %}
2
{% load sizefieldtags %}
3
{% load crispy_forms_tags %}
4

5 6 7 8

<div class="label label-info label-100" id="modify-the-resources">
  {% trans "Modify the resources" %}
</div>
9 10
<form method="POST" action="{{ op.resources_change.get_url }}" id="vm-details-resources-form">
  {% csrf_token %}
11
  {% include "dashboard/_resources-sliders.html" with field_priority=resources_form.priority field_num_cores=resources_form.num_cores field_ram_size=resources_form.ram_size %}
12

13
{% if op.resources_change %}
14 15
  <button type="submit" class="btn btn-success btn-sm change-resources-button"
    id="vm-details-resources-save" data-vm="{{ instance.pk }}"
16
    {% if not save_resources_enabled %}disabled{% endif %}>
17 18 19
    <i class="fa fa-floppy-o"></i> {% trans "Save resources" %}
  </button>
  <span class="change-resources-help"
20
    {% if save_resources_enabled %}style="display: none;"{% endif %}>
21 22 23 24
    {% trans "Stop your VM to change resources." %}
  </span>
{% else %}
  <div id="vm-request-resource-form">
25 26 27
    <div class="alert alert-info text-justify">
      {% trans "Changing resources is only possible on virtual machines with STOPPED state. We suggest to turn off the VM after submitting the request otherwise it will be automatically stopped in the future when the request is accepted." %}
    </div>
28
<!-- Due the new form from Gergo 
29
    <div class="form-group">
30 31
      <label>{% trans "Message" %}*</label>
      <textarea class="form-control" name="message">{% include "request/initials/resources.html" %}</textarea>
32
    </div>
33
--->
34 35 36 37 38 39
    <input type="submit" class="btn btn-success btn-sm"/>
  </div>

  <a href="{% url "request.views.request-resource" vm_pk=object.pk %}"
   class="btn btn-primary btn-sm" id="vm-request-resource">
    <i class="fa fa-tasks"></i>
40
    {% trans "Request resources" %}
41 42
  </a>

43 44
{% endif %}
</form>
45 46 47

<hr />

48 49 50 51 52
<div id="vm-details-resources-disk">
  <h3>
    <div class="pull-right">
      <div id="disk-ops">
        {% include "dashboard/vm-detail/_disk-operations.html" %}
53
      </div>
54
    </div>
55
    {% trans "Disks" %}
56
  </h3>
57
  <div class="clearfix"></div>
58 59 60 61 62 63 64 65 66 67 68

  {% if not instance.disks.all %}
    {% trans "No disks are added." %}
  {% endif %}
  {% for d in instance.disks.all %}
    <h4 class="list-group-item-heading dashboard-vm-details-network-h3">
      {% with long_remove=True %}
        {% include "dashboard/_disk-list-element.html" %}
      {% endwith %}
    </h4>
  {% endfor %}
69 70
</div>

71 72 73 74 75 76 77 78 79 80 81
<hr />
{% if instance.disks.all %}
  <div id="vm-details-resize-how-to">
    <i class="fa fa-question"></i>
    {% url "info.resize" as resize_url %}
    {% blocktrans with url=resize_url %}
    If you need help resizing the disks check out our <a href="{{ url }}">resize how-to.</a>
    {% endblocktrans %}
  </div>
{% endif %}

82 83 84
{% if user.is_superuser %}
<hr/>

85
<div class="row">
86 87 88 89 90 91 92 93 94 95 96
  <div class="col-sm-12">
    <h3>
      {% trans "Required traits" %}
    </h3>

    {% crispy traits_form %}
  </div>
</div>

<hr/>

97
<div class="row">
98 99 100 101 102 103 104 105 106 107
  <div class="col-sm-12">
    <h3>
      {% trans "Raw data" %}
    </h3>

    {% crispy raw_data_form %}
  </div>
</div>

{% endif %}
108

109 110 111
{% block extra_js %}
  <style>
    label {padding-top: 6px;}
112
    .form-group {margin-bottom: 8px;}
113 114
  </style>
{% endblock %}