From c8dd180513b0c734106477a9d6c25d8ddddab7c9 Mon Sep 17 00:00:00 2001 From: Tatiana Ovchinnikova Date: Wed, 14 Jan 2026 11:21:12 -0600 Subject: [PATCH] Separate Identity Project Usage from Project Overview Usage Currently both Project -> Overview -> Usage -> Instance details and Identity -> Projects -> Project details -> View Usage -> Instance details redirect to Instance details under project, with corresponding actions and privileges available. However Project details and the project's Instance details under Identity are only available if user logged as admin, so it is logical to redirect to Instance details under admin to have admin rights to, for example, shut off the instance. Change-Id: Id396d86306a96684526d3ca2fa3abf06710af566 Signed-off-by: Tatiana Ovchinnikova --- .../dashboards/identity/projects/views.py | 2 +- openstack_dashboard/usage/__init__.py | 2 ++ openstack_dashboard/usage/tables.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) 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)