box.html 5.75 KB
Newer Older
1
{% extends "box/base/box.html" %}
2 3 4 5 6 7 8 9 10 11 12 13
{% load i18n %}
{% load l10n %}
{% get_current_language as LANGUAGE_CODE %}

{% block title %}
    {% trans "Virtual machines" %}
{% endblock title %}

{% block content %}
<ul class="vm-list entry-list">
    {% if instances %}
        {% for vm in instances %}
14
            {% include "box/vm/entry.html" %}
15
        {% endfor %}
16
    {% elif not just_list_vms %}
17 18 19 20 21 22 23 24 25 26
    <div class="tooltip">
        <div class="container">
            <p>{% trans "You have not started any machines yet." %}</p>
            <p>
                {% trans "Choose a template, and you can use the system in a minute." %}
            </p>
            <div class="tail"></div>
        </div>
    </div>
    {% endif %}
27
    {% if not just_list_vms %}
Dányi Bence committed
28
    <li id="new-vm-button" class="entry new small-row">
29 30 31 32 33
        <div class="summary">
            <div class="name">{% trans "Start new machine" %}</div>
            <div class="clear"></div>
        </div>
    </li>
Dányi Bence committed
34
    <li id="new-vm" style="display: none">
35 36 37 38 39
        <h2>{% trans "Available shares" %}</h2>
        <p>
            {% trans "Choose one of the following shared templates to launch." %}
        </p>
        <div class="container">
Dányi Bence committed
40
            <ul class="vm-list entry-list">
41
                {% for s in shares %}
Dányi Bence committed
42
                <li class="entry">
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 69 70 71 72 73 74 75 76 77 78 79 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
                    <div class="summary">
                        <div class="quota">
                            <div class="used" style="width:{% if s.running_shared >=  s.per_user_limit %}100%{% else %}{{ s.get_instance_pc|unlocalize }}%{% endif %}"/>
                            </div>
                        </div>
                        <div class="name wm-on">
                            {{s.name}} - {{ s.group.name }}   ({{ s.running_shared }}/{{ s.per_user_limit }})
                        </div>
                        <div class="status">{{s.get_running}}/{{s.instance_limit}}</div>
                        <div class="clear"></div>
                    </div>
                    <div class="details">
                        <div class="details-container">
                            <ul>
                                <li class="os-{{s.template.os_type}}">
                                    {% trans "System" %}:
                                    <span class="value">{{s.template.system}}</span>
                                    <div class="clear"></div>
                                </li>
                                <li class="type">
                                    {% trans "Size" %}:
                                    <span class="value">
                                        {{s.template.instance_type.name}}
                                        <span class="cpu">{{s.template.instance_type.CPU}}</span>
                                        <span class="memory">{{s.template.instance_type.RAM}}</span>
                                        <span class="credit">{{s.template.instance_type.credit}}</span>
                                    </span>
                                </li>
                                <li class="share-type">
                                    {% trans "Type" %}:
                                    <span class="value">{{s.type }}</span>
                                    ({% if s.get_type.suspend %}
                                    <span class="suspend"
                                        title="{% blocktrans with time=s.get_type.suspend %}Suspend after {{time}}.{%endblocktrans%}">
                                        {{s.get_type.suspendx|timeuntil}}
                                    </span>
                                    {%endif%}{% if s.get_type.delete %}<span class="delete"
                                        title="{% blocktrans with time=s.get_type.delete %}Delete after {{time}}.{%endblocktrans%}">
                                        {{s.get_type.deletex|timeuntil}}</span>{%endif%})
                                </li>
                                <li class="description">
                                    {% trans "Description" %}:
                                    <span class="value">{{s.description}}</span>
                                    <div class="clear"></div>
                                </li>
                                <li>
                                    &nbsp;
                                    <span class="value">
                                        <form method="POST" action="/vm/new/s{{s.pk}}/">
                                            {% csrf_token %}
                                            <input {% if  s.running_shared >= s.per_user_limit  or s.get_running >= s.instance_limit%}disabled="disabled" value="{% trans "Quota reached" %}" {%else%}value="{% trans "Launch" %}"{% endif %} type="submit" />
                                        </form>
                                    </span>
                                    <div class="clear"></div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </li>
                {% endfor %}
            </ul>
        </div>
    </li>
106
    {% endif %}
Dányi Bence committed
107
    <li class="entry small">
108 109 110 111 112 113 114 115 116 117 118 119
        <div class="summary">
            <div class="quota">
                <div class="used" style="background-color: rgba(0,255,0,0.2); width: {{userdetails.get_instance_pc|unlocalize}}%"></div>
            </div>
            <div class="name">
                {% blocktrans with used=userdetails.get_weighted_instance_count all=userdetails.instance_quota %}Personal quota: {{used}}/{{all}}{% endblocktrans %}
            </div>
            <div class="clear"></div>
        </div>
    </li>
</ul>
{% endblock content %}