From 863f7fcd067efd2bfbd58cc7829953768c2a6685 Mon Sep 17 00:00:00 2001 From: Masco Kaliyamoorthy Date: Tue, 9 Jun 2015 14:38:18 +0530 Subject: [PATCH] corrected the wrong url in admin instance detail In admin instance detail page, the image url pointing to image detail page in project panel. This behavior is wrong, it should be link to admin panel only. This patch corrected the url to point to the admin panel image detail page. Change-Id: I4ec2687cc208e61b2be00dc86e42f95fa8a1a363 Closes-Bug: #1463312 --- openstack_dashboard/dashboards/admin/instances/views.py | 1 + .../instances/templates/instances/_detail_overview.html | 3 +-- openstack_dashboard/dashboards/project/instances/views.py | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index ed0fe26590..178a81f58e 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -193,6 +193,7 @@ class LiveMigrateView(forms.ModalFormView): class DetailView(views.DetailView): redirect_url = 'horizon:admin:instances:index' + image_url = 'horizon:admin:images:detail' def _get_actions(self, instance): table = project_tables.AdminInstancesTable(self.request) 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 68eb162cb7..5559bbba9d 100644 --- a/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html +++ b/openstack_dashboard/dashboards/project/instances/templates/instances/_detail_overview.html @@ -113,11 +113,10 @@ {% with formatted_default_key_name=""|add:default_key_name|add:"" %}
{{ instance.key_name|default:formatted_default_key_name }}
{% endwith %} - {% url 'horizon:project:images:images:detail' instance.image.id as image_url %}
{% trans "Image Name" %}
{% if instance.image %} - {{ instance.image_name }} + {{ instance.image_name }} {% else %} {% trans "None" %} {% endif %} diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 80d564a467..e1e109ab81 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -292,10 +292,14 @@ class DetailView(tabs.TabView): template_name = 'project/instances/detail.html' redirect_url = 'horizon:project:instances:index' page_title = _("Instance Details: {{ instance.name }}") + image_url = 'horizon:project:images:images:detail' def get_context_data(self, **kwargs): context = super(DetailView, self).get_context_data(**kwargs) instance = self.get_data() + if instance.image: + instance.image_url = reverse(self.image_url, + args=[instance.image['id']]) context["instance"] = instance context["url"] = reverse(self.redirect_url) context["actions"] = self._get_actions(instance)