diff options
author | Ladislav Smola <lsmola@redhat.com> | 2013-06-21 10:07:29 +0200 |
---|---|---|
committer | Tomas Sedovic <tomas@sedovic.cz> | 2013-08-01 16:18:55 +0200 |
commit | 101e4f298ba53fe8908dca0f521795656359d80a (patch) | |
tree | dd3a6bbcb7aeddade5a496dbd5a9110e7977b7f4 | |
parent | b3312a97d0b7ae3cfeaa09df22e875ed1b103baf (diff) | |
download | tuskar-ui-101e4f298ba53fe8908dca0f521795656359d80a.tar.gz |
Correct redirect after Action of Workflow
- fixed redirect, when on page with Tabs and Workflow with more steps.
There is a conflict that always redirect to the first tab, after
action.
Fixed by explicitly specifing the tab it should redirect to after
action.
Change-Id: I23256f935333407b7ba8b73932c9c980d0b88094
2 files changed, 18 insertions, 7 deletions
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py index bdb5cd20..53354345 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py @@ -17,6 +17,8 @@ from django.core.urlresolvers import reverse from mox import IsA from openstack_dashboard import api from openstack_dashboard.test import helpers as test +from openstack_dashboard.dashboards.infrastructure.resource_management.\ + resource_classes import workflows class ResourceClassesTests(test.BaseAdminViewTests): @@ -80,7 +82,7 @@ class ResourceClassesTests(test.BaseAdminViewTests): self.assertMessageCount(success=1) self.assertRedirectsNoFollow( - res, reverse('horizon:infrastructure:resource_management:index')) + res, workflows.get_index_url()) @test.create_stubs({ api.management.ResourceClass: ( @@ -154,7 +156,7 @@ class ResourceClassesTests(test.BaseAdminViewTests): self.assertMessageCount(success=1) self.assertRedirectsNoFollow( - res, reverse('horizon:infrastructure:resource_management:index')) + res, workflows.get_index_url()) @test.create_stubs({api.management.ResourceClass: ('delete', 'list'), }) def test_delete_resource_class(self): diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py index 3a3b7752..6619f7e5 100644 --- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py +++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py @@ -26,7 +26,16 @@ import re from .tables import FlavorsTable, ResourcesTable -INDEX_URL = "horizon:infrastructure:resource_management:index" + +# FIXME active tabs coflict +# When on page with tabs, the workflow with more steps is used, +# there is a conflict of active tabs and it always shows the +# first tab after an action. So I explicitly specify to what +# tab it should redirect after action, until the coflict will +# be fixed in Horizon. +def get_index_url(): + return "%s?tab=resource_management_tabs__resource_classes_tab" %\ + reverse("horizon:infrastructure:resource_management:index") class ResourceClassInfoAndFlavorsAction(workflows.Action): @@ -174,10 +183,10 @@ class CreateResources(workflows.TableStep): class ResourceClassWorkflowMixin: def get_success_url(self): - return reverse(INDEX_URL) + return get_index_url() def get_failure_url(self): - return reverse(INDEX_URL) + return get_index_url() def format_status_message(self, message): name = self.context.get('name') @@ -210,7 +219,7 @@ class CreateResourceClass(ResourceClassWorkflowMixin, workflows.Workflow): name=data['name'], service_type=data['service_type']) except: - redirect = reverse(INDEX_URL) + redirect = get_index_url() exceptions.handle(request, _('Unable to create resource class.'), redirect=redirect) @@ -249,7 +258,7 @@ class UpdateResourceClass(ResourceClassWorkflowMixin, workflows.Workflow): name=data['name'], service_type=data['service_type']) except: - redirect = reverse(INDEX_URL) + redirect = get_index_url() exceptions.handle(request, _('Unable to create resource class.'), redirect=redirect) |