From 0642fddaaeb122b6cd40e10d08336ddb432c3c6f Mon Sep 17 00:00:00 2001 From: Chad Roberts Date: Thu, 30 Apr 2015 12:23:25 -0400 Subject: [PATCH] Fixing data processing operations for alternate webroots No longer doing a urlresolver.resolve on the path for any requests. Instead, we are now using query style params which is the way the rest of the sahara dashboard does things. Change-Id: Iad413bdf618a4f5374df1fd40793c0b609b17d99 Closes-Bug: #1450535 (cherry picked from commit d61a5ccdc6700a4263bf37cfa8072e6228da2f17) --- .../dashboards/project/data_processing/clusters/urls.py | 6 ------ .../project/data_processing/clusters/workflows/create.py | 6 ++---- .../dashboards/project/data_processing/jobs/urls.py | 4 ---- .../dashboards/project/data_processing/jobs/workflows/create.py | 6 ++---- .../dashboards/project/data_processing/nodegroup_templates/urls.py | 6 ------ .../data_processing/nodegroup_templates/workflows/create.py | 6 ++---- .../dashboards/project/data_processing/utils/workflow_helpers.py | 7 ++----- .../wizard/templates/data_processing.wizard/cluster_guide.html | 6 +++--- .../wizard/templates/data_processing.wizard/jobex_guide.html | 2 +- 9 files changed, 12 insertions(+), 37 deletions(-) diff --git a/openstack_dashboard/dashboards/project/data_processing/clusters/urls.py b/openstack_dashboard/dashboards/project/data_processing/clusters/urls.py index ee2bd25..4ee940d 100644 --- a/openstack_dashboard/dashboards/project/data_processing/clusters/urls.py +++ b/openstack_dashboard/dashboards/project/data_processing/clusters/urls.py @@ -30,12 +30,6 @@ urlpatterns = patterns('', url(r'^configure-cluster$', views.ConfigureClusterView.as_view(), name='configure-cluster'), - url(r'^configure-cluster' - '/(?P[^/]+)' - '/(?P[^/]+)' - '/(?P[^/]+)/$', - views.ConfigureClusterView.as_view(), - name='configure-cluster'), url(r'^(?P[^/]+)$', views.ClusterDetailsView.as_view(), name='details'), diff --git a/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py b/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py index e680c94..06e2beb 100644 --- a/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py +++ b/openstack_dashboard/dashboards/project/data_processing/clusters/workflows/create.py @@ -22,7 +22,6 @@ from openstack_dashboard.dashboards.project.data_processing.utils \ import openstack_dashboard.dashboards.project.data_processing.utils. \ workflow_helpers as whelpers -from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from openstack_dashboard.api import sahara as saharaclient @@ -163,10 +162,9 @@ class GeneralConfigAction(workflows.Action): # cluster_template_id comes from cluster templates table, when # Create Cluster from template is clicked there selected_template_name = None - resolver_match = urlresolvers.resolve(request.path) - if "cluster_template_name" in resolver_match.kwargs: + if request.REQUEST.get("cluster_template_name"): selected_template_name = ( - resolver_match.kwargs["cluster_template_name"]) + request.REQUEST.get("cluster_template_name")) if selected_template_name: for template in templates: if template.name == selected_template_name: diff --git a/openstack_dashboard/dashboards/project/data_processing/jobs/urls.py b/openstack_dashboard/dashboards/project/data_processing/jobs/urls.py index 3012bb5..7529145 100644 --- a/openstack_dashboard/dashboards/project/data_processing/jobs/urls.py +++ b/openstack_dashboard/dashboards/project/data_processing/jobs/urls.py @@ -27,10 +27,6 @@ urlpatterns = patterns('', url(r'^create-job$', views.CreateJobView.as_view(), name='create-job'), - url(r'^create-job/' - '(?P[^/]+)/$', - views.CreateJobView.as_view(), - name='create-job'), url(r'^launch-job$', views.LaunchJobView.as_view(), name='launch-job'), diff --git a/openstack_dashboard/dashboards/project/data_processing/jobs/workflows/create.py b/openstack_dashboard/dashboards/project/data_processing/jobs/workflows/create.py index 4e93556..b1929fb 100644 --- a/openstack_dashboard/dashboards/project/data_processing/jobs/workflows/create.py +++ b/openstack_dashboard/dashboards/project/data_processing/jobs/workflows/create.py @@ -14,7 +14,6 @@ import json import logging -from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from horizon import exceptions @@ -90,10 +89,9 @@ class GeneralConfigAction(workflows.Action): def __init__(self, request, context, *args, **kwargs): super(GeneralConfigAction, self).__init__(request, context, *args, **kwargs) - resolver_match = urlresolvers.resolve(request.path) - if "guide_job_type" in resolver_match.kwargs: + if request.REQUEST.get("guide_job_type"): self.fields["job_type"].initial = ( - resolver_match.kwargs["guide_job_type"].lower()) + request.REQUEST.get("guide_job_type").lower()) def populate_job_type_choices(self, request, context): choices = [("pig", _("Pig")), ("hive", _("Hive")), diff --git a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/urls.py b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/urls.py index 6b14957..9082eed 100644 --- a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/urls.py +++ b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/urls.py @@ -31,12 +31,6 @@ urlpatterns = patterns('sahara.nodegroup_templates.views', url(r'^configure-nodegroup-template$', views.ConfigureNodegroupTemplateView.as_view(), name='configure-nodegroup-template'), - url(r'^configure-nodegroup-template' - '/(?P[^/]+)/' - '(?P[^/]+)/' - '(?P[^/]+)/$', - views.ConfigureNodegroupTemplateView.as_view(), - name='configure-nodegroup-template-defaults'), url(r'^(?P[^/]+)$', views.NodegroupTemplateDetailsView.as_view(), name='details'), diff --git a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py index 0a4eedb..5b90792 100644 --- a/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py +++ b/openstack_dashboard/dashboards/project/data_processing/nodegroup_templates/workflows/create.py @@ -13,7 +13,6 @@ import logging -from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from saharaclient.api import base as api_base @@ -156,12 +155,11 @@ class GeneralConfigAction(workflows.Action): for param in node_parameters: self.fields[param.name] = workflow_helpers.build_control(param) - resolver_match = urlresolvers.resolve(request.path) - if "guide_template_type" in resolver_match.kwargs: + if request.REQUEST.get("guide_template_type"): self.fields["guide_template_type"] = forms.CharField( required=False, widget=forms.HiddenInput(), - initial=resolver_match.kwargs["guide_template_type"]) + initial=request.REQUEST.get("guide_template_type")) def populate_flavor_choices(self, request, context): flavors = nova_utils.flavor_list(request) diff --git a/openstack_dashboard/dashboards/project/data_processing/utils/workflow_helpers.py b/openstack_dashboard/dashboards/project/data_processing/utils/workflow_helpers.py index b0ce8e3..fc47be2 100644 --- a/openstack_dashboard/dashboards/project/data_processing/utils/workflow_helpers.py +++ b/openstack_dashboard/dashboards/project/data_processing/utils/workflow_helpers.py @@ -12,7 +12,6 @@ # limitations under the License. import logging -from django.core import urlresolvers from django.utils.translation import ugettext_lazy as _ from horizon import forms @@ -156,13 +155,11 @@ def get_security_groups(request, security_group_ids): def get_plugin_and_hadoop_version(request): + plugin_name = None + hadoop_version = None if request.REQUEST.get("plugin_name"): plugin_name = request.REQUEST["plugin_name"] hadoop_version = request.REQUEST["hadoop_version"] - else: - resolver_match = urlresolvers.resolve(request.path) - plugin_name = resolver_match.kwargs["plugin_name"] - hadoop_version = resolver_match.kwargs["hadoop_version"] return (plugin_name, hadoop_version) diff --git a/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/cluster_guide.html b/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/cluster_guide.html index dcdf966..1b6bb33 100644 --- a/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/cluster_guide.html +++ b/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/cluster_guide.html @@ -54,7 +54,7 @@
{% trans "Current choice:" %} @@ -81,7 +81,7 @@ diff --git a/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/jobex_guide.html b/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/jobex_guide.html index 7bad1c7..739091e 100644 --- a/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/jobex_guide.html +++ b/openstack_dashboard/dashboards/project/data_processing/wizard/templates/data_processing.wizard/jobex_guide.html @@ -67,7 +67,7 @@
{% trans "Job template:" %} -- 1.9.1