Fix Project Overview link to use instance_id
Fixes Bug #1003299 Tenant Usage API has been updated to include instance_id in the response (bug 1003093). The link has been updated to used instance_id. Change-Id: I9d5fcf120b1e5966a5e019e5b17dea7806f20650
This commit is contained in:
parent
820fdfe868
commit
a670349420
|
@ -1,3 +1,4 @@
|
|||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.template.defaultfilters import timesince, floatformat
|
||||
|
||||
|
@ -42,17 +43,24 @@ class GlobalUsageTable(BaseUsageTable):
|
|||
multi_select = False
|
||||
|
||||
|
||||
def get_instance_link(datum):
|
||||
view = "horizon:nova:instances_and_volumes:instances:detail"
|
||||
if datum.get('instance_id', False):
|
||||
return urlresolvers.reverse(view, args=(datum.get('instance_id'),))
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class TenantUsageTable(BaseUsageTable):
|
||||
instance = tables.Column('name',
|
||||
verbose_name=_("Instance Name"),
|
||||
link=("horizon:nova:instances_and_volumes:"
|
||||
"instances:detail"))
|
||||
link=get_instance_link)
|
||||
uptime = tables.Column('uptime_at',
|
||||
verbose_name=_("Uptime"),
|
||||
filters=(timesince,))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return id(datum)
|
||||
return datum.get('instance_id', id(datum))
|
||||
|
||||
class Meta:
|
||||
name = "tenant_usage"
|
||||
|
|
Loading…
Reference in New Issue