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

5 6
<form id="vm-details-resources-form" method="POST" action="">
  {% csrf_token %}
7 8
<p class="row">
    <div class="col-sm-3">
9
      <label for="vm-cpu-priority-slider"><i class="icon-trophy"></i> {% trans "CPU priority" %}</label>
10 11
    </div>
    <div class="col-sm-9">
12
      <input name="cpu-priority" type="text" id="vm-cpu-priority-slider" class="vm-slider" value="{{ instance.priority }}" data-slider-min="0" data-slider-max="100" data-slider-step="1" data-slider-value="{{ instance.priority }}" data-slider-orientation="horizontal" data-slider-handle="square" data-slider-tooltip="hide"/>         
13 14 15 16 17 18
    </div>
</p>


<p class="row">
    <div class="col-sm-3">
19
      <label for="cpu-count-slider"><i class="icon-cogs"></i> {% trans "CPU count" %}</label>
20 21
    </div>
    <div class="col-sm-9">
22
      <input name="cpu-count" type="text" id="vm-cpu-count-slider" class="vm-slider" value=" {{ instance.num_cores }}" data-slider-min="0" data-slider-max="8" data-slider-step="1" data-slider-value="{{ instance.num_cores }}" data-slider-orientation="horizontal" data-slider-handle="square" data-slider-tooltip="hide"/>         
23 24 25 26 27 28
    </div>
</p>


<p class="row">
    <div class="col-sm-3">
29
      <label for="ram-slider"><i class="icon-ticket"></i> {% trans "RAM amount" %}</label>
30
    </div>
31
    <div class="col-sm-9"> 
32
      <input name="ram-size" type="text" id="vm-ram-size-slider" class="vm-slider" value="{{ instance.ram_size }}" data-slider-min="128" data-slider-max="4096" data-slider-step="128" data-slider-value="{{ instance.ram_size }}" data-slider-orientation="horizontal" data-slider-handle="square" data-slider-tooltip="hide"/>         MiB  
33
  </div>
34 35
</p>

36
{% if can_change_resources %}
37 38
<p class="row">
  <div class="col-sm-12">
39 40 41 42 43
    <button type="submit" class="btn btn-success btn-sm enabled-when-stopped" id="vm-details-resources-save"
      data-vm="{{ instance.pk }}"
      {% if not op.resources_change %}disabled{% endif %}>
      <i class="icon-save"></i> {% trans "Save resources" %}
    </button>
44 45 46
    <span class="hide-when-stopped"
      {% if op.resources_change %}style="display: none;"{% endif %}
      >{% trans "Stop your VM to change resources." %}</span>
47 48
  </div>
</p>
49
{% endif %}
50
</form>
51 52 53

<hr />

54
<div class="row" id="vm-details-resources-disk">
55 56 57 58
  <div class="col-sm-11">
    <h3>
      {% trans "Disks" %}
      <div class="pull-right">
59 60 61
        <div id="disk-ops">
          {% include "dashboard/vm-detail/_disk-operations.html" %}
        </div> 
62 63 64
      </div>
    </h3>

65 66 67 68 69
    <div class="row" id="vm-details-disk-add-for-form"></div>

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

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
{% if user.is_superuser %}
<hr/>

<div class="row" id="">
  <div class="col-sm-12">
    <h3>
      {% trans "Required traits" %}
    </h3>

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

<hr/>

<div class="row" id="">
  <div class="col-sm-12">
    <h3>
      {% trans "Raw data" %}
    </h3>

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

{% endif %}
106

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