Commit 8d004e78 by Őry Máté

Merge branch 'feature-improve-templates'

Feature: Improve Templates

* add missing i18n markings to templates
* show hostname on vm list
* change console tab to always accessible
* updating hungarian translation
parents 2a1ce8f5 920d1272
...@@ -10,7 +10,7 @@ from django.db.models import ( ...@@ -10,7 +10,7 @@ from django.db.models import (
DateTimeField, DateTimeField,
) )
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _, override from django.utils.translation import ugettext_lazy as _, override, ugettext
from model_utils.models import TimeStampedModel from model_utils.models import TimeStampedModel
from model_utils.fields import StatusField from model_utils.fields import StatusField
...@@ -50,7 +50,7 @@ class Notification(TimeStampedModel): ...@@ -50,7 +50,7 @@ class Notification(TimeStampedModel):
with override(language): with override(language):
context['user'] = user context['user'] = user
rendered = render_to_string(template, context) rendered = render_to_string(template, context)
subject = unicode(subject) subject = ugettext(unicode(subject))
return cls.objects.create(to=user, subject=subject, message=rendered, return cls.objects.create(to=user, subject=subject, message=rendered,
valid_until=valid_until) valid_until=valid_until)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
{% if not d.failed %} {% if not d.failed %}
{% if d.size %}{{ d.size|filesize }}{% endif %} {% if d.size %}{{ d.size|filesize }}{% endif %}
{% else %} {% else %}
<div class="label label-danger"{% if user.is_superuser %} title="{{ d.get_latest_activity_result }}"{% endif %}>failed</div> <div class="label label-danger"{% if user.is_superuser %} title="{{ d.get_latest_activity_result }}"{% endif %}>{% trans "failed" %}</div>
{% endif %} {% endif %}
{% else %}<span class="disk-list-disk-percentage" data-disk-pk="{{ d.pk }}">{{ d.get_download_percentage }}</span>%{% endif %} {% else %}<span class="disk-list-disk-percentage" data-disk-pk="{{ d.pk }}">{{ d.get_download_percentage }}</span>%{% endif %}
<a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}" <a href="{% url "dashboard.views.disk-remove" pk=d.pk %}?next={{ request.path }}"
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</span> </span>
</li> </li>
<li> <li>
<i class="icon-hand-right"></i> Description: <i class="icon-hand-right"></i> {% trans "Description" %}:
<span style="float: right; max-width: 350px;"> <span style="float: right; max-width: 350px;">
{{ t.description }} {{ t.description }}
</span> </span>
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<footer> <footer>
<a href="#">{% trans "Legal notice" %}</a> | <a href="#">{% trans "Policy" %}</a> | <a href="#">{% trans "Help" %}</a> | <a href="#">{% trans "Legal notice" %}</a> | <a href="#">{% trans "Policy" %}</a> | <a href="#">{% trans "Help" %}</a> |
<a href="#">{% trans "Support" %}</a> <a href="#">{% trans "Support" %}</a>
<span class="pull-right">&copy; {{ COMPANY_NAME }}</span> <span class="pull-right">{{ COMPANY_NAME }}</span>
</footer> </footer>
</body> </body>
{% block extra_js %} {% block extra_js %}
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
{% endif %} {% endif %}
<br /> <br />
<div class="pull-right" style="margin-top: 15px;"> <div class="pull-right" style="margin-top: 15px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Cancel" %}</button>
<button id="confirmation-modal-button" type="button" class="btn btn-danger">Delete</button> <button id="confirmation-modal-button" type="button" class="btn btn-danger">{% trans "Delete" %}</button>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% if title %} {% if title %}
{{ title }} {{ title }}
{% else %} {% else %}
Delete confirmation {% trans "Delete confirmation" %}
{% endif %} {% endif %}
</h3> </h3>
</div> </div>
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
<div class="pull-right"> <div class="pull-right">
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
<a class="btn btn-default">Back</a> <a class="btn btn-default">{% trans "Cancel" %}</a>
<input type="hidden" name="next" value="{{ request.GET.next }}"/> <input type="hidden" name="next" value="{{ request.GET.next }}"/>
<button class="btn btn-danger">Yes</button> <button class="btn btn-danger">{% trans "Yes" %}</button>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-body"> <div class="modal-body">
Are you sure you want to delete these objects<br /> {% trans "Are you sure you want to delete the following objects?" %}<br />
{% for o in objects %} {% for o in objects %}
<strong>{{ o }}</strong>{% if not forloop.last %},{% endif %} <strong>{{ o }}</strong>{% if not forloop.last %},{% endif %}
{% endfor %} {% endfor %}
?
<div class="pull-right" style="margin-top: 40px;"> <div class="pull-right" style="margin-top: 40px;">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> <button type="button" class="btn btn-default" data-dismiss="modal">{% trans "Cancel" %}</button>
<button id="confirmation-modal-button" type="button" class="btn btn-danger">Delete</button> <button id="confirmation-modal-button" type="button" class="btn btn-danger">{% trans "Delete" %}</button>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
{% if title %} {% if title %}
{{ title }} {{ title }}
{% else %} {% else %}
Status changing confirmation {% trans "Status changing confirmation" %}
{% endif %} {% endif %}
</h3> </h3>
</div> </div>
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
<div class="pull-right"> <div class="pull-right">
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
<a class="btn btn-default">Back</a> <a class="btn btn-default">{% trans "Cancel" %}</a>
<button type="button" class="btn btn-default" data-dismiss="modal"></button>
<input type="hidden" name="change_status" value=""/> <input type="hidden" name="change_status" value=""/>
<button class="btn btn-warning">Yes, {{ status }}</button> <button class="btn btn-warning">{% blocktrans with status=status %}Yes, {{status}}{% endblocktrans %}</button>
</form> </form>
</div> </div>
</div> </div>
......
<a class="btn btn-info btn-xs group-list-details" href="#" {% load i18n %}
>Member list</a> <a class="btn btn-info btn-xs group-list-details" href="#">{% trans "Members" %}</a>
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="pull-right toolbar"> <div class="pull-right toolbar">
<span class="btn btn-default btn-xs infobtn" title="{% trans "Help" %}"><i class="icon-info-sign"></i></span> <span class="btn btn-default btn-xs infobtn" title="{% trans "Help" %}"><i class="icon-info-sign"></i></span>
</div> </div>
<h3 class="no-margin"><i class="icon-group"></i> Groups</h3> <h3 class="no-margin"><i class="icon-group"></i> {% trans "Groups" %}</h3>
</div> </div>
<div class="list-group" id="vm-list-view"> <div class="list-group" id="vm-list-view">
{% for i in groups %} {% for i in groups %}
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div href="#" class="list-group-item list-group-footer text-right"> <div href="#" class="list-group-item list-group-footer text-right">
<div class="row"> <div class="row">
<div class="col-sm-6 col-xs-6 input-group input-group-sm"> <div class="col-sm-6 col-xs-6 input-group input-group-sm">
<input type="text" class="form-control" placeholder="Search..." /> <input type="text" class="form-control" placeholder="{% trans "Search..." %}" />
<div class="input-group-btn"> <div class="input-group-btn">
<button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button> <button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button>
</div> </div>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<i class="icon-chevron-sign-right"></i> <strong>{{ more_groups }}</strong> more <i class="icon-chevron-sign-right"></i> <strong>{{ more_groups }}</strong> more
</a> </a>
{% endif %} {% endif %}
<a class="btn btn-success btn-xs group-create" href="#"><i class="icon-upload-alt"></i> upload </a> <a class="btn btn-success btn-xs group-create" href="#"><i class="icon-upload-alt"></i> {% trans "new" %} </a>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
<a href="#index-list-view" data-index-box="node" class="btn btn-default btn-xs disabled"><i class="icon-list"></i></a> <a href="#index-list-view" data-index-box="node" class="btn btn-default btn-xs disabled"><i class="icon-list"></i></a>
</div> </div>
<span class="btn btn-default btn-xs infobtn" title="{% trans "Help" %}"><i class="icon-info-sign"></i></span> <span class="btn btn-default btn-xs infobtn" title="{% trans "List of compute nodes, also called worker nodes or hypervisors, which run the virtual machines." %}"><i class="icon-info-sign"></i></span>
</div> </div>
<h3 class="no-margin"> <h3 class="no-margin">
<i class="icon-sitemap"></i> {% trans "Compute nodes" %} <i class="icon-sitemap"></i> {% trans "Nodes" %}
</h3> </h3>
</div > </div >
<div class="list-group" id="node-list-view"> <div class="list-group" id="node-list-view">
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div href="#" class="list-group-item list-group-footer"> <div href="#" class="list-group-item list-group-footer">
<div class="row"> <div class="row">
<div class="col-sm-6 col-xs-6 input-group input-group-sm"> <div class="col-sm-6 col-xs-6 input-group input-group-sm">
<input type="text" class="form-control" placeholder="Search..." /> <input type="text" class="form-control" placeholder="{% trans "Search..." %}" />
<div class="input-group-btn"> <div class="input-group-btn">
<button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button> <button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button>
</div> </div>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="row"> <div class="row">
<div class="col-sm-6 col-xs-6 input-group input-group-sm"> <div class="col-sm-6 col-xs-6 input-group input-group-sm">
<input type="text" class="form-control" placeholder="Search..." /> <input type="text" class="form-control" placeholder="{% trans "Search..." %}" />
<div class="input-group-btn"> <div class="input-group-btn">
<button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button> <button type="submit" class="form-control btn btn-primary" title="search"><i class="icon-search"></i></button>
</div> </div>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<div class="col-sm-6 text-right"> <div class="col-sm-6 text-right">
{% if more_nodes >= 0 %} {% if more_nodes >= 0 %}
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}"> <a class="btn btn-primary btn-xs" href="{% url "dashboard.views.node-list" %}">
<i class="icon-chevron-sign-right"></i> <strong>{{ more_nodes }}</strong> more <i class="icon-chevron-sign-right"></i> {% blocktrans with count=more_nodes %}<strong>{{count}}</strong> more{% endblocktrans %}
</a> </a>
{% endif %} {% endif %}
<a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a> <a class="btn btn-success btn-xs node-create" href="{% url "dashboard.views.node-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<span class="btn btn-default btn-xs infobtn pull-right" title="{% trans "Help" %}"> <span class="btn btn-default btn-xs infobtn pull-right" title="{% trans "Help" %}">
<i class="icon-info-sign"></i> <i class="icon-info-sign"></i>
</span> </span>
<h3 class="no-margin"><i class="icon-puzzle-piece"></i> Templates <h3 class="no-margin"><i class="icon-puzzle-piece"></i> {% trans "Templates" %}
</h3> </h3>
</div> </div>
<div class="list-group" id="vm-list-view"> <div class="list-group" id="vm-list-view">
......
...@@ -9,19 +9,20 @@ ...@@ -9,19 +9,20 @@
<span class="btn btn-default btn-xs infobtn" title="{% trans "Help" %}"><i class="icon-info-sign"></i></span> <span class="btn btn-default btn-xs infobtn" title="{% trans "Help" %}"><i class="icon-info-sign"></i></span>
</div> </div>
<h3 class="no-margin"> <h3 class="no-margin">
<i class="icon-desktop"></i> Virtual machines <i class="icon-desktop"></i> {% trans "Virtual machines" %}
</h3> </h3>
</div> </div>
<div class="list-group" id="vm-list-view"> <div class="list-group" id="vm-list-view">
<div id="dashboard-vm-list"> <div id="dashboard-vm-list">
{% for i in instances %} {% for i in instances %}
<a href="{{ i.get_absolute_url }}" class="list-group-item"> <a href="{{ i.get_absolute_url }}" class="list-group-item">
<i class="icon-{% if i.state == "RUNNING" %}play-sign{% else %}pause{% endif %}"></i> {{ i.name }} <i class="{{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i> {{ i.name }}
<small class="text-muted">{{ i.primary_host.hostname }}</small>
<div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}"> <div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}">
{% if i.fav %} {% if i.fav %}
<i class="icon-star text-primary title-favourite" title="Unfavourite"></i> <i class="icon-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i>
{% else %} {% else %}
<i class="icon-star-empty text-primary title-favourite" title="Mark as favorite"></i> <i class="icon-star-empty text-primary title-favourite" title="{% trans "Mark as favorite" %}"></i>
{% endif %} {% endif %}
</div> </div>
</a> </a>
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
<div class="col-sm-6 text-right"> <div class="col-sm-6 text-right">
{% if more_instances > 0 %} {% if more_instances > 0 %}
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.vm-list" %}"> <a class="btn btn-primary btn-xs" href="{% url "dashboard.views.vm-list" %}">
<i class="icon-chevron-sign-right"></i> {% blocktrans with more_instances=more_instances %}<strong>{{ more_instances }}</strong> more{% endblocktrans %} <i class="icon-chevron-sign-right"></i> {% blocktrans with count=more_instances %}<strong>{{ count }}</strong> more{% endblocktrans %}
</a> </a>
{% endif %} {% endif %}
<a class="btn btn-success btn-xs vm-create" href="{% url "dashboard.views.vm-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a> <a class="btn btn-success btn-xs vm-create" href="{% url "dashboard.views.vm-create" %}"><i class="icon-plus-sign"></i> {% trans "new" %}</a>
...@@ -48,14 +49,16 @@ ...@@ -48,14 +49,16 @@
</div> </div>
<div class="panel-body" id="vm-graph-view" style="display: none"> <div class="panel-body" id="vm-graph-view" style="display: none">
<p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-max="{{ request.user.profile.instance_limit }}" data-width="100" data-height="100" data-readOnly="true" value="{{ instances|length|add:more_instances }}"></p> <p class="pull-right"> <input class="knob" data-fgColor="chartreuse" data-thickness=".4" data-max="{{ request.user.profile.instance_limit }}" data-width="100" data-height="100" data-readOnly="true" value="{{ instances|length|add:more_instances }}"></p>
<p><span class="bigbig"><big>{{ running_vm_num }}</big> running </span> <p><span class="bigbig">{% blocktrans with count=running_vm_num %}<big>{{ count }}</big> running{% endblocktrans %}</span>
<ul class="list-inline"> <ul class="list-inline">
{% for vm in running_vms %} {% for vm in running_vms %}
<li class="label label-success"><i class="icon-play-sign"></i> {{ vm.name}}</li> <li class="label label-success">
<a href="vm.get_absolute_url" title="{{vm.primary_host.get_fqdn}}"><i class="{{vm.get_status_icon}}"></i> {{vm.name}}</a>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
</p> </p>
<p class="big text-warning"><big>{{ stopped_vm_num }}</big> stopped</p> <p class="big text-warning">{% blocktrans with count=stopped_vm_num %}<big>{{ count }}</big> stopped{% endblocktrans %}</p>
<div class="clearfix"></div> <div class="clearfix"></div>
<div class="text-right"> <div class="text-right">
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
{% elif node.state == 'OFFLINE' %}label-warning {% elif node.state == 'OFFLINE' %}label-warning
{% endif %}">{{ node.get_status_display|upper }}</span> {% endif %}">{{ node.get_status_display|upper }}</span>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle" data-toggle="dropdown">Action <i class="icon-caret-down"></i></button> <button type="button" class="btn {{ btn_size }} btn-warning nojs-dropdown-toogle dropdown-toggle" data-toggle="dropdown">{% trans "Action" %} <i class="icon-caret-down"></i></button>
<ul class="dropdown-menu nojs-dropdown-toogle" role="menu"> <ul class="dropdown-menu nojs-dropdown-toogle" role="menu">
<li><a href="#" class="node-details-rename-button"><i class="icon-pencil"></i> {% trans "Rename" %}</a></li> <li><a href="#" class="node-details-rename-button"><i class="icon-pencil"></i> {% trans "Rename" %}</a></li>
<li><a data-node-pk="{{ node.pk }}" class="real-link node-flush" href="{% url "dashboard.views.flush-node" pk=node.pk %}"><i class="icon-cloud-upload"></i>{% trans "Flush" %}</a> <li><a data-node-pk="{{ node.pk }}" class="real-link node-flush" href="{% url "dashboard.views.flush-node" pk=node.pk %}"><i class="icon-cloud-upload"></i>{% trans "Flush" %}</a>
<li> <li>
<a style="display:{% if node.enabled %}none{% else %}block{% endif %}" data-node-pk="{{ node.pk }}" class="real-link node-enable" href="{% url "dashboard.views.status-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-check"></i>{% trans "Enable" %}</a> <a style="display:{% if node.enabled %}none{% else %}block{% endif %}" data-node-pk="{{ node.pk }}" class="real-link node-enable" href="{% url "dashboard.views.status-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-check"></i>{% trans "Enable" %}</a>
<a style="display:{% if not node.enabled %}none{% else %}block{% endif %}" data-node-pk="{{ node.pk }}" class="real-link node-enable" href="{% url "dashboard.views.status-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-remove"></i>{% trans "Disable" %}</a></li> <a style="display:{% if not node.enabled %}none{% else %}block{% endif %}" data-node-pk="{{ node.pk }}" class="real-link node-enable" href="{% url "dashboard.views.status-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-remove"></i>{% trans "Disable" %}</a></li>
<li><a data-node-pk="{{ node.pk }}" class="real-link node-delete" href="{% url "dashboard.views.delete-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-trash"></i> Delete</a></li> <li><a data-node-pk="{{ node.pk }}" class="real-link node-delete" href="{% url "dashboard.views.delete-node" pk=node.pk %}?next={{ request.path }}"><i class="icon-trash"></i> {% trans "Delete" %}</a></li>
</ul> </ul>
</div> </div>
</div> </div>
......
{% load i18n %} {% load i18n %}
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<dl> <div style="font-weight: bold;">{% trans "Traits the node provides" %}</div>
<dt>System:</dt>
<dd><i class="icon-linux"></i> Uhu Binux Optikai Rendszer</dd>
<dt>Description:</dt>
<dd><small>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc est libero, hendrerit at posuere sed, molestie congue quam. </small></dd>
</dl>
<div style="font-weight: bold;">{% trans "Traits" %}</div>
<div id="node-details-traits" style="margin-bottom: 20px;"> <div id="node-details-traits" style="margin-bottom: 20px;">
<div id="node-details-traits-list"> <div id="node-details-traits-list">
{% if node.traits.all %} {% if node.traits.all %}
......
...@@ -3,30 +3,12 @@ ...@@ -3,30 +3,12 @@
{% load render_table from django_tables2 %} {% load render_table from django_tables2 %}
{% block content %} {% block content %}
<div class="alert alert-info">
Tip #1: you can select multiple vm instances while holding down the <strong>CTRL</strong> key!
</div>
<div class="alert alert-info">
Tip #2: if you want to select multiple instances by one click select an instance then hold down <strong>SHIFT</strong> key and select another one!
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="no-margin"><i class="icon-desktop"></i> Your nodes</h3> <h3 class="no-margin"><i class="icon-desktop"></i> {% trans "Compute nodes" %}</h3>
</div> </div>
<div class="panel-body node-list-group-control">
<p>
<strong>Group actions</strong>
<button id="node-list-group-select-all" class="btn btn-info btn-xs">Select all</button>
<a class="btn btn-default btn-xs" id="node-list-group-migrate" disabled><i class="icon-truck"></i> Migrate</a>
<a disabled href="#" class="btn btn-default btn-xs"><i class="icon-refresh"></i> Reboot</a>
<a disabled href="#" class="btn btn-default btn-xs"><i class="icon-off"></i> Shutdown</a>
<a id="node-list-group-delete" disabled href="#" class="btn btn-danger btn-xs"><i class="icon-remove"></i> Discard</a>
</p>
</div>
<div id="table_container"> <div id="table_container">
<div id="rendered_table" class="panel-body"> <div id="rendered_table" class="panel-body">
......
<a class="btn btn-default btn-xs" title data-original-title="Flush"> <a class="btn btn-default btn-xs" title="{% trans "Flush" %}">
<i class="icon-cloud-upload"></i> <i class="icon-cloud-upload"></i>
</a> </a>
<a id="node-list-rename-button" class="btn btn-default btn-xs" title data-original-title="Rename"> <a id="node-list-rename-button" class="btn btn-default btn-xs" title="{% trans "Rename" %}">
<i class="icon-pencil"></i> <i class="icon-pencil"></i>
</a> </a>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div class="col-md-8"> <div class="col-md-8">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<a class="pull-right btn btn-default btn-xs" href="{% url "dashboard.views.template-list" %}">Back</a> <a class="pull-right btn btn-default btn-xs" href="{% url "dashboard.views.template-list" %}">{% trans "Back" %}</a>
<h3 class="no-margin"><i class="icon-puzzle-piece"></i> {% trans "Edit template" %}</h3> <h3 class="no-margin"><i class="icon-puzzle-piece"></i> {% trans "Edit template" %}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
</div> </div>
</div> </div>
{% comment %}
<div class="col-md-6"> <div class="col-md-6">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
...@@ -46,6 +47,7 @@ ...@@ -46,6 +47,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endcomment %}
</div> </div>
{% endblock %} {% endblock %}
......
{% load i18n %} {% load i18n %}
<a href="{% url "dashboard.views.template-create" %}?parent={{ record.pk }}" id="template-list-clone-button" class="btn btn-default btn-xs" title data-original-title="{% trans "Clone" %}"> <a href="{% url "dashboard.views.template-create" %}?parent={{ record.pk }}" id="template-list-clone-button" class="btn btn-default btn-xs" title="{% trans "Clone" %}">
<i class="icon-copy"></i> <i class="icon-copy"></i>
</a> </a>
<a href="{% url "dashboard.views.template-detail" pk=record.pk%}" id="template-list-edit-button" class="btn btn-default btn-xs" title data-original-title="{% trans "Edit" %}"> <a href="{% url "dashboard.views.template-detail" pk=record.pk%}" id="template-list-edit-button" class="btn btn-default btn-xs" title="{% trans "Edit" %}">
<i class="icon-edit"></i> <i class="icon-edit"></i>
</a> </a>
<a data-template-pk="{{ record.pk }}" href="{% url "dashboard.views.template-delete" pk=record.pk %}" class="btn btn-danger btn-xs template-delete" title="{% trans "Delete" %}"> <a data-template-pk="{{ record.pk }}" href="{% url "dashboard.views.template-delete" pk=record.pk %}" class="btn btn-danger btn-xs template-delete" title="{% trans "Delete" %}">
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</li> </li>
<li> <li>
<strong>{% trans "Wake up" %}:</strong> <strong>{% trans "Wake up" %}:</strong>
{% trans "?" %} {% trans "Wake up suspended machine." %}
</li> </li>
<li> <li>
<strong>{% trans "Shutdown" %}:</strong> <strong>{% trans "Shutdown" %}:</strong>
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
</li> </li>
<li> <li>
<strong>{% trans "Save as template" %}:</strong> <strong>{% trans "Save as template" %}:</strong>
{% trans "?" %} {% trans "Shut down the virtual machine, and save it as a new template." %}
</li> </li>
<li> <li>
<strong>{% trans "Destroy" %}:</strong> <strong>{% trans "Destroy" %}:</strong>
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<div class="big"> <div class="big">
<span id="vm-details-state" class="label label-success">{{ instance.state }}</span> <span id="vm-details-state" class="label label-success">{{ instance.state }}</span>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-warning nojs-dropdown-toogle dropdown-toggle" data-toggle="dropdown">Action <i class="icon-caret-down"></i></button> <button type="button" class="btn btn-warning nojs-dropdown-toogle dropdown-toggle" data-toggle="dropdown">{% trans "Action" %} <i class="icon-caret-down"></i></button>
<ul class="nojs-dropdown-menu dropdown-menu" role="menu"> <ul class="nojs-dropdown-menu dropdown-menu" role="menu">
<li><a href="#" class="vm-details-rename-button"><i class="icon-pencil"></i> {% trans "Rename" %}</a></li> <li><a href="#" class="vm-details-rename-button"><i class="icon-pencil"></i> {% trans "Rename" %}</a></li>
<li><a data-vm-pk="{{ instance.pk }}" href="#" class="vm-details-save-as-button"><i class="icon-save"></i> {% trans "Save as" %}</a></li> <li><a data-vm-pk="{{ instance.pk }}" href="#" class="vm-details-save-as-button"><i class="icon-save"></i> {% trans "Save as" %}</a></li>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<h3>{% trans "Connection" %}</h3> <h3>{% trans "Connection" %}</h3>
<input type="text" value="{{ instance.get_connect_command }}" class="form-control" readonly /> <input type="text" value="{{ instance.get_connect_command }}" class="form-control" readonly />
<dl class="dl-horizontal vm-details-pw"> <dl class="dl-horizontal vm-details-pw">
<dt>Password:</dt> <dt>{% trans "Password" %}:</dt>
<dd> <dd>
<div class="input-group"> <div class="input-group">
<input type="text" id="vm-details-pw-input" class="form-control input-sm input-tags" value="{{ instance.pw }}"/> <input type="text" id="vm-details-pw-input" class="form-control input-sm input-tags" value="{{ instance.pw }}"/>
...@@ -136,15 +136,15 @@ ...@@ -136,15 +136,15 @@
</div> </div>
</dd> </dd>
<dd style="font-size: 10px; text-align: right; padding-top: 8px;"> <dd style="font-size: 10px; text-align: right; padding-top: 8px;">
<a id="vm-details-pw-change" href="#">Generate new password!</a> <a id="vm-details-pw-change" href="#">{% trans "Generate new password!" %}</a>
</dd> </dd>
<div id="vm-details-pw-confirm"> <div id="vm-details-pw-confirm"> {% comment %} TODO Couldn't this use a modal? {% endcomment%}
<dt> <dt>
Are you sure? {% trans "Are you sure?" %}
</dt> </dt>
<dd> <dd>
<a href="#" class="vm-details-pw-confirm-choice label label-success" data-choice="1" data-vm="{{ instance.pk }}">Yes</a> / <a href="#" class="vm-details-pw-confirm-choice label label-success" data-choice="1" data-vm="{{ instance.pk }}">{% trans "Yes" %}</a> /
<a href="#" class="vm-details-pw-confirm-choice label label-danger" data-choice="0">No</a> <a href="#" class="vm-details-pw-confirm-choice label label-danger" data-choice="0">{% trans "No" %}</a>
</dd> </dd>
</div> </div>
</dl> </dl>
...@@ -162,11 +162,8 @@ ...@@ -162,11 +162,8 @@
<i class="icon-tasks icon-2x"></i><br> <i class="icon-tasks icon-2x"></i><br>
{% trans "Resources" %}</a> {% trans "Resources" %}</a>
</li> </li>
<li {% if not instance.is_console_available %}class="disabled"> <li{% if not instance.is_console_available %} class="disabled"{% endif %}>
<a href="#" data-toggle="pill_" data-target="#_console" class="text-center">
{% else %}>
<a href="#console" data-toggle="pill" data-target="#_console" class="text-center"> <a href="#console" data-toggle="pill" data-target="#_console" class="text-center">
{% endif %}
<i class="icon-desktop icon-2x"></i><br> <i class="icon-desktop icon-2x"></i><br>
{% trans "Console" %}</a></li> {% trans "Console" %}</a></li>
<li> <li>
......
{% load i18n %}
<div class="btn-toolbar"> <div class="btn-toolbar">
<button id="sendCtrlAltDelButton" class="btn btn-danger small">Send CtrlAltDel</button> <button id="sendCtrlAltDelButton" class="btn btn-danger small">{% trans "Send Ctrl+Alt+Del" %}</button>
<button id="sendPasswordButton" class="btn btn-default small">Type password</button> <button id="sendPasswordButton" class="btn btn-default small">{% trans "Type password" %}</button>
</div> </div>
<div class="alert alert-info" id="noVNC_status"> <div class="alert alert-info" id="noVNC_status">
</div> </div>
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<dl> <dl>
<dt>System:</dt> <dt>{% trans "System" %}:</dt>
<dd><i class="icon-{{ os_type_icon }}"></i> {{ instance.system }}</dd> <dd><i class="icon-{{ os_type_icon }}"></i> {{ instance.system }}</dd>
<dt style="margin-top: 5px;">Description:</dt> <dt style="margin-top: 5px;">{% trans "Description" %}:</dt>
<dd><small>{{ instance.description }}</small></dd> <dd><small>{{ instance.description }}</small></dd>
</dl> </dl>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</div> </div>
{% endfor %} {% endfor %}
{% else %} {% else %}
<small>No tag added!</small> <small>{% trans "No tag added!" %}</small>
{% endif %} {% endif %}
</div> </div>
<form action="" method="POST"> <form action="" method="POST">
......
{% load i18n %} {% load i18n %}
<h2> <h2>
<a href="#" id="vm-details-network-add" class="btn btn-success pull-right no-js-hidden"> <a href="#" id="vm-details-network-add" class="btn btn-success pull-right no-js-hidden">
<i class="icon-plus"></i> add interface <i class="icon-plus"></i> {% trans "add interface" %}
</a> </a>
Interfaces {% trans "Interfaces" %}
</h2> </h2>
<div class="row" id="vm-details-network-add-for-form"> <div class="row" id="vm-details-network-add-for-form">
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
{% for i in instance.interface_set.all %} {% for i in instance.interface_set.all %}
<h3 class="list-group-item-heading dashboard-vm-details-network-h3"> <h3 class="list-group-item-heading dashboard-vm-details-network-h3">
<i class="icon-{% if i.host %}globe{% else %}link{% endif %}"></i> {{ i.vlan.name }} <i class="icon-{% if i.host %}globe{% else %}link{% endif %}"></i> {{ i.vlan.name }}
{% if not i.host %}(unmanaged) <a href="#" class="btn btn-danger btn-xs">remove</a>{% endif %} {% if not i.host %}(unmanaged) <a href="#" class="btn btn-danger btn-xs">{% trans "remove" %}</a>{% endif %}
</h3> </h3>
{% if i.host %} {% if i.host %}
<div class="row"> <div class="row">
...@@ -31,10 +31,10 @@ ...@@ -31,10 +31,10 @@
</div> </div>
<div class="col-md-7"> <div class="col-md-7">
<ul class="nav nav-pills pull-right"> <ul class="nav nav-pills pull-right">
<li class="active"><a href="#ipv4_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">IPv4</a></li> <li class="active"><a href="#ipv4_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">{% trans "IPv4" %}</a></li>
<li><a href="#ipv6_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">IPv6</a></li> <li><a href="#ipv6_{{ i.host.vlan.pk }}" data-toggle="pill" class="text-center">{% trans "IPv6" %}</a></li>
</ul> </ul>
<h4>Port access</h4> <h4>{% trans "Port access" %}</h4>
<div class="tab-content" style="padding-top: 10px;"> <div class="tab-content" style="padding-top: 10px;">
<div class="tab-pane active" id="ipv4_{{ i.host.vlan.pk }}"> <div class="tab-pane active" id="ipv4_{{ i.host.vlan.pk }}">
<table class="table table-striped rule-table"> <table class="table table-striped rule-table">
......
...@@ -6,15 +6,17 @@ ...@@ -6,15 +6,17 @@
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="no-margin"> <h3 class="no-margin">
Transfer ownership {% trans "Transfer ownership" %}
</h3> </h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="pull-right"> <div class="pull-right">
<form action="" method="POST"> <form action="" method="POST">
{% csrf_token %} {% csrf_token %}
E-mail address or identifier of user: <label>
<input name="name"> {% trans "E-mail address or identifier of user" %}:
<input name="name">
</label>
<input type="submit"> <input type="submit">
</form> </form>
</div> </div>
......
...@@ -778,7 +778,7 @@ class TemplateCreate(SuccessMessageMixin, CreateView): ...@@ -778,7 +778,7 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
post['max_ram_size'] = post['ram_size'] post['max_ram_size'] = post['ram_size']
inst = Instance.create(params=post, disks=[], networks=networks, inst = Instance.create(params=post, disks=[], networks=networks,
tags=tags, req_traits=req_traits) tags=tags, req_traits=req_traits)
messages.success(request, _("Your disk has been created, " messages.success(request, _("The template has been created, "
"you can now add disks to it!")) "you can now add disks to it!"))
return redirect("%s#resources" % inst.get_absolute_url()) return redirect("%s#resources" % inst.get_absolute_url())
......
...@@ -1200,3 +1200,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, ...@@ -1200,3 +1200,14 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel,
**kwargs): **kwargs):
self.shutdown(user, task_uuid) self.shutdown(user, task_uuid)
self.save_as_template(name, **kwargs) self.save_as_template(name, **kwargs)
def get_status_icon(self):
return {
'NOSTATE': 'icon-rocket',
'RUNNING': 'icon-play',
'STOPPED': 'icon-stop',
'SUSPENDED': 'icon-pause',
'ERROR': 'icon-warning_sign',
'PENDING': 'icon-rocket',
'DESTROYED': 'icon-trash',
'MIGRATING': 'icon-truck'}.get(self.status, 'icon-question-sign')
...@@ -97,6 +97,13 @@ class InstanceTestCase(TestCase): ...@@ -97,6 +97,13 @@ class InstanceTestCase(TestCase):
self.assertNotIn(call().__enter__().sub_activity(u'scheduling'), self.assertNotIn(call().__enter__().sub_activity(u'scheduling'),
ia.mock_calls) ia.mock_calls)
def test_status_icon(self):
inst = MagicMock(spec=Instance)
inst.status = 'dummy-value'
self.assertEqual(Instance.get_status_icon(inst), 'icon-question-sign')
inst.status = 'RUNNING'
self.assertEqual(Instance.get_status_icon(inst), 'icon-play')
class InterfaceTestCase(TestCase): class InterfaceTestCase(TestCase):
......
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