Modal form abstraction and cleanup. Bug fixes.
Modal forms now inherit from a _modal_form.html template, and the guts of form presentation are abstracted to _form_fields.html to be more DRY. Converts nova/containers, nova/floating_ips, nova/images and nova/instances to use the new style. Fixed image ownership bug. Fixed server descriptions bug. Change-Id: Ib1604665d9a0c4d9fe971af9c22ff6c09bbb35ea
This commit is contained in:
parent
de01161928
commit
ec59def397
|
@ -103,7 +103,7 @@ class ServerAttributes(APIDictWrapper):
|
|||
|
||||
Preserves the request info so image name can later be retrieved
|
||||
"""
|
||||
_attrs = ['description', 'disk_gb', 'host', 'image_ref', 'kernel_id',
|
||||
_attrs = ['disk_gb', 'host', 'image_ref', 'kernel_id',
|
||||
'key_name', 'launched_at', 'mac_address', 'memory_mb', 'name',
|
||||
'os_type', 'tenant_id', 'ramdisk_id', 'scheduled_at',
|
||||
'terminated_at', 'user_data', 'user_id', 'vcpus', 'hostname',
|
||||
|
@ -231,12 +231,11 @@ def server_delete(request, instance):
|
|||
|
||||
|
||||
def server_get(request, instance_id):
|
||||
return Server(extras_api(request).servers.get(instance_id), request)
|
||||
return Server(novaclient(request).servers.get(instance_id), request)
|
||||
|
||||
|
||||
@check_openstackx
|
||||
def server_list(request):
|
||||
return [Server(s, request) for s in extras_api(request).servers.list()]
|
||||
return [Server(s, request) for s in novaclient(request).servers.list()]
|
||||
|
||||
|
||||
@check_openstackx
|
||||
|
@ -251,10 +250,8 @@ def server_reboot(request,
|
|||
server.reboot(hardness)
|
||||
|
||||
|
||||
def server_update(request, instance_id, name, description):
|
||||
return extras_api(request).servers.update(instance_id,
|
||||
name=name,
|
||||
description=description)
|
||||
def server_update(request, instance_id, name):
|
||||
return novaclient(request).servers.update(instance_id, name=name)
|
||||
|
||||
|
||||
def server_add_floating_ip(request, server, address):
|
||||
|
|
|
@ -46,8 +46,12 @@ def horizon(request):
|
|||
|
||||
``network_configured``
|
||||
Boolean. Will be ``True`` if ``settings.QUANTUM_ENABLED`` is ``True``.
|
||||
|
||||
Additionally, it sets the names ``True`` and ``False`` in the context
|
||||
to their boolean equivalents for convenience.
|
||||
"""
|
||||
context = {}
|
||||
context = {"True": True,
|
||||
"False": False}
|
||||
|
||||
# Auth/Keystone context
|
||||
context.setdefault('authorized_tenants', [])
|
||||
|
|
|
@ -65,7 +65,7 @@ class UpdateImageForm(forms.SelfHandlingForm):
|
|||
LOG.exception(error_retrieving)
|
||||
messages.error(request, error_retrieving)
|
||||
|
||||
if image.owner == request.user.username:
|
||||
if image.owner == request.user.tenant_id:
|
||||
try:
|
||||
meta = {
|
||||
'is_public': True,
|
||||
|
|
|
@ -46,8 +46,6 @@ def index(request):
|
|||
unused, handled = f.maybe_handle(request)
|
||||
if handled:
|
||||
return handled
|
||||
delete_form = DeleteImage()
|
||||
|
||||
all_images = []
|
||||
try:
|
||||
all_images = api.image_list_detailed(request)
|
||||
|
@ -67,9 +65,12 @@ def index(request):
|
|||
images = [im for im in all_images
|
||||
if im['container_format'] not in ['aki', 'ari']]
|
||||
|
||||
quotas = api.tenant_quota_get(request, request.user.tenant_id)
|
||||
|
||||
return shortcuts.render(request,
|
||||
'nova/images/index.html', {
|
||||
'delete_form': delete_form,
|
||||
'delete_form': DeleteImage(),
|
||||
'quotas': quotas,
|
||||
'images': images})
|
||||
|
||||
|
||||
|
|
|
@ -82,16 +82,13 @@ class UpdateInstance(forms.SelfHandlingForm):
|
|||
instance = forms.CharField(widget=forms.TextInput(
|
||||
attrs={'readonly': 'readonly'}))
|
||||
name = forms.CharField(required=True)
|
||||
description = forms.CharField(required=False)
|
||||
|
||||
def handle(self, request, data):
|
||||
tenant_id = data['tenant_id']
|
||||
description = data.get('description', '')
|
||||
try:
|
||||
api.server_update(request,
|
||||
data['instance'],
|
||||
data['name'],
|
||||
description)
|
||||
data['name'])
|
||||
messages.success(request, _("Instance '%s' updated") %
|
||||
data['name'])
|
||||
except api_exceptions.ApiException, e:
|
||||
|
|
|
@ -209,8 +209,7 @@ def update(request, instance_id):
|
|||
form, handled = UpdateInstance.maybe_handle(request, initial={
|
||||
'instance': instance_id,
|
||||
'tenant_id': tenant_id,
|
||||
'name': instance.name,
|
||||
'description': instance.attrs['description']})
|
||||
'name': instance.name})
|
||||
|
||||
if handled:
|
||||
return handled
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
{% extends 'nova/keypairs/_form.html' %}
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:containers:create %}{% endblock %}
|
||||
{% block form_id %}create_container_form{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:containers:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Keypair"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
{% block modal-header %}Create Container{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description"%}:</h3>
|
||||
<p>{% trans "A container is a storage compartment for your data and provides a way for you to organize your data. You can think of a container as a folder in Windows® or a directory in UNIX®. The primary difference between a container and these other file system concepts is that containers cannot be nested. You can, however, create an unlimited number of containers within your account. Data must be stored in a container so you must have at least one container defined in your account prior to uploading data."%}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary pull-right" type="submit" value="{% trans "Create Container" %}" />
|
||||
<a href="{% url horizon:nova:containers:index %}" class="btn secondary cancel close">Cancel</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
{%load i18n%}
|
||||
<form id="import_keypair_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
<input type="submit" value="{%trans "Create Container" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
</form>
|
|
@ -12,20 +12,7 @@
|
|||
{% endblock page_header %}
|
||||
|
||||
{% block dash_main %}
|
||||
<div id="create_container_form" class="modal static_page">
|
||||
<div class="modal-header">
|
||||
<h3>Create Container</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="left">
|
||||
{% include 'nova/containers/_create.html' with form=create_form %}
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description"%}:</h3>
|
||||
<p>{% trans "A container is a storage compartment for your data and provides a way for you to organize your data. You can think of a container as a folder in Windows® or a directory in UNIX®. The primary difference between a container and these other file system concepts is that containers cannot be nested. You can, however, create an unlimited number of containers within your account. Data must be stored in a container so you must have at least one container defined in your account prior to uploading data."%}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include "nova/containers/_create.html" with form=create_form %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,24 @@
|
|||
{% extends 'nova/instances/_form.html' %}
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:floating_ips:associate floating_ip_id %}{% endblock %}
|
||||
{% block form_id %}associate_floating_ip_form{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:floating_ips:associate floating_ip_id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Associate IP"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
{% block modal-header %}Associate Floating IP{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Associate a floating ip with an instance."%}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Associate IP"%}" />
|
||||
<a href="{% url horizon:nova:floating_ips:index %}" class="btn secondary cancel close">Cancel</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
<input type="submit" value="{%trans "Associate IP" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -13,19 +13,5 @@
|
|||
{% endblock page_header %}
|
||||
|
||||
{% block dash_main %}
|
||||
<div id="update_instance_modal" class="modal static_page">
|
||||
<div class="modal-header">
|
||||
<h3>Associate Floating IP</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="left">
|
||||
{% include 'nova/floating_ips/_associate.html' with form=associate_form %}
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Associate a floating ip with an instance."%}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'nova/floating_ips/_associate.html' with form=associate_form %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<form id="form_delete_{{image.id}}" class="form-delete" method="post">
|
||||
{% csrf_token %}
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{{ hidden }}
|
||||
{% endfor %}
|
||||
<input name="image_id" type="hidden" value="{{image.id}}" />
|
||||
<input id="delete_{{image.id}}" class="delete" title="Image: {{image.name}}" type="submit" value="{%trans "Delete"%}" />
|
||||
<input id="delete_{{image.id}}" class="btn small delete danger" title="Image: {{image.name}}" type="submit" value="{%trans "Delete"%}" />
|
||||
</form>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
<input type="submit" value="{%trans "Launch Image" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -1,11 +1,52 @@
|
|||
{% extends 'nova/images/_launch_form.html' %}
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:images:launch image_id %}{% endblock %}
|
||||
{% block form_id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:images:launch image_id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Launch Instance"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
{% block modal_id %}launch_image_{{ image_id }}{% endblock %}
|
||||
|
||||
{% block modal-header %}Launch Instances{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Specify the details for launching an instance. Also please make note of the table below; all tenants have quotas which define the limit of resources they are allowed to provision."%}</p>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<th>{% trans "Quota Name"%}</th>
|
||||
<th>{% trans "Limit"%}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "RAM (MB)"%}</td>
|
||||
<td>{{quotas.ram}}MB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Floating IPs"%}</td>
|
||||
<td>{{quotas.floating_ips}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Instances"%}</td>
|
||||
<td>{{quotas.instances}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Volumes"%}</td>
|
||||
<td>{{quotas.volumes}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Gigabytes"%}</td>
|
||||
<td>{{quotas.gigabytes}}GB</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Launch Instance"%}" />
|
||||
<a href="{% url horizon:nova:images:index %}" class="btn secondary cancel close">Cancel</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
{%load i18n%}
|
||||
<form id="launch_img" action="{% block form_url %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}8
|
||||
<input type="submit" value="{%trans "Launch Instance" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
</form>
|
|
@ -1,12 +1,4 @@
|
|||
{%load i18n%}
|
||||
|
||||
{% block footer_js %}
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function(){
|
||||
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% load i18n %}
|
||||
|
||||
{% load parse_date %}
|
||||
{% load launch_form %}
|
||||
|
@ -27,13 +19,18 @@
|
|||
<td>{{image.status|capfirst}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
{% if image.owner == request.user.username %}
|
||||
<li>{{ image.request.user.id }}<a class="btn small primary" data-controls-modal="launch_image_{{image.id}}" data-backdrop="static" href="{% url horizon:nova:images:launch image.id %}">{% trans "Launch" %}</a></li>
|
||||
{% if image.owner == request.user.tenant_id %}
|
||||
<li class="form">{% include "nova/images/_delete.html" with form=delete_form %}</li>
|
||||
<li><a href="{% url horizon:nova:images:update image.id %}">{%trans "Edit"%}</a></li>
|
||||
{% endif %}
|
||||
<li><a class="btn small" href="{% url horizon:nova:images:launch image.id %}">{%trans "Launch"%}</a></li>
|
||||
<li><a class='btn small' href="{% url horizon:nova:images:update image.id %}">{% trans "Edit" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% for image in images %}
|
||||
{% launch_form request request.user.tenant_id image.id as launch_form %}
|
||||
{% include 'nova/images/_launch.html' with form=launch_form image_id=image.id hide=True %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_id %}update_image_form{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:image:update %}{% endblock %}
|
||||
|
||||
{% block modal-header %}Update Image{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "From here you can modify different properties of an image."%}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Image"%}" />
|
||||
<a href="{% url horizon:nova:images:index %}" class="btn secondary cancel close">Cancel</a>
|
||||
{% endblock %}
|
|
@ -12,55 +12,7 @@
|
|||
{% include "horizon/common/_page_header.html" with title=_("Launch Instance") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block headerjs %}
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
// $("#foo").modal('show', {
|
||||
// 'backdrop': true,
|
||||
// })
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block dash_main %}
|
||||
<div class="modal static_page">
|
||||
<div class="modal-header">
|
||||
<h3>Launch Instances</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="left">
|
||||
{% include 'nova/images/_launch.html' with image_id=image.id %}
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Specify the details for launching an instance. Also please make note of the table below; all tenants have quotas which define the limit of resources they are allowed to provision."%}</p>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<th>{% trans "Quota Name"%}</th>
|
||||
<th>{% trans "Limit"%}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "RAM (MB)"%}</td>
|
||||
<td>{{quotas.ram}}MB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Floating IPs"%}</td>
|
||||
<td>{{quotas.floating_ips}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Instances"%}</td>
|
||||
<td>{{quotas.instances}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Volumes"%}</td>
|
||||
<td>{{quotas.volumes}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{% trans "Gigabytes"%}</td>
|
||||
<td>{{quotas.gigabytes}}GB</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'nova/images/_launch.html' with image_id=image.id %}
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -12,15 +12,5 @@
|
|||
{% endblock page_header %}
|
||||
|
||||
{% block dash_main %}
|
||||
<div class="dash_block">
|
||||
<div class="left">
|
||||
{% include 'nova/images/_form.html' %}
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "From here you can modify different properties of an image."%}</p>
|
||||
</div>
|
||||
<div class="clear"> </div>
|
||||
</div>
|
||||
{% include 'nova/images/_update.html' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{hidden}}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
<input type="submit" value="{%trans "Update Instance" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -61,12 +61,12 @@
|
|||
<td>{{instance.status|lower|capfirst}}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
<li class="form">{% include "horizon/common/instances/_terminate.html" with form=terminate_form %}</li>
|
||||
<li class="form">{% include "horizon/common/instances/_reboot.html" with form=reboot_form %}</li>
|
||||
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances:console instance.id %}">{% trans "Log"%}</a></li>
|
||||
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances:vnc instance.id %}">{% trans "VNC Console"%}</a></li>
|
||||
<li><a class="btn small" href="{% url horizon:nova:instances:update instance.id %}">{% trans "Edit"%}</a></li>
|
||||
<li><a class="btn small" href="{% url horizon:nova:snapshots:create instance.id %}">{% trans "Snapshot"%}</a></li>
|
||||
<li class="form">{% include "horizon/common/instances/_reboot.html" with form=reboot_form %}</li>
|
||||
<li class="form">{% include "horizon/common/instances/_terminate.html" with form=terminate_form %}</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/instances/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:snapshots:create instance.id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:snapshots:create instance.id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Snapshot"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,11 +1,24 @@
|
|||
{% extends 'nova/instances/_form.html' %}
|
||||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:instances:update instance.id %}{% endblock %}
|
||||
{% block form_id %}update_instance_form{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:instances:update instance.id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Instance"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
{% block modal-header %}Update Instance{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Update the name of your instance"%}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Instance"%}" />
|
||||
<a href="{% url horizon:nova:instances:index %}" class="btn secondary cancel close">Cancel</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -13,20 +13,7 @@
|
|||
{% endblock page_header %}
|
||||
|
||||
{% block dash_main %}
|
||||
<div id="update_instance_modal" class="modal static_page">
|
||||
<div class="modal-header">
|
||||
<h3>Update Instance</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="left">
|
||||
{% include 'nova/instances/_update.html' with form=form %}
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:"%}</h3>
|
||||
<p>{% trans "Update the name and description of your instance"%}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'nova/instances/_update.html' with form=form %}
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_js %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/keypairs/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:keypairs:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:keypairs:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Keypair"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form id="import_keypair_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form id="import_keypair_form" action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Add Keypair" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/keypairs/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:keypairs:import %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:keypairs:import %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Import Keypair"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'nova/networks/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'nova/networks/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Delete"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'nova/networks/_form.html' %}
|
||||
{% load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input name="network" type="hidden" value="{{network.id}}" />
|
||||
<input name="port" type="hidden" value="{{port.id}}" />
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
{% extends 'nova/networks/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input name="network" type="hidden" value="{{network.id}}" />
|
||||
<input name="port" type="hidden" value="{{port.id}}" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Create Network" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{%load i18n%}
|
||||
|
||||
<form id="import_keypair_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form id="copy_object_form" action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Add Keypair" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
{{hidden}}
|
||||
{% endfor %}
|
||||
<input name="object_name" type="hidden" value="{{ object.name }}" />
|
||||
<input id="delete_{{ object.name }}" class="delete" title="Object: {{ object.name }}" type="submit" value="{% trans "Delete"%}" />
|
||||
<input id="delete_{{ object.name }}" class="btn small danger delete" title="Object: {{ object.name }}" type="submit" value="{% trans "Delete"%}" />
|
||||
</form>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form id="object_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form id="object_form" action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Upload Object" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<td>{{ object.name }}</td>
|
||||
<td id="actions">
|
||||
<ul>
|
||||
<li><a href="{% url horizon:nova:containers:object_copy container_name object.name %}">{% trans "Copy"%}</a></li>
|
||||
<li><a class="btn small" href="{% url horizon:nova:containers:object_copy container_name object.name %}">{% trans "Copy"%}</a></li>
|
||||
<li><a class="btn small" href="{% url horizon:nova:containers:object_download container_name object.name %}">{% trans "Download"%}</a>
|
||||
<li class="form">{% include "nova/objects/_delete.html" with form=delete_form %}</li>
|
||||
<li><a href="{% url horizon:nova:containers:object_download container_name object.name %}">{% trans "Download"%}</a>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/keypairs/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:containers:object_upload container_name %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:containers:object_upload container_name %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Upload Object"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Update Instance" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/security_groups/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:security_groups:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:security_groups:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Security Group"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form id="security_group_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form id="security_group_form" action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Create Security Group" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary" type="submit" value="{% trans "Select Language" %}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/snapshots/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:snapshots:create instance.id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:snapshots:create instance.id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Snapshot"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Create Snapshot" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'nova/volumes/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:nova:volumes:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:nova:volumes:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Volume"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form id="volume_form" action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form id="volume_form" action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Create Security Group" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'syspanel/flavors/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Flavor"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Create Flavor" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Update Image" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'syspanel/images/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:images:update image.id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:images:update image.id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Image"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'syspanel/images/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:tenants:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:tenants:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Tenant"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "syspanel/tenants/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{% trans "Create Tenant"%}" class="large-rounded" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Update Tenant" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
{{ field.errors }}
|
||||
{{ field }}
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
{% endblock %}
|
||||
</form>
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'syspanel/images/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:tenants:update tenant_id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:tenants:update tenant_id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Tenant"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "syspanel/tenants/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{% trans "Update Tenant"%}" class="large-rounded" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends 'syspanel/images/_form.html' %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:tenants:quotas tenant_id %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:tenants:quotas tenant_id %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update Quotas"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "syspanel/tenants/_quotas_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{% trans "Update Quotas"%}" class="large-rounded" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends "syspanel/users/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Create Tenant"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "syspanel/users/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{% trans "Create User"%}" class="large-rounded" />
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{%load i18n%}
|
||||
<form action="{% block form_url %}{% endblock %}" method="post">
|
||||
<form action="{% block form_action %}{% endblock %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{%trans "Update Tenant" %}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{% extends "syspanel/users/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block form_url %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
{% block form_action %}{% url horizon:syspanel:users:create %}{% endblock %}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<div class="modal-footer">
|
||||
<input class="btn primary pull-right" type="submit" value="{%trans "Update User"%}" />
|
||||
<a href="#" class="btn secondary cancel close">Cancel</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends "syspanel/users/_form.html" %}
|
||||
{%load i18n%}
|
||||
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input type="submit" value="{% trans "Update User"%}" class="large-rounded" />
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -1,36 +1,16 @@
|
|||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="modal">
|
||||
<div class="modal-header">
|
||||
<h3>Log In</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{% url horizon:auth_login %}" method="post">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for hidden in form.hidden_fields %}
|
||||
{{ hidden }}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
{% block submit %}
|
||||
<input type="submit" value="{% trans "Login" %}" />
|
||||
{% endblock %}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% block modal-header %}Log In{% endblock %}
|
||||
|
||||
{% block form-action %}{% url horizon:auth_login %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input type="submit" class="btn primary pull-right" value="{% trans "Login" %}" />
|
||||
{% endblock %}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% block submit %}
|
||||
{% block modal-footer %}
|
||||
<input class="btn primary" type="submit" value="{%trans "Login"%}" />
|
||||
{% endblock %}
|
||||
</fieldset>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
{% for hidden in form.hidden_fields %}
|
||||
{{ hidden }}
|
||||
{% endfor %}
|
||||
{% for field in form.visible_fields %}
|
||||
<div class="clearfix{% if field.errors %} error{% endif %}">
|
||||
{{field.label_tag}}
|
||||
{% if field.errors %}
|
||||
{% for error in field.errors %}
|
||||
<span class="help-inline">{{error}}</span>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<span class="help-block">{{field.help_text}}</span>
|
||||
<div class="input">
|
||||
{{field}}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
|
@ -0,0 +1,16 @@
|
|||
<div id="{% block modal_id %}{% endblock %}" class="{% block modal_class %}modal{% if hide %} hide {% else %} static_page{% endif %}{% endblock %}">
|
||||
<form id="{% block form_id %}{% endblock %}" class="{% block form_class %}{% endblock %}" action="{% block form_action %}{% endblock %}" method="{% block form-method %}POST{% endblock %}">{% csrf_token %}
|
||||
<div class="modal-header">
|
||||
{% if hide %}<a href="#" class="close">×</a>{% endif %}
|
||||
<h3>{% block modal-header %}{% endblock %}</h3>
|
||||
</div>
|
||||
<div class="modal-body clearfix">
|
||||
{% block modal-body %}
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="modal-footer">{% block modal-footer %}{% endblock %}</div>
|
||||
</form>
|
||||
</div>
|
|
@ -5,5 +5,5 @@
|
|||
{{ hidden }}
|
||||
{% endfor %}
|
||||
<input name="instance" type="hidden" value="{{ instance.id }}" />
|
||||
<input id="terminate_{{instance.id}}" class="terminate" title="{{ instance.name }}" type="submit" value="{% trans "Terminate" %}" />
|
||||
<input id="terminate_{{instance.id}}" class="btn small danger terminate" title="{{ instance.name }}" type="submit" value="{% trans "Terminate" %}" />
|
||||
</form>
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
Classes and methods related to user handling in Horizon.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
from horizon import exceptions
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def get_user_from_request(request):
|
||||
""" Checks the current session and returns a :class:`~horizon.users.User`.
|
||||
|
@ -34,11 +41,12 @@ def get_user_from_request(request):
|
|||
If the session contains invalid data,
|
||||
:exc:`~horizon.exceptions.NotAuthorized` will be raised.
|
||||
"""
|
||||
if 'user' not in request.session:
|
||||
if 'user_id' not in request.session:
|
||||
return User()
|
||||
try:
|
||||
return User(token=request.session['token'],
|
||||
user=request.session['user'],
|
||||
return User(id=request.session['user_id'],
|
||||
token=request.session['token'],
|
||||
user=request.session['user_name'],
|
||||
tenant_id=request.session['tenant_id'],
|
||||
tenant_name=request.session['tenant'],
|
||||
service_catalog=request.session['serviceCatalog'],
|
||||
|
@ -46,6 +54,7 @@ def get_user_from_request(request):
|
|||
except KeyError:
|
||||
# If any of those keys are missing from the session it is
|
||||
# overwhelmingly likely that we're dealing with an outdated session.
|
||||
LOG.exception("Error while creating User from session.")
|
||||
request.session.clear()
|
||||
raise exceptions.NotAuthorized(_("Your session has expired. "
|
||||
"Please log in again."))
|
||||
|
@ -91,8 +100,9 @@ class User(object):
|
|||
Boolean value indicating whether or not this user has admin
|
||||
privileges. Internally mapped to :meth:`horizon.users.User.is_admin`.
|
||||
"""
|
||||
def __init__(self, token=None, user=None, tenant_id=None,
|
||||
def __init__(self, id=None, token=None, user=None, tenant_id=None,
|
||||
service_catalog=None, tenant_name=None, roles=None):
|
||||
self.id = id
|
||||
self.token = token
|
||||
self.username = user
|
||||
self.tenant_id = tenant_id
|
||||
|
|
|
@ -44,7 +44,8 @@ def _set_session_data(request, token):
|
|||
request.session['tenant'] = token.tenant['name']
|
||||
request.session['tenant_id'] = token.tenant['id']
|
||||
request.session['token'] = token.id
|
||||
request.session['user'] = token.user['name']
|
||||
request.session['user_name'] = token.user['name']
|
||||
request.session['user_id'] = token.user['id']
|
||||
request.session['roles'] = token.user['roles']
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ html, #splash{
|
|||
}
|
||||
|
||||
#create_container_form .modal-footer{
|
||||
margin-top: 190px;
|
||||
margin-top: 190px;
|
||||
}
|
||||
|
||||
.nav li a {
|
||||
|
@ -308,6 +308,10 @@ table form {
|
|||
width: 1px;
|
||||
}
|
||||
|
||||
.modal > form {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
#actions.single {
|
||||
width: 90px;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{% extends 'horizon/auth/_login.html' %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block submit %}
|
||||
<input type="hidden" name="next" value="/" />
|
||||
{% block modal-footer %}
|
||||
<input id="home_login_btn" class="btn primary pull-right" type="submit" value="{% trans "Sign In"%}">
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue