Cleanup on syspanel.images code, and unuset template removal.

A lot of templates got left behind after the datatables refactor which
are no longer used or necessary.

There was also some strange behavior in the syspanel images table
where outdated javascript would try to hide other rows in the table
causing bad behavior.

Change-Id: If7aa226336f0814782522b20c76eadc39613c372
This commit is contained in:
Gabriel Hurley 2012-02-10 15:14:32 -08:00
parent b63e495f09
commit 797c497312
31 changed files with 23 additions and 396 deletions

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_delete_{{ rule.id }}" class="form-delete" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="security_group_rule_id" type="hidden" value="{{ rule.id }}" />
<input id="delete_{{ rule.id }}" class="btn small danger delete" title="Security Group: {{ rule.id }}" type="submit" value="{% trans "Delete" %}" />
</form>

View File

@ -1,8 +0,0 @@
{% load i18n %}
<div class="alert alert-block alert-info">
<p><strong>{% trans "Info: " %}</strong>{% trans "There are no instances running. Launch an instance from the Images Page." %}</p>
<div class="alert-actions pull-right">
<a class="btn small primary" href='{% url horizon:nova:images_and_snapshots:index %}'>{% trans "Images Page" %}</a>
</div>
</div>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_pause_{{ instance.id }}" class="form-pause form-line" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="pause_{{ instance.id }}" class="btn small pause" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Pause" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_reboot_{{ instance.id }}" class="form-reboot form-inline" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="reboot_{{ instance.id }}" class="btn small reboot" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Reboot" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_resume_{{ instance.id }}" class="form-resume form-inline" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="resume_{{ instance.id }}" class="btn small resume" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Resume" %}" />
</form>

View File

@ -1,11 +0,0 @@
{% extends 'nova/instances_and_volumes/instances/_form.html' %}
{% load i18n %}
{% block form_action %}{% url horizon:nova:images_and_snapshots:snapshots:create instance.id %}{% endblock %}
{% 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">{% trans "Cancel" %}</a>
</div>
{% endblock %}

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_suspend_{{ instance.id }}" class="form-suspend" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="suspend_{{ instance.id }}" class="btn small suspend" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Suspend" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_terminate_{{ instance.id }}" class="form-terminate" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="terminate_{{instance.id}}" class="btn small danger terminate" title="{{ instance.name }}" type="submit" value="{% trans "Terminate" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_unpause_{{ instance.id }}" class="form-unpause form-line" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="unpause_{{ instance.id }}" class="btn small unpause" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Unpause" %}" />
</form>

View File

@ -1,10 +0,0 @@
{% load i18n %}
<form id="form_delete_{{ volume.id }}" class="form-delete" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="volume_id" type="hidden" value="{{ volume.id }}" />
<input name="volume_name" type="hidden" value="{{ volume.displayName }}" />
<input id="delete_{{ volume.id }}" class="btn small danger delete" title="Volume: {{ volume.displayName }}" type="submit" value="{% trans "Delete" %}" />
</form>

View File

@ -1,11 +0,0 @@
{% load i18n %}
<form id="form_detach_{{ attachment.volumeId }}" class="form-delete" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="volume_id" type="hidden" value="{{ attachment.volumeId }}" />
<input name="instance_id" type="hidden" value="{{ attachment.serverId }}" />
<input name="attachment_id" type="hidden" value="{{ attachment.id }}" />
<input id="detach_{{ attachment.volumeId }}" class="btn small detach" title="{% trans "volume" %} {{ attachment.volumeId }} {% trans "from the instance" %} {{ attachment.serverId }}" type="submit" value="{% trans "Detach" %}" />
</form>

View File

@ -1,27 +0,0 @@
{% load i18n %}
<form id="volume_form" action="{% block form_action %}{% 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 modal-footer %}
<input type="submit" value="{% trans "Create Security Group" %}" />
{% endblock %}
</fieldset>
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_delete_{{ image.id }}" class="form-delete" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="image_id" type="hidden" value="{{ image.id }}" />
<input id="delete_{{ image.id }}" class="btn small delete" title="Image: {{ image.name }}" type="submit" value="{% trans "Delete" %}" />
</form>

View File

@ -1,27 +0,0 @@
{% load i18n %}
<form action="{% block form_action %}{% 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 modal-footer %}
<input type="submit" value="{% trans "Update Image" %}" />
{% endblock %}
</fieldset>
</form>

View File

@ -1,46 +0,0 @@
{% load parse_date %}
{% load i18n %}
<table class="zebra-striped">
<tr>
<th>{% trans "ID" %}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "Public" %}</th>
<th>{% trans "Created" %}</th>
<th>{% trans "Updated" %}</th>
<th colspan="2">{% trans "Status" %}</th>
</tr>
{% for image in images %}
<tr id="images" class="{% cycle 'odd' 'even' %}">
<td>{{ image.id }}</td>
<td>{{ image.name }}</td>
<td>{{ image.size|filesizeformat }}</td>
<td>{{ image.is_public }}</td>
<td>{{ image.created_at|parse_date }}</td>
<td>{{ image.updated_at|parse_date }}</td>
<td>{{ image.status|capfirst }}</td>
<td id="actions">
<ul>
<li class="form">{% include "syspanel/images/_delete.html" with form=delete_form %}</li>
{# <li class="form">{% include "syspanel/images/_toggle.html" with form=toggle_form %}</li> #}
<li><a class="btn small" href="{% url horizon:syspanel:images:update image.id %}">{% trans "Edit" %}</a></li>
</ul>
</td>
</tr>
<tr class="details">
<td class="properties" colspan="9">
<ul>
<li><span>{% trans "Location" %}: </span>{{ image.properties.image_location }}</li>
<li><span>{% trans "State" %}: </span>{{ image.properties.image_state }}</li>
<li><span>{% trans "Kernel ID" %}: </span>{{ image.properties.kernel_id }}</li>
<li><span>{% trans "Ramdisk ID" %}: </span>{{ image.properties.ramdisk_id }}</li>
<li><span>{% trans "Architecture" %}: </span>{{ image.properties.architecture }}</li>
<li><span>{% trans "Project ID" %}: </span>{{ image.properties.project_id }}</li>
<li><span>{% trans "Container Format" %}: </span>{{ image.container_format }}</li>
<li><span>{% trans "Disk Format" %}: </span>{{ image.disk_format }}</li>
</ul>
</td>
</tr>
{% endfor %}
</table>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_toggle_{{ image.id }}" class="form-toggle" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="image_id" type="hidden" value="{{ image.id }}" />
<input id="toggle_{{ image.id }}" class="toggle" type="submit" value="{% trans "Toggle Public" %}" />
</form>

View File

@ -1,11 +1,25 @@
{% extends 'syspanel/images/_form.html' %}
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% block form_action %}{% url horizon:syspanel:images:update image.id %}{% endblock %}
{% block form_id %}udate_image_form{% endblock %}
{% block form_action %}{% url horizon:syspanel:images:update %}{% endblock %}
{% 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">{% trans "Cancel" %}</a>
{% block modal_id %}update_image_modal{% endblock %}
{% block modal-header %}{% trans "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:syspanel:images:index %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -1,24 +1,12 @@
{% extends 'syspanel/base.html' %}
{% load i18n %}
{% block title %}Update Image{% endblock %}
{% block title %}{% trans "Update Image" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Update Image") %}
{% endblock page_header %}
{% block syspanel_main %}
<div class="modal static_page">
<div class="modal-header">
<h3>Update Image</h3>
</div>
<div class="modal-body">
<div class="left">
{% include 'syspanel/images/_update.html' %}
</div>
<div class="right">
<h3>{% trans "Description" %}:</h3>
<p>{% trans "From here you can modify different properties of an image." %}</p>
</div>
</div>
</div>
{% include 'syspanel/images/_update.html' %}
{% endblock %}

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_pause_{{ instance.id }}" class="form-pause form-line" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="pause_{{ instance.id }}" class="btn small pause" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Unpause" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_reboot_{{ instance.id }}" class="form-reboot" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="reboot_{{ instance.id }}" class="btn small reboot" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Reboot" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_resume_{{ instance.id }}" class="form-resume form-inline" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="resume_{{ instance.id }}" class="btn small resume" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Resume" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_suspend_{{ instance.id }}" class="form-suspend" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="suspend_{{ instance.id }}" class="suspend" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Suspend" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_terminate_{{ instance.id }}" class="form-terminate" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="terminate_{{instance.id}}" class="btn small danger terminate" title="{{ instance.name }}" type="submit" value="{% trans "Terminate" %}" />
</form>

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_unpause_{{ instance.id }}" class="form-unpause form-line" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="instance" type="hidden" value="{{ instance.id }}" />
<input id="unpause_{{ instance.id }}" class="btn small unpause" title="Instance: {{ instance.name }}" type="submit" value="{% trans "Unpause" %}" />
</form>

View File

@ -1,26 +0,0 @@
{% load i18n sizeformat %}
{% if service.type == 'nova-compute' %}
<ul>
<li>
{% trans "Hypervisor" %}: {{ service.stats.hypervisor_type }}( {{ service.stats.cpu_info.features|join:', ' }})
</li>
<li>
{% trans "Allocable Cores" %}:
{{ service.stats.max_vcpus }}
({{ service.stats.vcpus_used }} Used, {{ service.stats.vcpus }} Physical/Virtual)
</li>
<li>
{% trans "Allocable Storage" %}:
{{ service.stats.max_gigabytes|diskgbformat }}
({{ service.stats.local_gb_used|diskgbformat }} Used, {{ service.stats.local_gb|diskgbformat }} Physical)
</li>
<li>
{% trans "System Ram" %}:
{{ service.stats.memory_mb|mbformat }}
({{ service.stats.memory_mb_used|mbformat }} Used)
</li>
</ul>
{% else %}
<span>&nbsp;-&nbsp;</span>
{% endif %}

View File

@ -1,22 +0,0 @@
{% load i18n %}
{% if service.disabled %}
<form id="form_service_enable_{{ service.id }}" class="form-service-enable" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="service" type="hidden" value="{{ service.id }}" />
<input name="name" type="hidden" value="{{ service.type }}" />
<input id="enable_{{ service.id }}" class="enable" title="Service: {{ service.type }}" type="submit" value="{% trans "Enable" %}" />
</form>
{% else %}
<form id="form_service_disable_{{ service.id }}" class="form-service-disable" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="service" type="hidden" value="{{ service.id }}" />
<input name="name" type="hidden" value="{{ service.type }}" />
<input id="disable_{{ service.id }}" class="btn small disable" title="Service: {{ service.type }}" type="submit" value="{% trans "Disable" %}" />
</form>
{% endif %}

View File

@ -1,9 +0,0 @@
{% load i18n %}
<form id="form_user_delete{{ user.id }}" class="form-user-delete" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="user" type="hidden" value="{{ user.id }}" />
<input id="enable_{{ user.id }}" class="btn small danger delete" title="User: {{ user.id }}" type="submit" value="{% trans "Delete" %}" />
</form>

View File

@ -1,9 +0,0 @@
<form id="form_user_enable_disable{{ user.id }}" class="form-enable_disable" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="id" type="hidden" value="{{ user.id }}" />
<input name="enabled" type="hidden" value="{{ user.enabled|yesno:"disable,enable,None" }}" />
<input id="enable_{{ user.id }}" class="btn small {{ user.enabled|yesno:"disable,enable,None" }}" title="User: {{ user.id }}" type="submit" value="{{ user.enabled|yesno:"Disable,Enable,Error" }}" />
</form>

View File

@ -1,20 +0,0 @@
{% load i18n %}
{% if user.enabled %}
<form id="form_user_disable_{{ user.id }}" class="form-user-disable" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="user" type="hidden" value="{{ user.id }}" />
<input id="disable_{{ user.id }}" class="disable" title="User: {{ user.id }}" type="submit" value="{% trans "Disable" %}" />
</form>
{% else %}
<form id="form_user_enable_{{ user.id }}" class="form-user-enable" method="post">
{% csrf_token %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<input name="user" type="hidden" value="{{ user.id }}" />
<input id="enable_{{ user.id }}" class="enable" title="User: {{ user.id }}" type="submit" value="{% trans "Enable" %}" />
</form>
{% endif %}

View File

@ -1,13 +0,0 @@
horizon.addInitFunction(function() {
// Show/hide tenant list in left nav.
$(".drop_btn").click(function(){
$(this).parent().children('.item_list').toggle();
return false;
});
// Show/hide image details.
$(".details").hide();
$("#images td:not(#actions)").click(function(e) {
$(this).parent().nextUntil(".even, .odd").fadeToggle("slow");
});
});

View File

@ -26,7 +26,6 @@
<script src='{{ STATIC_URL }}dashboard/js/tables.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}dashboard/js/modals.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}dashboard/js/forms.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}dashboard/js/navigation.js' type='text/javascript' charset='utf-8'></script>
<script src='{{ STATIC_URL }}dashboard/js/form_examples.js' type='text/javascript'></script>
<link href='{{ STATIC_URL }}dashboard/css/bootstrap.css' media='screen' rel='stylesheet' />
<link href='{{ STATIC_URL }}dashboard/css/style.css' media='screen' rel='stylesheet' />