diff options
author | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-01-14 10:12:47 +0100 |
---|---|---|
committer | Radomir Dopieralski <openstack@sheep.art.pl> | 2014-01-14 14:02:02 +0100 |
commit | 2d074bfac6b3404a787356db745d334d5615c75f (patch) | |
tree | dbc19f65b19d5a675773f5326107c05e96896aec | |
parent | 49f8987f65656b8f16f39c662fdd769ed975d03b (diff) | |
download | tuskar-ui-2d074bfac6b3404a787356db745d334d5615c75f.tar.gz |
Add Nodes Overview page
A Nodes Overview according to wireframes
Change-Id: I9c1f13da8c234a9d3ad7ea26339eff1bdd8488dc
implements: blueprint tripleo-nodes-overview-page
3 files changed, 52 insertions, 1 deletions
diff --git a/tuskar_ui/infrastructure/nodes/overview/views.py b/tuskar_ui/infrastructure/nodes/overview/views.py index 1756f9d1..6c770dd6 100644 --- a/tuskar_ui/infrastructure/nodes/overview/views.py +++ b/tuskar_ui/infrastructure/nodes/overview/views.py @@ -13,15 +13,39 @@ # under the License. from django.core.urlresolvers import reverse_lazy +from django.utils.translation import ugettext_lazy as _ from django.views import generic +from horizon import exceptions import horizon.forms +from tuskar_ui import api from tuskar_ui.infrastructure.nodes import forms class IndexView(generic.TemplateView): template_name = 'infrastructure/nodes/overview/index.html' + def get_context_data(self, **kwargs): + context = super(IndexView, self).get_context_data(**kwargs) + try: + free_nodes = len(api.Node.list(self.request, associated=False)) + except Exception: + free_nodes = 0 + exceptions.handle(self.request, + _('Unable to retrieve free nodes.')) + try: + allocated_nodes = len(api.Node.list(self.request, associated=True)) + except Exception: + allocated_nodes = 0 + exceptions.handle(self.request, + _('Unable to retrieve allocated nodes.')) + context.update({ + 'nodes_total': free_nodes + allocated_nodes, + 'nodes_allocated_resources': allocated_nodes, + 'nodes_unallocated': free_nodes, + }) + return context + class RegisterView(horizon.forms.ModalFormView): form_class = forms.NodeFormset diff --git a/tuskar_ui/infrastructure/static/infrastructure/less/infrastructure.less b/tuskar_ui/infrastructure/static/infrastructure/less/infrastructure.less index 9c8d2761..49688d37 100644 --- a/tuskar_ui/infrastructure/static/infrastructure/less/infrastructure.less +++ b/tuskar_ui/infrastructure/static/infrastructure/less/infrastructure.less @@ -510,6 +510,10 @@ input { } } +.big-number { + font-size: 1.5em; +} + #nodes-formset-datatable .datatable tbody { input { padding: 2px 1px; diff --git a/tuskar_ui/infrastructure/templates/infrastructure/nodes/overview/index.html b/tuskar_ui/infrastructure/templates/infrastructure/nodes/overview/index.html index 951e48de..b0b4603f 100644 --- a/tuskar_ui/infrastructure/templates/infrastructure/nodes/overview/index.html +++ b/tuskar_ui/infrastructure/templates/infrastructure/nodes/overview/index.html @@ -5,9 +5,32 @@ {% block page_header %} {% include 'horizon/common/_domain_page_header.html' with title=_('Nodes Overview') %} + <div class="breadcrumbs"> + <a href="{% url 'horizon:infrastructure:overview:index' %}" + >{% trans "Infrastructure" %}</a> + <span class="separator"></span> + </div> {% endblock page_header %} {% block main %} +<div class="row-fluid"><div class="span12"> +<p> + <h4><span class="big-number">{{ nodes_total|default:0 }}</span> nodes in total</h4> +</p> +<hr> +<p> + <a href="{% url 'horizon:infrastructure:nodes.resource:index' %}" + ><span class="big-number">{{ nodes_allocated_resources|default:0 }}</span> Allocated — Resource Nodes</a> +</p> +<hr> +<p> <a href="{% url 'horizon:infrastructure:nodes.overview:register' %}" - class="btn ajax-modal">Register nodes</a> + class="btn ajax-modal pull-right">Register Nodes</a> + <a href="{% url 'horizon:infrastructure:nodes.free:index' %}" + ><span class="big-number">{{ nodes_unallocated|default:0 }}</span> Unallocated Nodes</a> +</p> +<hr> +<h4>Statistics</h4> +<p>No statistics available</p> +</div></div> {% endblock %} |