Show label with status icon. Improves sorting as well

Change-Id: I7d3b0e0f6749976a5cff8df4d388c1f821bb1e7e
This commit is contained in:
Rob Raymond 2015-02-10 15:18:34 -07:00
parent 1130a7fe2f
commit 0536dd6e31
3 changed files with 12 additions and 6 deletions

View File

@ -40,15 +40,15 @@ def get_status(index):
def show_status(data):
status = data
img_tag = '<img src="%s" title="%s"/>'
img_tag = '<img src="{img}" title="{label}" class="status-icon" />{label}'
if status == 'CRITICAL':
return img_tag % (constants.CRITICAL_ICON, status)
return img_tag.format(img=constants.CRITICAL_ICON, label=status)
if status in ('LOW', 'MEDIUM', 'HIGH'):
return img_tag % (constants.WARNING_ICON, status)
return img_tag.format(img=constants.WARNING_ICON, label=status)
if status == 'OK':
return img_tag % (constants.OK_ICON, status)
return img_tag.format(img=constants.OK_ICON, label=status)
if status == 'UNKNOWN' or status == 'UNDETERMINED':
return img_tag % (constants.UNKNOWN_ICON, status)
return img_tag.format(img=constants.UNKNOWN_ICON, label=status)
return status

View File

@ -16,4 +16,10 @@
{% block main %}
{{ table.render }}
<style>
.status-icon {
vertical-align: top;
margin-right: 2px;
}
</style>
{% endblock %}

View File

@ -16,4 +16,4 @@ selenium
sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3
oslosphinx
http://tarballs.openstack.org/horizon/horizon-master.tar.gz#egg=horizon
http://tarballs.openstack.org/horizon/horizon-2014.2.tar.gz#egg=horizon