From 99b89a430edd7572a6c41b950dd228e7b1acfc47 Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Wed, 13 Feb 2019 10:04:58 +0000 Subject: [PATCH] Add Project ID information in detail page This patch add 'Project ID' information in instances,Subnet, Volumes and Volumes Snapshots detail pages. Change-Id: I48da491d5283ab607d298b454d32a349e97be0d1 Closes-Bug: #1815029 --- openstack_dashboard/api/cinder.py | 8 ++++++++ .../instances/templates/instances/_detail_overview.html | 6 ++++-- .../templates/networks/subnets/_detail_overview.html | 2 ++ .../snapshots/templates/snapshots/_detail_overview.html | 2 ++ .../volumes/templates/volumes/_detail_overview.html | 2 ++ 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/api/cinder.py b/openstack_dashboard/api/cinder.py index aeacc95f99..13b5b6fc98 100644 --- a/openstack_dashboard/api/cinder.py +++ b/openstack_dashboard/api/cinder.py @@ -96,6 +96,10 @@ class Volume(BaseCinderAPIResourceWrapper): def is_bootable(self): return self.bootable == 'true' + @property + def tenant_id(self): + return getattr(self, 'os-vol-tenant-attr:tenant_id', "") + class VolumeSnapshot(BaseCinderAPIResourceWrapper): @@ -104,6 +108,10 @@ class VolumeSnapshot(BaseCinderAPIResourceWrapper): 'os-extended-snapshot-attributes:project_id', 'metadata'] + @property + def project_id(self): + return getattr(self, 'os-extended-snapshot-attributes:project_id', "") + class VolumeType(BaseCinderAPIResourceWrapper): diff --git a/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html b/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html index 5d3241d52d..55427f7d58 100644 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html @@ -4,10 +4,12 @@
{% trans "Name" %}
{{ instance.name }}
-
{% trans "Description" %}
-
{{ instance.description|default:_("-") }}
{% trans "ID" %}
{{ instance.id }}
+
{% trans "Description" %}
+
{{ instance.description|default:_("-") }}
+
{% trans "Project ID" %}
+
{{ instance.tenant_id|default:_("-") }}
{% trans "Status" %}
{{ instance.status_label|title }}
{% if instance.locked != None %} diff --git a/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html b/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html index 437d915bad..9ec3bd9874 100644 --- a/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/networks/templates/networks/subnets/_detail_overview.html @@ -6,6 +6,8 @@
{{ subnet.name|default:_("None") }}
{% trans "ID" %}
{{subnet.id|default:_("None") }}
+
{% trans "Project ID" %}
+
{{ subnet.tenant_id|default:_("-") }}
{% trans "Network Name" %}
{{ subnet.network_name|default:_("None") }}
{% trans "Network ID" %}
diff --git a/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html b/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html index b71b4512b0..8a507cf9ee 100644 --- a/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/snapshots/templates/snapshots/_detail_overview.html @@ -10,6 +10,8 @@
{% trans "Description" %}
{{ snapshot.description }}
{% endif %} +
{% trans "Project ID" %}
+
{{ snapshot.project_id|default:_("-") }}
{% trans "Status" %}
{{ snapshot.status|capfirst }}
{% trans "Volume" %}
diff --git a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html index fc64b59359..a0c73d1a7b 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html @@ -10,6 +10,8 @@
{% trans "Description" %}
{{ volume.description }}
{% endif %} +
{% trans "Project ID" %}
+
{{ volume.tenant_id|default:_("-") }}
{% trans "Status" %}
{{ volume.status_label|capfirst }}
{% trans "Group" %}