diff --git a/tuskar_ui/infrastructure/nodes/templates/nodes/_detail_overview.html b/tuskar_ui/infrastructure/nodes/templates/nodes/_detail_overview.html index 9803f02b6..d43f3ac4a 100644 --- a/tuskar_ui/infrastructure/nodes/templates/nodes/_detail_overview.html +++ b/tuskar_ui/infrastructure/nodes/templates/nodes/_detail_overview.html @@ -1,15 +1,12 @@ {% load i18n %} +{% load icon_helpers %}
-

{% trans "Status" %}

-

- - {% trans "Powered" %} {{ node.power_state|default:"—" }} -

+

{{ node.power_state|iconized_ironic_node_state|safe }}

{% trans "Inventory" %}

-
+
{% trans "Node UUID" %}
{{ node.uuid|default:"—" }}
{% trans "Driver" %}
@@ -43,7 +40,11 @@
{% trans "Network Cards" %}
- {{ node.addresses|length }} + {% blocktrans count addresses_length=node.addresses|length %} + {{ addresses_length }} interface + {% plural %} + {{ addresses_length }} interfaces + {% endblocktrans %}
@@ -64,7 +65,7 @@

{% trans "Deployment" %}

-
+
{% trans "Deployment Role" %}
{% if stack and role %}
{{ role.name }}
diff --git a/tuskar_ui/infrastructure/roles/templates/roles/detail.html b/tuskar_ui/infrastructure/roles/templates/roles/detail.html index c49fee6e1..03ec23343 100644 --- a/tuskar_ui/infrastructure/roles/templates/roles/detail.html +++ b/tuskar_ui/infrastructure/roles/templates/roles/detail.html @@ -10,10 +10,10 @@ {% block main %}
-
+

{% trans "Properties" %}

-

{% blocktrans count counter=nodes|length %}{{ counter }} instance{% plural %}{{ counter }} instances{% endblocktrans %}

-
+

{% blocktrans count counter=nodes|length %}{{ counter }} instance{% plural %}{{ counter }} instances{% endblocktrans %}

+
{% trans 'Flavor' %}
{% if flavor %}
{{ flavor.name }} {{ flavor.get_keys.cpu_arch }} | {{ flavor.vcpus }} {% trans "CPU" %} | {{ flavor.ram }} {% trans "MB RAM" %} | {{ flavor.disk }} {% trans "GB HDD" %}
@@ -28,7 +28,7 @@ {% endif %}
-
+

{% trans "Performance & Metrics" %}

{% url 'horizon:infrastructure:roles:performance' role.uuid as node_perf_url %} {% include "infrastructure/_performance_chart_box.html" with meter_conf=meter_conf node_perf_url=node_perf_url col_size=4 %} diff --git a/tuskar_ui/infrastructure/static/infrastructure/scss/_individual_pages.scss b/tuskar_ui/infrastructure/static/infrastructure/scss/_individual_pages.scss index da7ba9a68..1a1262d26 100644 --- a/tuskar_ui/infrastructure/static/infrastructure/scss/_individual_pages.scss +++ b/tuskar_ui/infrastructure/static/infrastructure/scss/_individual_pages.scss @@ -115,10 +115,6 @@ $link-color: #428bca; .fa.powerstate { display: inline-block; vertical-align: middle; - font-size: 18px; - background: $gray-lighter; - border: 1px solid $gray-light; - padding: .2em; &.fa-play { color: $brand-success; } diff --git a/tuskar_ui/infrastructure/templatetags/icon_helpers.py b/tuskar_ui/infrastructure/templatetags/icon_helpers.py new file mode 100644 index 000000000..c4e9fb516 --- /dev/null +++ b/tuskar_ui/infrastructure/templatetags/icon_helpers.py @@ -0,0 +1,58 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from django import template +from django.utils.translation import ugettext_lazy as _ + + +register = template.Library() + +IRONIC_NODE_STATE_STRING_DICT = { + 'active': _('powered on'), + 'wait call-back': _('waiting'), + 'deploying': _('deploying'), + 'deploy failed': _('deployment failed'), + 'deploy complete': _('deployment complete'), + 'deleting': _('deleting'), + 'deleted': _('deleted'), + 'error': _('error'), + 'rebuild': _('rebuilding'), + 'power on': _('powered on'), + 'power off': _('powered off'), + 'rebooting': _('rebooting'), +} + +IRONIC_NODE_STATE_ICON_DICT = { + 'active': 'fa-play', + 'wait call-back': 'fa-spinner', + 'deploying': 'fa-spinner', + 'deploy failed': 'fa-warning', + 'deploy complete': 'fa-ok', + 'deleting': 'fa-spinner', + 'deleted': 'fa-cancel', + 'error': 'fa-warning', + 'rebuild': 'fa-spinner', + 'power on': 'fa-play', + 'power off': 'fa-stop', + 'rebooting': 'fa-spinner', +} + + +@register.filter(is_safe=True) +def iconized_ironic_node_state(node_power_state): + state = IRONIC_NODE_STATE_STRING_DICT.get(node_power_state, "—") + icon = IRONIC_NODE_STATE_ICON_DICT.get(node_power_state, None) + html_string = """ + %s """ % (icon, state) + + return html_string