Paring down the syspanel instances table.
There was simply too much information in that table to be usable. It probably still needs to lose more weight in favor of moving things to a more admin-oriented detail page. However, we need to get real user feedback on what data is critical for the overview vs. what can be in a detail page. Fixes bug 944506. Change-Id: Iaad218bc6ed6647645c5943920467bec097a0a2d
This commit is contained in:
@@ -100,6 +100,10 @@ class Server(APIResourceWrapper):
|
||||
except glance_exceptions.NotFound:
|
||||
return "(not found)"
|
||||
|
||||
@property
|
||||
def internal_name(self):
|
||||
return getattr(self, 'OS-EXT-SRV-ATTR:instance_name', "")
|
||||
|
||||
def reboot(self, hardness=REBOOT_HARD):
|
||||
novaclient(self.request).servers.reboot(self.id, hardness)
|
||||
|
||||
|
||||
@@ -21,10 +21,11 @@ from django.template.defaultfilters import title
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from horizon import tables
|
||||
from horizon.dashboards.nova.instances_and_volumes.instances.tables import \
|
||||
(LaunchLink, TerminateInstance, EditInstance, ConsoleLink, LogLink,
|
||||
SnapshotLink, TogglePause, ToggleSuspend, RebootInstance, get_size,
|
||||
TerminateInstance, UpdateRow, get_ips, get_power_state)
|
||||
from horizon.dashboards.nova.instances_and_volumes.instances.tables import (
|
||||
TerminateInstance, EditInstance, ConsoleLink, LogLink, SnapshotLink,
|
||||
TogglePause, ToggleSuspend, RebootInstance, get_size, UpdateRow,
|
||||
get_ips, get_power_state)
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@@ -39,9 +40,11 @@ class SyspanelInstancesTable(tables.DataTable):
|
||||
("error", False),
|
||||
)
|
||||
tenant = tables.Column("tenant_name", verbose_name=_("Tenant"))
|
||||
user = tables.Column("user_id", verbose_name=_("User"))
|
||||
internal_id = tables.Column("internal_identifier",
|
||||
verbose_name=_("Instance ID"))
|
||||
# NOTE(gabriel): Commenting out the user column because all we have
|
||||
# is an ID, and correlating that at production scale using our current
|
||||
# techniques isn't practical. It can be added back in when we have names
|
||||
# returned in a practical manner by the API.
|
||||
#user = tables.Column("user_id", verbose_name=_("User"))
|
||||
host = tables.Column("OS-EXT-SRV-ATTR:host", verbose_name=_("Host"))
|
||||
name = tables.Column("name", link="horizon:nova:instances_and_volumes:" \
|
||||
"instances:detail",
|
||||
|
||||
@@ -28,8 +28,8 @@ from horizon import api
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon.dashboards.syspanel.instances.tables import SyspanelInstancesTable
|
||||
from horizon.dashboards.nova.instances_and_volumes \
|
||||
.instances.views import console, DetailView, vnc
|
||||
from horizon.dashboards.nova.instances_and_volumes .instances.views import (
|
||||
console, DetailView, vnc)
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@@ -47,20 +47,25 @@ class AdminIndexView(tables.DataTableView):
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve instance list.'))
|
||||
if instances:
|
||||
# Gather our flavors to correlate against IDs
|
||||
try:
|
||||
flavors = api.nova.flavor_list(self.request)
|
||||
tenants = SortedDict([(str(tenant.id), tenant) for \
|
||||
tenant in api.keystone.tenant_list(
|
||||
self.request, admin=True)])
|
||||
full_flavors = SortedDict([(str(flavor.id), flavor) for \
|
||||
flavor in flavors])
|
||||
for inst in instances:
|
||||
inst.full_flavor = full_flavors[inst.flavor["id"]]
|
||||
inst.internal_identifier = "%s (%s)" % (inst.id,
|
||||
getattr(inst, 'OS-EXT-SRV-ATTR:instance_name'))
|
||||
inst.tenant_name = "%s (%s)" % (inst.tenant_id,
|
||||
tenants[inst.tenant_id].name)
|
||||
except:
|
||||
flavors = []
|
||||
msg = _('Unable to retrieve instance size information.')
|
||||
exceptions.handle(self.request, msg)
|
||||
# Gather our tenants to correlate against IDs
|
||||
try:
|
||||
tenants = api.keystone.tenant_list(self.request, admin=True)
|
||||
except:
|
||||
tenants = []
|
||||
msg = _('Unable to retrieve instance tenant information.')
|
||||
exceptions.handle(self.request, msg)
|
||||
|
||||
full_flavors = SortedDict([(f.id, f) for f in flavors])
|
||||
tenant_dict = SortedDict([(t.id, t) for t in tenants])
|
||||
for inst in instances:
|
||||
inst.full_flavor = full_flavors.get(inst.flavor["id"], None)
|
||||
tenant = tenant_dict.get(inst.tenant_id, None)
|
||||
inst.tenant_name = getattr(tenant, "name", None)
|
||||
return instances
|
||||
|
||||
Reference in New Issue
Block a user