Commit 0723519a by Dányi Bence

webui: add vm-list specific templates

parent a255e0fc
{% extends "box/base.html" %}
{% 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 %}
{% include "box/entry-vm.html" %}
{% endfor %}
{% else %}
<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 %}
<li id="new-wm-button" class="wm new">
<div class="summary">
<div class="name">{% trans "Start new machine" %}</div>
<div class="clear"></div>
</div>
</li>
<li id="new-wm" style="display: none">
<h2>{% trans "Available shares" %}</h2>
<p>
{% trans "Choose one of the following shared templates to launch." %}
</p>
<div class="container">
<ul class="wm-list modal">
{% for s in shares %}
<li class="wm">
<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>
<li class="wm small">
<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 %}
{% extends "entry.html" %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% block summaryclass %}{% if id == vm.id %}selected-summary{% endif %} {% if vm.template.state == "NEW" %}unfinished{% endif %}{% endblock summaryclass %}
{% block summary %}
{% include "box/summary-vm.html"}
{% endblock summary %}
{% block details %}
<ul>
<li class="name">
{% trans "Hostname" %}:
<span class="value">{{vm.name}}</span>
<div class="clear"></div>
</li>
<li class="os-{{vm.template.os_type}}">
{% trans "System" %}:
<span class="value">{{vm.template.system}}</span>
<div class="clear"></div>
</li>
<li class="template">
{% trans "Type" %}:
<span class="value">{{vm.share.type}}</span>
<div class="clear"></div>
</li>
<li class="template">
{% trans "Share" %}:
<span class="value">{{vm.share.name}}</span>
<div class="clear"></div>
</li>
<li class="template">
{% trans "Template" %}:
<span class="value">{{vm.template.name}}</span>
<div class="clear"></div>
</li>
<li class="type">
{% trans "Size" %}:
<span class="value">
{{vm.template.instance_type.name}}:
<span class="cpu">{{vm.template.instance_type.CPU}}</span>
<span class="memory">{{vm.template.instance_type.RAM}}</span>
<span class="credit">{{vm.template.instance_type.credit}}</span>
</span>
</li>
<li class="date">
{% trans "Created at" %}:
<span class="value">{{vm.created_at}}</span>
</li>
{% if vm.time_of_suspend %}
<li class="date">
{% trans "time of suspend"|capfirst %}:
<span class="value"> <abbr title="{{vm.time_of_suspend}}">{{vm.time_of_suspend|timeuntil}}</abbr>
<a href="#" class="renew-vm-button renew-suspend-vm-button" data-id="{{ vm.id }}" title="{% trans "Renew suspend time" %}">
<img src="/static/icons/control-double.png" alt="{% trans "Renew suspend time" %}" />
</a>
</span>
</li>
{% endif %}
{% if vm.time_of_delete %}
<li class="date">
{% trans "time of delete"|capfirst %}:
<span class="value"> <abbr title="{{vm.time_of_delete}}">{{vm.time_of_delete|timeuntil}}</abbr>
<a href="#" class="renew-vm-button renew-delete-vm-button" data-id="{{ vm.id }}" title="{% trans "Renew deletion time" %}">
<img src="/static/icons/control-double.png" alt="{% trans "Renew deletion time" %}" />
</a>
</span>
</li>
{% endif %}
<li>
&nbsp;
<span class="value">
<a href="/vm/show/{{vm.id}}/" title="{{vm.name}}">{% trans "More details" %}</a>
</span>
</li>
</ul>
{% endblock details %}
{% extends "summary.html" %}
{% load i18n %}
{% get_current_language as LANGUAGE_CODE %}
{% block nameclass %}{% if vm.state == 'ACTIVE' %}vm-on{% else %}vm-off{% endif %}{% endblock nameclass %}
{% block name %}
{{vm.name|truncatechars:20}}
{% endblock %}
{% block status %}
{{vm.state}}
{% endblock status %}
{% block actions %}
{% if vm.waiting %}
<img src="/static/load.gif" />
{% elif vm.state == 'ACTIVE' %}
<a href="{{vm.get_connect_uri}}" data-id="{{ vm.id }}" class="connect-vm-button" title="{% trans "Connect" %}">
<img src="/static/icons/plug.png" alt="{% trans "Connect" %}" />
</a>
<a href="#" class="stop-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Pause" %}">
<img src="/static/icons/control-pause.png" alt="{% trans "Pause" %}" />
</a>
<a href="#" class="delete-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
</a>
<a href="#" class="restart-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Restart" %}">
<img src="/static/icons/arrow-circle-double.png" alt="↺" />
</a>
{% elif vm.state == 'PENDING' %}
<img src="/static/load.gif" />
{% trans "starting…" %}
{% elif vm.state == 'STOPPED' %}
<a href="#" class="resume-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Resume" %}">
<img src="/static/icons/control.png" alt="{% trans "Resume" %}" />
</a>
<a href="#" class="delete-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
</a>
{% elif vm.state == 'FAILED' %}
<a href="#" class="delete-vm-button" data-name="{{ vm.name }}" data-id="{{ vm.id }}" title="{% trans "Delete" %}">
<img src="/static/icons/minus-circle.png" alt="{% trans "Delete" %}" />
</a>
{% endif %}
{% endblock actions %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment