Hiding unusable actions for instances that are not in the active state

Change-Id: If663197ad74535b1cf724531c721933d34169487
This commit is contained in:
jakedahn
2011-12-13 22:57:41 -08:00
parent c2826ffc48
commit 96e82806fc
2 changed files with 37 additions and 34 deletions

View File

@@ -1,4 +1,3 @@
<!-- TODO(termie): move most of this to horizon -->
{% load sizeformat %}
{% load i18n %}
@@ -19,10 +18,10 @@
<thead>
<tr>
<th></th>
<th>{% trans "Name"%}</th>
<th>{% trans "Size"%}</th>
<th>{% trans "State"%}</th>
<th>{% trans "Actions"%}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Size" %}</th>
<th>{% trans "State" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
@@ -41,11 +40,13 @@
<td id="name_{{ instance.name }}" class="actions">
<a class="more-actions" href="#">More</a>
<ul>
<li><a class="btn small" target='_blank' href='{% url horizon:nova:instances_and_volumes:instances:vnc instance.id %}'>{% trans 'VNC Console'%}</a></li>
<li><a class='btn small' target='_blank' href='{% url horizon:nova:instances_and_volumes:instances:console instance.id %}'>{% trans 'Log'%}</a></li>
<li><a class='btn small' href='{% url horizon:nova:instances_and_volumes:instances:update instance.id %}'>{% trans 'Edit'%}</a></li>
<li><a class='btn small' href='{% url horizon:nova:images_and_snapshots:snapshots:create instance.id %}'>{% trans 'Snapshot'%}</a></li>
<li>{% include 'nova/instances_and_volumes/instances/_reboot.html' with form=reboot_form %}</li>
{% if instance.status != "ACTIVE" %}
<li><a class="btn small" target='_blank' href='{% url horizon:nova:instances_and_volumes:instances:vnc instance.id %}'>{% trans 'VNC Console' %}</a></li>
<li><a class='btn small' target='_blank' href='{% url horizon:nova:instances_and_volumes:instances:console instance.id %}'>{% trans 'Log' %}</a></li>
<li><a class='btn small' href='{% url horizon:nova:images_and_snapshots:snapshots:create instance.id %}'>{% trans 'Snapshot' %}</a></li>
<li>{% include 'nova/instances_and_volumes/instances/_reboot.html' with form=reboot_form %}</li>
{% endif %}
<li><a class='btn small' href='{% url horizon:nova:instances_and_volumes:instances:update instance.id %}'>{% trans 'Edit' %}</a></li>
<li>{% include 'nova/instances_and_volumes/instances/_terminate.html' with form=terminate_form %}</li>
</ul>
</td>

View File

@@ -1,52 +1,54 @@
{% load parse_date %}
{% load i18n%}
{% load i18n %}
<table id="instances" class="zebra-striped">
<tr>
<th>{% trans "Name"%}</th>
<th>{% trans "Tenant"%}</th>
<th>{% trans "User"%}</th>
<th>{% trans "Host"%}</th>
<th>{% trans "Created"%}</th>
<th>{% trans "Image"%}</th>
<th>{% trans "IPs"%}</th>
<th>{% trans "State"%}</th>
<th>{% trans "Actions"%}</th>
<th>{% trans "Name" %}</th>
<th>{% trans "Tenant" %}</th>
<th>{% trans "User" %}</th>
<th>{% trans "Host" %}</th>
<th>{% trans "Created" %}</th>
<th>{% trans "Image" %}</th>
<th>{% trans "IPs" %}</th>
<th>{% trans "State" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
{% for instance in instances %}
<tr id="{{instance.id}}" class="{% cycle "odd" "even" %}">
<td><a href="{% url horizon:syspanel:instances:detail instance.id %}">{{instance.name}} <small>(id: {{instance.id}})</small></a></td>
<td>{{instance.attrs.tenant_id}}</td>
<td>{{instance.attrs.user_id}}</td>
<td class="name">{{instance.attrs.host}}</td>
<td>{{instance.attrs.launched_at|parse_date}}</td>
<td>{{instance.image_name}}</td>
<tr id="{{ instance.id }}" class="{% cycle "odd" "even" %}">
<td><a href="{% url horizon:syspanel:instances:detail instance.id %}">{{ instance.name }} <small>(id: {{ instance.id }})</small></a></td>
<td>{{ instance.attrs.tenant_id }}</td>
<td>{{ instance.attrs.user_id }}</td>
<td class="name">{{ instance.attrs.host }}</td>
<td>{{ instance.attrs.launched_at|parse_date }}</td>
<td>{{ instance.image_name }}</td>
<td class="ip_list">
{% for ip_group, addresses in instance.addresses.items %}
{% if instance.addresses.items|length > 1 %}
<h4>{{ip_group}}</h4>
<h4>{{ ip_group }}</h4>
<ul>
{% for address in addresses %}
<li>{{address.addr}}</li>
<li>{{ address.addr }}</li>
{% endfor %}
</ul>
{% else %}
<ul>
{% for address in addresses %}
<li>{{address.addr}}</li>
<li>{{ address.addr }}</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
</td>
<td>{{instance.status|lower|capfirst}}</td>
<td>{{ instance.status|lower|capfirst }}</td>
<td id="actions">
<ul>
<li class="form">{% include "syspanel/instances/_terminate.html" with form=terminate_form %}</li>
{% if instance.status != "ACTIVE" %}
<li class="form">{% include "syspanel/instances/_reboot.html" with form=reboot_form %}</li>
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances_and_volumes:instances:console instance.id %}">{% trans "Console Log"%}</a></li>
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances_and_volumes:instances:vnc instance.id %}">{% trans "VNC Console"%}</a></li>
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances_and_volumes:instances:console instance.id %}">{% trans "Console Log" %}</a></li>
<li><a class="btn small" target="_blank" href="{% url horizon:nova:instances_and_volumes:instances:vnc instance.id %}">{% trans "VNC Console" %}</a></li>
{% endif %}
<li class="form">{% include "syspanel/instances/_terminate.html" with form=terminate_form %}</li>
</ul>
</td>
</tr>