summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Tomasek <jtomasek@redhat.com>2013-07-17 17:01:47 +0200
committerTomas Sedovic <tomas@sedovic.cz>2013-08-01 16:18:56 +0200
commitb2a147a37ca0bee5eb5eb163cd64b245c3fd9658 (patch)
tree1ed2cdd2e4afbec51cb3bfdc06573db7b2b77321
parent4caba1d04f5e59e381c4c9dd2682cda72e5e5162 (diff)
downloadtuskar-ui-b2a147a37ca0bee5eb5eb163cd64b245c3fd9658.tar.gz
Updated and unified Racks table
Change-Id: Ib1fad9acb91c465b1e063636c9d720bdccf5b965
-rw-r--r--openstack_dashboard/api/tuskar.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/tables.py15
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py23
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py5
4 files changed, 17 insertions, 28 deletions
diff --git a/openstack_dashboard/api/tuskar.py b/openstack_dashboard/api/tuskar.py
index 36acdf5a..acc64e44 100644
--- a/openstack_dashboard/api/tuskar.py
+++ b/openstack_dashboard/api/tuskar.py
@@ -340,7 +340,7 @@ class Rack(StringIdAPIResourceWrapper):
rclass = getattr(self._apiresource, 'resource_class', None)
if rclass:
self._resource_class = ResourceClass.get(self.request,
- rclass['id'])
+ rclass['id'])
else:
self._resource_class = None
return self._resource_class
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tables.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tables.py
index c42bf414..9c7c3cce 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tables.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tables.py
@@ -66,9 +66,22 @@ class RacksTable(tables.DataTable):
link=("horizon:infrastructure:resource_management"
":racks:detail"),
verbose_name=_("Rack Name"))
- location = tables.Column('location', verbose_name=_("Location"))
subnet = tables.Column('subnet', verbose_name=_("IP Subnet"))
+ location = tables.Column('location', verbose_name=_("Location"))
+ resource_class = tables.Column('resource_class',
+ verbose_name=_("Class"),
+ filters=(lambda resource_class:
+ (resource_class and
+ resource_class.name) or None,))
node_count = tables.Column('nodes_count', verbose_name=_("Nodes"))
+ state = tables.Column('state', verbose_name=_("State"))
+ usage = tables.Column('usage', verbose_name=_("Usage"))
+ # usage = tables.Column(
+ # 'vm_capacity',
+ # verbose_name=_("Usage"),
+ # filters=(lambda vm_capacity:
+ # "%s %%" % int(round((100 / float(vm_capacity.value)) *
+ # vm_capacity.usage, 0)),))
class Meta:
name = "racks"
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
index 94e0b906..c6e37bf6 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
@@ -161,29 +161,6 @@ class UpdateFlavorsClass(tables.LinkAction):
workflows.ResourceClassInfoAndFlavorsAction.slug)
-class ResourceClassDetailRacksTable(racks_tables.RacksTable):
- cpu = tables.Column("cpu",
- verbose_name=_("Total CPU"),
- filters=(lambda x: getattr(x, 'value', ''),))
- ram = tables.Column("ram",
- verbose_name=_("Total RAM"),
- filters=(lambda x: getattr(x, 'value', ''),))
- storage = tables.Column("storage",
- verbose_name=_("Total Disk"),
- filters=(lambda x: getattr(x, 'value', ''),))
- vm_capacity = tables.Column("vm_capacity",
- verbose_name=_("VM Capacity"),
- filters=(lambda x: getattr(x, 'value', ''),))
-
- class Meta:
- name = "racks"
- verbose_name = _("Racks")
- table_actions = (RacksFilterAction, UpdateRacksClass)
- columns = (
- 'name', 'subnet', 'location', 'node_count',
- 'cpu', 'ram', 'storage', 'vm_capacity')
-
-
class ResourceClassDetailFlavorsTable(flavors_tables.FlavorsTable):
max_vms = tables.Column("max_vms",
verbose_name=_("Max. VMs"))
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
index 650d7761..0909e064 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
@@ -17,8 +17,7 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
-from tables import (ResourceClassDetailRacksTable,
- ResourceClassDetailFlavorsTable)
+from tables import ResourceClassDetailFlavorsTable, RacksTable
class OverviewTab(tabs.Tab):
@@ -33,7 +32,7 @@ class OverviewTab(tabs.Tab):
class RacksTab(tabs.TableTab):
- table_classes = (ResourceClassDetailRacksTable,)
+ table_classes = (RacksTable,)
name = _("Racks")
slug = "racks"
template_name = ("infrastructure/resource_management/resource_classes/"