diff --git a/tuskar_boxes/overview/views.py b/tuskar_boxes/overview/views.py index ac051aa..11fb69c 100644 --- a/tuskar_boxes/overview/views.py +++ b/tuskar_boxes/overview/views.py @@ -17,6 +17,7 @@ import operator from django.core.urlresolvers import reverse import django.utils.text +from django.utils.translation import ugettext_lazy as _ from openstack_dashboard.api import base as api_base from tuskar_ui import api @@ -78,6 +79,8 @@ def _node_data(request, nodes): 'uuid': node.uuid, 'role_name': role.name if role else '', 'role_slug': django.utils.text.slugify(role.name) if role else '', + 'node_title': unicode(_("{0} node").format(role.name.title()) + if role else _("Free node")), 'state': node.state, 'state_slug': django.utils.text.slugify(unicode(node.state)), 'state_icon': NODE_STATE_ICON.get(node.state, @@ -115,6 +118,13 @@ class IndexView(views.IndexView): def get_data(self, request, context, *args, **kwargs): data = super(IndexView, self).get_data(request, context, *args, **kwargs) + nodes = list(_node_data( + request, api.node.Node.list(request, maintenance=False), + )) + nodes.sort(key=lambda node: node.get('role_name')) + nodes.reverse() + data['nodes'] = nodes + if not data['stack']: flavors = api.flavor.Flavor.list(self.request) if not MATCHING_DEPLOYMENT_MODE: @@ -126,7 +136,8 @@ class IndexView(views.IndexView): free_roles = [] flavor_roles = {} for role in roles: - role['flavor_field'] = data['form'][role['id'] + '-flavor'] + if 'form' in data: + role['flavor_field'] = data['form'][role['id'] + '-flavor'] flavor = role['role'].flavor(data['plan']) if flavor in flavors: role['flavor_name'] = flavor.name @@ -138,13 +149,6 @@ class IndexView(views.IndexView): data['flavors'] = list( _flavor_data(self.request, flavors, flavor_roles)) else: - nodes = list(_node_data( - request, api.node.Node.list(request, maintenance=False), - )) - - nodes.sort(key=lambda node: node.get('role_name')) - nodes.reverse() - data['nodes'] = nodes distribution = collections.Counter() for node in nodes: diff --git a/tuskar_boxes/static/tuskar_boxes/js/tuskar.boxes_progress.js b/tuskar_boxes/static/tuskar_boxes/js/tuskar.boxes_progress.js index 7cfc299..5f98e1b 100644 --- a/tuskar_boxes/static/tuskar_boxes/js/tuskar.boxes_progress.js +++ b/tuskar_boxes/static/tuskar_boxes/js/tuskar.boxes_progress.js @@ -7,7 +7,14 @@ tuskar.boxes_progress = function () { }; module.update_progress = function (data) { - $('div.boxes-nodes').html(module.nodes_template.render(data)); + var $nodes = $('div.boxes-nodes'); + $nodes.html(module.nodes_template.render(data)); + $nodes.find('div.boxes-node').popover({ + 'trigger': 'hover', + 'placement': 'auto', + 'delay': 500, + 'html': true + }); }; // Attach to the original update procedure. diff --git a/tuskar_boxes/templates/tuskar_boxes/overview/_node_info.html b/tuskar_boxes/templates/tuskar_boxes/overview/_node_info.html index 7740605..23d4d70 100644 --- a/tuskar_boxes/templates/tuskar_boxes/overview/_node_info.html +++ b/tuskar_boxes/templates/tuskar_boxes/overview/_node_info.html @@ -1,8 +1,18 @@ {% load i18n %}
+{% for node in nodes %}{% spaceless %} +
{{ node.uuid }}
@@ -15,4 +25,6 @@
{% trans "HDD (GB)" %}
{{ node.local_gb }}
" ->free
+ >
+{% endspaceless %}{% endfor %} + diff --git a/tuskar_boxes/templates/tuskar_boxes/overview/_node_info_js.html b/tuskar_boxes/templates/tuskar_boxes/overview/_node_info_js.html new file mode 100644 index 0000000..0df96b8 --- /dev/null +++ b/tuskar_boxes/templates/tuskar_boxes/overview/_node_info_js.html @@ -0,0 +1,23 @@ +{% load i18n %} +{% load horizon %} + diff --git a/tuskar_boxes/templates/tuskar_boxes/overview/index.html b/tuskar_boxes/templates/tuskar_boxes/overview/index.html index 346f2fa..1149312 100644 --- a/tuskar_boxes/templates/tuskar_boxes/overview/index.html +++ b/tuskar_boxes/templates/tuskar_boxes/overview/index.html @@ -67,11 +67,7 @@ {% endif %} {% endfor %} -
- {% for node in nodes %}{% spaceless %} -
- {% endspaceless %}{% endfor %} -
+ {% include "tuskar_boxes/overview/_node_info.html" with nodes=nodes %} {% endif %} diff --git a/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_edit.html b/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_edit.html index 29869d3..283d5f4 100644 --- a/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_edit.html +++ b/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_edit.html @@ -58,11 +58,7 @@ -
- {% for node in flavor.nodes %}{% spaceless %} - {% include "tuskar_boxes/overview/_node_info.html" with node=node %} - {% endspaceless %}{% endfor %} -
+ {% include "tuskar_boxes/overview/_node_info.html" with nodes=flavor.nodes classes="col-xs-7" %} {% endfor %} diff --git a/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_status.html b/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_status.html index f8ff324..656cbd9 100644 --- a/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_status.html +++ b/tuskar_boxes/templates/tuskar_boxes/overview/role_nodes_status.html @@ -20,13 +20,7 @@ {% endfor %} -
- {% for node in nodes %}{% spaceless %} -
- -
- {% endspaceless %}{% endfor %} -
+ {% include "tuskar_boxes/overview/_node_info.html" with nodes=nodes classes="col-xs-7" %} - +{% include "tuskar_boxes/overview/_node_info_js.html" %}