template-edit.html 3.78 KB
Newer Older
1 2
{% extends "dashboard/base.html" %}
{% load i18n %}
3
{% load sizefieldtags %}
4
{% load crispy_forms_tags %}
5

6
{% block title-page %}{{ form.name.value }} | {% trans "template" %}{% endblock %}
7

8 9 10
{% block content %}

<div class="row">
11
  <div class="col-md-7">
12 13
    <div class="panel panel-default">
      <div class="panel-heading">
14
        <a class="pull-right btn btn-default btn-xs" href="{% url "dashboard.views.template-list" %}">{% trans "Back" %}</a>
15
        <h3 class="no-margin"><i class="fa fa-puzzle-piece"></i> {% trans "Edit template" %}</h3>
16 17
      </div>
      <div class="panel-body">
18
        <form action="" method="POST">
19 20 21
        {% with form=form %}
          {% include "display-form-errors.html" %}
        {% endwith %}
22 23 24 25

        {% csrf_token %}

        {{ form.name|as_crispy_field }}
26 27 28 29 30 31 32 33 34

        <strong>{% trans "Parent template" %}:</strong>
        {% if parent %}
        <a href="{% url "dashboard.views.template-detail" pk=parent.pk %}">
          {{ parent.name }}
        </a>
        {% else %}
          -
        {% endif %}
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

        <fieldset class="resources-sliders">
          <legend>{% trans "Resource configuration" %}</legend>
          {% include "dashboard/_resources-sliders.html" with field_priority=form.priority field_num_cores=form.num_cores field_ram_size=form.ram_size %}
          {{ form.max_ram_size|as_crispy_field }}
        </fieldset>

        <fieldset>
          <legend>{% trans "Virtual machine settings" %}</legend>
        {{ form.arch|as_crispy_field }}
        {{ form.access_method|as_crispy_field }}
        {{ form.boot_menu|as_crispy_field }}
        {{ form.raw_data|as_crispy_field }}
        {{ form.req_traits|as_crispy_field }}
        {{ form.description|as_crispy_field }}
        {{ form.system|as_crispy_field }}
51
        {{ form.has_agent|as_crispy_field }}
52 53 54 55 56 57 58 59 60 61 62
        </fieldset>
        <fieldset>
          <legend>{% trans "External resources" %}</legend>
        {{ form.networks|as_crispy_field }}
        {{ form.lease|as_crispy_field }}

        {{ form.tags|as_crispy_field }}
        </fieldset>

        <input type="submit" value="{% trans "Save changes" %}" class="btn btn-primary">
        </form>
63 64 65
      </div>
    </div>
  </div>
66

67
  <div class="col-md-5">
68 69
    <div class="panel panel-default">
      <div class="panel-heading">
70
        <h4 class="no-margin"><i class="fa fa-group"></i> {% trans "Manage access"  %}</h4>
71 72
      </div>
      <div class="panel-body">
73
        {% include "dashboard/_manage_access.html" with table_id="template-access-table" %}
74 75
      </div>
    </div>
76 77


78 79
    <div class="panel panel-default">
      <div class="panel-heading">
80
        <h4 class="no-margin"><i class="fa fa-file"></i> {% trans "Disk list" %}</h4>
81 82
      </div>
      <div class="panel-body">
83 84 85 86
        <ul class="template-disk-list">
        {% if not disks %}
          {% trans "No disks are added!" %}
        {% endif %}
87 88
        {% for d in disks %}
          <li>
89 90 91 92 93 94 95
            <i class="fa fa-file"></i>
            {{ d.name }} (#{{ d.id }}) -
            <a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}"
              data-disk-pk="{{ d.pk }}" class="btn btn-xs btn-danger pull-right disk-remove"
              {% if not long_remove %}title="{% trans "Remove" %}"{% endif %}>
              <i class="fa fa-times"></i>{% if long_remove %} {% trans "Remove" %}{% endif %}
            </a>
96 97 98 99 100
          </li>
        {% endfor %}
        </ul>
      </div>
    </div>
101 102
  </div><!-- .col-md-4 -->
</div><!-- .row -->
103

104

105 106 107 108 109 110 111 112
<style>
  fieldset {
    margin-top: 40px;
  }
  fieldset legend {
    font-weight: bold;
  }
</style>
113 114 115 116 117 118 119 120
{% endblock %}

{% block extra_js %}
  <script>
    $(function() {
      $("#hint_id_num_cores, #hint_id_priority, #hint_id_ram_size").hide();
    });
  </script>
121

122
  <script src="{{ STATIC_URL }}dashboard/disk-list.js"></script>
123
{% endblock %}