Sfoglia il codice sorgente

HUE-6395 [oozie] Bundle submittion should not redirect to Hue 3

Romain Rigaux 8 anni fa
parent
commit
0dee301

+ 1 - 0
apps/oozie/src/oozie/static/oozie/js/bundle-editor.ko.js

@@ -129,6 +129,7 @@ var BundleEditorViewModel = function (bundle_json, coordinators_json, can_edit_j
     if (!self.bundle.isDirty()) {
       hueAnalytics.log('oozie/editor/bundle', 'submit');
       $.get("/oozie/editor/bundle/submit/" + self.bundle.id(), {
+        format: IS_HUE_4 ? 'json' : 'html'
       }, function (data) {
         $(document).trigger("showSubmitPopup", data);
       }).fail(function (xhr, textStatus, errorThrown) {

+ 5 - 1
apps/oozie/src/oozie/templates/editor2/bundle_editor.mako

@@ -343,7 +343,11 @@ ${ dashboard.import_bindings() }
      _el.datepicker('show');
     });
 
-
+    huePubSub.subscribe('submit.popup.return', function (data) {
+      $.jHueNotify.info('${_('Bundle submitted.')}');
+      huePubSub.publish('open.link', '/jobbrowser/#!id=' + data.job_id);
+      $('.submit-modal').modal('hide');
+    }, 'oozie');
   });
 </script>
 

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/common_scheduler.inc.mako

@@ -387,7 +387,7 @@ from django.utils.translation import ugettext as _
 
 <%def name="import_modals()">
 
-<div id="chooseWorkflowDemiModal" class="${ is_embeddable and 'modal' or 'demi-modal' } fade" data-backdrop="false">
+<div id="chooseWorkflowDemiModal" class="${ is_embeddable and 'modal' or 'demi-modal' } fade" data-backdrop="false" style="z-index: -1">
   %if is_embeddable:
   <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-label="${ _('Close') }"><span aria-hidden="true">&times;</span></button>

+ 7 - 2
apps/oozie/src/oozie/views/editor2.py

@@ -852,8 +852,12 @@ def submit_bundle(request, doc_id):
       mapping = dict([(param['name'], param['value']) for param in params_form.cleaned_data])
       job_id = _submit_bundle(request, bundle, mapping)
 
-      request.info(_('Bundle submitted.'))
-      return redirect(reverse('oozie:list_oozie_bundle', kwargs={'job_id': job_id}))
+      jsonify = request.POST.get('format') == 'json'
+      if jsonify:
+        return JsonResponse({'status': 0, 'job_id': job_id}, safe=False)
+      else:
+        request.info(_('Bundle submitted.'))
+        return redirect(reverse('oozie:list_oozie_bundle', kwargs={'job_id': job_id}))
     else:
       request.error(_('Invalid submission form: %s' % params_form.errors))
   else:
@@ -865,6 +869,7 @@ def submit_bundle(request, doc_id):
                  'params_form': params_form,
                  'name': bundle.name,
                  'action': reverse('oozie:editor_submit_bundle',  kwargs={'doc_id': bundle.id}),
+                 'return_json': request.GET.get('format') == 'json',
                  'show_dryrun': False
                 }, force_template=True).content
   return JsonResponse(popup, safe=False)