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 %}