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
This commit is contained in:
Masco Kaliyamoorthy 2015-06-09 14:38:18 +05:30
parent 0484fef7c6
commit 863f7fcd06
3 changed files with 6 additions and 2 deletions

View File

@ -193,6 +193,7 @@ class LiveMigrateView(forms.ModalFormView):
class DetailView(views.DetailView): class DetailView(views.DetailView):
redirect_url = 'horizon:admin:instances:index' redirect_url = 'horizon:admin:instances:index'
image_url = 'horizon:admin:images:detail'
def _get_actions(self, instance): def _get_actions(self, instance):
table = project_tables.AdminInstancesTable(self.request) table = project_tables.AdminInstancesTable(self.request)

View File

@ -113,11 +113,10 @@
{% with formatted_default_key_name="<em>"|add:default_key_name|add:"</em>" %} {% with formatted_default_key_name="<em>"|add:default_key_name|add:"</em>" %}
<dd>{{ instance.key_name|default:formatted_default_key_name }}</dd> <dd>{{ instance.key_name|default:formatted_default_key_name }}</dd>
{% endwith %} {% endwith %}
{% url 'horizon:project:images:images:detail' instance.image.id as image_url %}
<dt>{% trans "Image Name" %}</dt> <dt>{% trans "Image Name" %}</dt>
<dd> <dd>
{% if instance.image %} {% if instance.image %}
<a href="{{ image_url }}">{{ instance.image_name }}</a> <a href="{{ instance.image_url }}">{{ instance.image_name }}</a>
{% else %} {% else %}
<em>{% trans "None" %}</em> <em>{% trans "None" %}</em>
{% endif %} {% endif %}

View File

@ -292,10 +292,14 @@ class DetailView(tabs.TabView):
template_name = 'project/instances/detail.html' template_name = 'project/instances/detail.html'
redirect_url = 'horizon:project:instances:index' redirect_url = 'horizon:project:instances:index'
page_title = _("Instance Details: {{ instance.name }}") page_title = _("Instance Details: {{ instance.name }}")
image_url = 'horizon:project:images:images:detail'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(DetailView, self).get_context_data(**kwargs) context = super(DetailView, self).get_context_data(**kwargs)
instance = self.get_data() instance = self.get_data()
if instance.image:
instance.image_url = reverse(self.image_url,
args=[instance.image['id']])
context["instance"] = instance context["instance"] = instance
context["url"] = reverse(self.redirect_url) context["url"] = reverse(self.redirect_url)
context["actions"] = self._get_actions(instance) context["actions"] = self._get_actions(instance)