diff options
author | Akihiro Motoki <amotoki@gmail.com> | 2017-11-19 12:07:33 +0000 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2017-12-19 12:37:20 +0000 |
commit | 1e0e9b4fd7096e7a0c8749cb36f7e0dc7bad5c6d (patch) | |
tree | e5f561f12b6a7d35fb02f4da40bdc014ee94cc7f | |
parent | 50dac5e2da3dc7d2aa736284b6f16affcb4daa53 (diff) | |
download | horizon-1e0e9b4fd7096e7a0c8749cb36f7e0dc7bad5c6d.tar.gz |
Fix wrong link to VM in admin volume detail
Change-Id: Iadf007433afbe8bc08a4ada39f30d1448a98ebf5
Related-Bug: #1567317
(cherry picked from commit ed5adbe0bda91ea91657d666ab497ee1db4f27aa)
4 files changed, 49 insertions, 4 deletions
diff --git a/openstack_dashboard/dashboards/admin/volumes/tabs.py b/openstack_dashboard/dashboards/admin/volumes/tabs.py new file mode 100644 index 000000000..fb93e5d02 --- /dev/null +++ b/openstack_dashboard/dashboards/admin/volumes/tabs.py @@ -0,0 +1,34 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from openstack_dashboard.dashboards.project.volumes import tabs as project_tabs + + +class OverviewTab(project_tabs.OverviewTab): + + def get_context_data(self, request): + return { + 'volume': self.tab_group.kwargs['volume'], + 'detail_url': { + 'instance': 'horizon:admin:instances:detail', + 'image': 'horizon:admin:images:detail', + 'encryption': 'horizon:admin:volumes:encryption_detail', + } + } + + +class SnapshotTab(project_tabs.SnapshotTab): + pass + + +class VolumeDetailTabs(project_tabs.VolumeDetailTabs): + tabs = (OverviewTab, project_tabs.SnapshotTab) diff --git a/openstack_dashboard/dashboards/admin/volumes/views.py b/openstack_dashboard/dashboards/admin/volumes/views.py index 2a9350340..d0798c5a2 100644 --- a/openstack_dashboard/dashboards/admin/volumes/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/views.py @@ -33,6 +33,8 @@ from openstack_dashboard.dashboards.admin.volumes \ import forms as volumes_forms from openstack_dashboard.dashboards.admin.volumes \ import tables as volumes_tables +from openstack_dashboard.dashboards.admin.volumes \ + import tabs as volumes_tabs from openstack_dashboard.dashboards.project.volumes \ import views as volumes_views @@ -108,6 +110,8 @@ class VolumesView(tables.PagedTableMixin, volumes_views.VolumeTableMixIn, class DetailView(volumes_views.DetailView): + tab_group_class = volumes_tabs.VolumeDetailTabs + def get_context_data(self, **kwargs): context = super(DetailView, self).get_context_data(**kwargs) table = volumes_tables.VolumesTable(self.request) diff --git a/openstack_dashboard/dashboards/project/volumes/tabs.py b/openstack_dashboard/dashboards/project/volumes/tabs.py index b70f1e4ef..46b13b474 100644 --- a/openstack_dashboard/dashboards/project/volumes/tabs.py +++ b/openstack_dashboard/dashboards/project/volumes/tabs.py @@ -27,7 +27,14 @@ class OverviewTab(tabs.Tab): template_name = ("project/volumes/_detail_overview.html") def get_context_data(self, request): - return {"volume": self.tab_group.kwargs['volume']} + return { + 'volume': self.tab_group.kwargs['volume'], + 'detail_url': { + 'instance': 'horizon:project:instances:detail', + 'image': 'horizon:project:images:images:detail', + 'encryption': 'horizon:project:volumes:encryption_detail', + } + } class SnapshotTab(tabs.TableTab): 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 f7f83b9fa..7775e44d7 100644 --- a/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/volumes/templates/volumes/_detail_overview.html @@ -31,7 +31,7 @@ <dd>{{ volume.is_bootable|yesno|capfirst }}</dd> <dt>{% trans "Encrypted" %}</dt> {% if volume.encrypted %} - <dd><a href="{% url 'horizon:project:volumes:encryption_detail' volume.id %}">{% trans "Yes" %}</a></dd> + <dd><a href="{% url detail_url.encryption volume.id %}">{% trans "Yes" %}</a></dd> {% else %} <dd>{% trans "No" %}</dd> {% endif %} @@ -45,7 +45,7 @@ {% for attachment in volume.attachments %} <dt>{% trans "Attached To" %}</dt> <dd> - {% url 'horizon:project:instances:detail' attachment.server_id as instance_url %} + {% url detail_url.instance attachment.server_id as instance_url %} {% blocktrans trimmed with instance_name=attachment.instance.name device=attachment.device %} <a href="{{ instance_url }}">{{ instance_name }}</a> on {{ device }} {% endblocktrans %} @@ -62,7 +62,7 @@ <dl class="dl-horizontal"> <dt>{% trans "Image" %}</dt> <dd> - {% url 'horizon:project:images:images:detail' volume.volume_image_metadata.image_id as image_url %} + {% url detail_url.image volume.volume_image_metadata.image_id as image_url %} <a href="{{ image_url }}">{{ volume.volume_image_metadata.image_name }}</a> </dd> </dl> |