From 3004a15cfe0bc15180aecaaef6ae658f0259f382 Mon Sep 17 00:00:00 2001 From: liyingjun Date: Wed, 6 Aug 2014 18:50:02 +0800 Subject: [PATCH] Wrong success url for instance floatingip related actions When the instances is paginated in multiple pages, the success url for floatingip related actions best to be the current page. Change-Id: I1e35f984e4aa50457d3c59f80ceb01f091324656 Closes-Bug: #1354970 --- .../dashboards/project/instances/tables.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index 6a32abdd22..f5c454338a 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -537,9 +537,10 @@ class AssociateIP(policy.PolicyTargetMixin, tables.LinkAction): def get_link_url(self, datum): base_url = urlresolvers.reverse(self.url) - next = urlresolvers.reverse("horizon:project:instances:index") - params = {"instance_id": self.table.get_object_id(datum), - workflows.IPAssociationWorkflow.redirect_param_name: next} + next_url = self.table.get_full_url() + params = { + "instance_id": self.table.get_object_id(datum), + workflows.IPAssociationWorkflow.redirect_param_name: next_url} params = urlencode(params) return "?".join([base_url, params]) @@ -570,7 +571,7 @@ class SimpleAssociateIP(policy.PolicyTargetMixin, tables.Action): except Exception: exceptions.handle(request, _("Unable to associate floating IP.")) - return shortcuts.redirect("horizon:project:instances:index") + return shortcuts.redirect(request.get_full_path()) class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action): @@ -610,7 +611,7 @@ class SimpleDisassociateIP(policy.PolicyTargetMixin, tables.Action): except Exception: exceptions.handle(request, _("Unable to disassociate floating IP.")) - return shortcuts.redirect("horizon:project:instances:index") + return shortcuts.redirect(request.get_full_path()) def instance_fault_to_friendly_message(instance):