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
This commit is contained in:
Chad Roberts 2015-04-30 12:23:25 -04:00
parent f344f7b66c
commit d61a5ccdc6
9 changed files with 12 additions and 37 deletions

View File

@ -30,12 +30,6 @@ urlpatterns = patterns('',
url(r'^configure-cluster$',
views.ConfigureClusterView.as_view(),
name='configure-cluster'),
url(r'^configure-cluster'
'/(?P<plugin_name>[^/]+)'
'/(?P<hadoop_version>[^/]+)'
'/(?P<cluster_template_name>[^/]+)/$',
views.ConfigureClusterView.as_view(),
name='configure-cluster'),
url(r'^(?P<cluster_id>[^/]+)$',
views.ClusterDetailsView.as_view(),
name='details'),

View File

@ -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:

View File

@ -27,10 +27,6 @@ urlpatterns = patterns('',
url(r'^create-job$',
views.CreateJobView.as_view(),
name='create-job'),
url(r'^create-job/'
'(?P<guide_job_type>[^/]+)/$',
views.CreateJobView.as_view(),
name='create-job'),
url(r'^launch-job$',
views.LaunchJobView.as_view(),
name='launch-job'),

View File

@ -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 = []

View File

@ -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<plugin_name>[^/]+)/'
'(?P<hadoop_version>[^/]+)/'
'(?P<guide_template_type>[^/]+)/$',
views.ConfigureNodegroupTemplateView.as_view(),
name='configure-nodegroup-template-defaults'),
url(r'^(?P<template_id>[^/]+)$',
views.NodegroupTemplateDetailsView.as_view(),
name='details'),

View File

@ -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)

View File

@ -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)

View File

@ -54,7 +54,7 @@
<div>
<a class="btn btn-default btn-small btn-create btn-inline ajax-modal
{% if not request.session.plugin_name or not request.session.plugin_version %} disabled {% endif %}"
href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template-defaults' request.session.plugin_name request.session.plugin_version 'master' %}{% endif %}">
href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template'%}?plugin_name={{ request.session.plugin_name }}&hadoop_version={{ request.session.plugin_version }}&guide_template_type=master{% endif %}">
<span class="fa fa-plus"></span> {% trans "Create a Master Node Group Template" %}</a>
</div>
<div>{% trans "Current choice:" %}
@ -81,7 +81,7 @@
<div>
<a class="btn btn-default btn-small btn-create btn-inline ajax-modal
{% if not request.session.master_name %} disabled{% endif %}"
href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template-defaults' request.session.plugin_name request.session.plugin_version 'worker' %}{% endif %}">
href="{% if request.session.plugin_name and request.session.plugin_version %}{% url 'horizon:project:data_processing.nodegroup_templates:configure-nodegroup-template'%}?plugin_name={{ request.session.plugin_name }}&hadoop_version={{ request.session.plugin_version }}&guide_template_type=worker{% endif %}">
<span class="fa fa-plus"></span> {% trans "Create a Worker Node Group Template" %}</a>
</div>
<div>{% trans "Current choice:" %}
@ -145,7 +145,7 @@
<div>
<a class="btn btn-default btn-small btn-create btn-inline ajax-modal
{% if not request.session.guide_cluster_template_name %} disabled{% endif %}"
href="{% if request.session.guide_cluster_template_name %}{% url 'horizon:project:data_processing.clusters:configure-cluster' request.session.plugin_name request.session.plugin_version request.session.guide_cluster_template_name%}{% endif %}">
href="{% if request.session.guide_cluster_template_name %}{% url 'horizon:project:data_processing.clusters:configure-cluster'%}?plugin_name={{ request.session.plugin_name }}&hadoop_version={{ request.session.plugin_version }}&cluster_template_name={{ request.session.guide_cluster_template_name }}{% endif %}">
<span class="fa fa-plus"></span> {% trans "Launch a Cluster" %}</a>
</div>
</div>

View File

@ -67,7 +67,7 @@
</div>
<div>
<a class="btn btn-default btn-small btn-create btn-inline ajax-modal{% if not request.session.guide_job_type %} disabled{% endif %}"
href="{% url 'horizon:project:data_processing.jobs:create-job' request.session.guide_job_type %}">
href="{% url 'horizon:project:data_processing.jobs:create-job'%}?guide_job_type={{ request.session.guide_job_type }}">
<span class="fa fa-plus"></span> {% trans "Create a job template" %}</a>
</div>
<div>{% trans "Job template:" %}