diff --git a/openstack_dashboard/dashboards/identity/projects/views.py b/openstack_dashboard/dashboards/identity/projects/views.py index bfadc0f2a3..148ede3a25 100644 --- a/openstack_dashboard/dashboards/identity/projects/views.py +++ b/openstack_dashboard/dashboards/identity/projects/views.py @@ -139,7 +139,7 @@ class IndexView(tables.DataTableView): class ProjectUsageView(usage.UsageView): - table_class = usage.ProjectUsageTable + table_class = usage.IdentityProjectUsagesTable usage_class = usage.ProjectUsage template_name = 'identity/projects/usage.html' csv_response_class = project_views.ProjectUsageCsvRenderer diff --git a/openstack_dashboard/usage/__init__.py b/openstack_dashboard/usage/__init__.py index 6276eec51b..f64f2c7d0b 100644 --- a/openstack_dashboard/usage/__init__.py +++ b/openstack_dashboard/usage/__init__.py @@ -17,6 +17,7 @@ from openstack_dashboard.usage.base import GlobalUsage from openstack_dashboard.usage.base import ProjectUsage from openstack_dashboard.usage.tables import BaseUsageTable from openstack_dashboard.usage.tables import GlobalUsageTable +from openstack_dashboard.usage.tables import IdentityProjectUsagesTable from openstack_dashboard.usage.tables import ProjectUsageTable from openstack_dashboard.usage.views import ProjectUsageView from openstack_dashboard.usage.views import UsageView @@ -28,6 +29,7 @@ __all__ = [ 'ProjectUsage', 'BaseUsageTable', 'GlobalUsageTable', + 'IdentityProjectUsagesTable', 'ProjectUsageTable', 'ProjectUsageView', 'UsageView', diff --git a/openstack_dashboard/usage/tables.py b/openstack_dashboard/usage/tables.py index 517fda5098..d65b0e4e33 100644 --- a/openstack_dashboard/usage/tables.py +++ b/openstack_dashboard/usage/tables.py @@ -96,3 +96,16 @@ class ProjectUsageTable(BaseUsageTable): columns = ("instance", "vcpus", "disk", "memory", "uptime") table_actions = (CSVSummary,) multi_select = False + + +def get_instance_link_admin(datum): + view = "horizon:admin:instances:detail" + if datum.get('instance_id', False): + return urls.reverse(view, args=(datum.get('instance_id'),)) + return None + + +class IdentityProjectUsagesTable(ProjectUsageTable): + instance = tables.Column('name', + verbose_name=_("Instance Name"), + link=get_instance_link_admin)