summaryrefslogtreecommitdiff
path: root/openstack_dashboard/dashboards/admin/info
diff options
context:
space:
mode:
authorliyingjun <yingjun.li@kylin-cloud.com>2015-01-30 10:48:06 +0800
committerliyingjun <yingjun.li@kylin-cloud.com>2015-02-10 09:31:22 +0800
commit31eb118235a87b61d65c5e4247aadf95e4ae536c (patch)
tree42cba7decfd52231106230fa4a4bc47d1ed244e6 /openstack_dashboard/dashboards/admin/info
parentd53c662a7944396c259d2e762d7b54bf34fb2fe1 (diff)
downloadhorizon-31eb118235a87b61d65c5e4247aadf95e4ae536c.tar.gz
Translatable system information panel state/status
On the Admin->System->System Information panel on the Compute Services and Block Storage Services tabs Status and State are not translatable. Change-Id: I127346bc5ecdf8d20bf2609d1b956c3ee03fbe2e Closes-bug: #1416105
Diffstat (limited to 'openstack_dashboard/dashboards/admin/info')
-rw-r--r--openstack_dashboard/dashboards/admin/info/tables.py16
-rw-r--r--openstack_dashboard/dashboards/admin/info/templates/info/_cell_status.html10
2 files changed, 17 insertions, 9 deletions
diff --git a/openstack_dashboard/dashboards/admin/info/tables.py b/openstack_dashboard/dashboards/admin/info/tables.py
index 1f16d8e4b..262fb4c6f 100644
--- a/openstack_dashboard/dashboards/admin/info/tables.py
+++ b/openstack_dashboard/dashboards/admin/info/tables.py
@@ -27,6 +27,11 @@ SERVICE_STATUS_DISPLAY_CHOICES = (
(SERVICE_DISABLED, _("Disabled")),
)
+SERVICE_STATE_DISPLAY_CHOICES = (
+ ('up', _("Up")),
+ ('down', _("Down")),
+)
+
class ServiceFilterAction(tables.FilterAction):
filter_field = 'type'
@@ -76,7 +81,7 @@ def get_available(zone):
return zone.zoneState['available']
-def get_nova_agent_status(agent):
+def get_agent_status(agent):
template_name = 'admin/info/_cell_status.html'
context = {
'status': agent.status,
@@ -89,9 +94,9 @@ class NovaServicesTable(tables.DataTable):
binary = tables.Column("binary", verbose_name=_('Name'))
host = tables.Column('host', verbose_name=_('Host'))
zone = tables.Column('zone', verbose_name=_('Zone'))
- status = tables.Column(get_nova_agent_status, verbose_name=_('Status'))
+ status = tables.Column(get_agent_status, verbose_name=_('Status'))
state = tables.Column('state', verbose_name=_('State'),
- filters=(filters.title,))
+ display_choices=SERVICE_STATE_DISPLAY_CHOICES)
updated_at = tables.Column('updated_at',
verbose_name=pgettext_lazy(
'Time since the last update',
@@ -113,10 +118,9 @@ class CinderServicesTable(tables.DataTable):
binary = tables.Column("binary", verbose_name=_('Name'))
host = tables.Column('host', verbose_name=_('Host'))
zone = tables.Column('zone', verbose_name=_('Zone'))
- status = tables.Column('status', verbose_name=_('Status'),
- filters=(filters.title, ))
+ status = tables.Column(get_agent_status, verbose_name=_('Status'))
state = tables.Column('state', verbose_name=_('State'),
- filters=(filters.title, ))
+ display_choices=SERVICE_STATE_DISPLAY_CHOICES)
updated_at = tables.Column('updated_at',
verbose_name=pgettext_lazy(
'Time since the last update',
diff --git a/openstack_dashboard/dashboards/admin/info/templates/info/_cell_status.html b/openstack_dashboard/dashboards/admin/info/templates/info/_cell_status.html
index d5a88d166..ec9748527 100644
--- a/openstack_dashboard/dashboards/admin/info/templates/info/_cell_status.html
+++ b/openstack_dashboard/dashboards/admin/info/templates/info/_cell_status.html
@@ -1,5 +1,9 @@
{% load i18n %}
-{{ status|title }}
-{% if status == 'disabled' and disabled_reason %}
-<br/><i>{% blocktrans %}Reason: {{ disabled_reason }}{% endblocktrans %}</i>
+{% if status == 'disabled' %}
+ {% trans "Disabled"%}
+ {% if disabled_reason %}
+ <br/><i>{% blocktrans %}Reason: {{ disabled_reason }}{% endblocktrans %}</i>
+ {% endif %}
+{% else %}
+ {% trans "Enabled"%}
{% endif %}