Просмотр исходного кода

HUE-6395 [oozie] Avoid post submission event conflicts with other job types

Romain Rigaux 8 лет назад
Родитель
Сommit
0929ff8

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

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

+ 5 - 3
apps/oozie/src/oozie/templates/editor2/coordinator_editor.mako

@@ -184,9 +184,11 @@ ${ scheduler.import_sla_cron(coordinator_json) }
     });
 
     huePubSub.subscribe('submit.popup.return', function (data) {
-      $.jHueNotify.info('${_('Schedule submitted.')}');
-      huePubSub.publish('open.link', '/jobbrowser/#!id=' + data.job_id);
-      $('.submit-modal').modal('hide');
+      if (data.type == 'schedule') {
+        $.jHueNotify.info('${_('Schedule submitted.')}');
+        huePubSub.publish('open.link', '/jobbrowser/#!id=' + data.job_id);
+        $('.submit-modal').modal('hide');
+      }
     }, 'oozie');
   });
 </script>

+ 5 - 3
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -872,9 +872,11 @@ ${ dashboard.import_bindings() }
     });
 
     huePubSub.subscribe('submit.popup.return', function (data) {
-      $.jHueNotify.info('${_('Workflow submitted.')}');
-      huePubSub.publish('open.link', '/jobbrowser/#!id=' + data.job_id);
-      $('.submit-modal').modal('hide');
+      if (data.type == 'workflow') {
+        $.jHueNotify.info('${_('Workflow submitted.')}');
+        huePubSub.publish('open.link', '/jobbrowser/#!id=' + data.job_id);
+        $('.submit-modal').modal('hide');
+      }
     }, 'oozie');
 
     huePubSub.subscribe('oozie.draggable.section.change', function(val){

+ 3 - 3
apps/oozie/src/oozie/views/editor2.py

@@ -411,7 +411,7 @@ def _submit_workflow_helper(request, workflow, submit_action):
         raise PopupException(_('Workflow submission failed'), detail=smart_str(e))
       jsonify = request.POST.get('format') == 'json'
       if jsonify:
-        return JsonResponse({'status': 0, 'job_id': job_id}, safe=False)
+        return JsonResponse({'status': 0, 'job_id': job_id, 'type': 'workflow'}, safe=False)
       else:
         request.info(_('Workflow submitted'))
         return redirect(reverse('oozie:list_oozie_workflow', kwargs={'job_id': job_id}))
@@ -678,7 +678,7 @@ def submit_coordinator(request, doc_id):
       jsonify = request.POST.get('format') == 'json'
       job_id = _submit_coordinator(request, coordinator, mapping)
       if jsonify:
-        return JsonResponse({'status': 0, 'job_id': job_id}, safe=False)
+        return JsonResponse({'status': 0, 'job_id': job_id, 'type': 'schedule'}, safe=False)
       else:
         request.info(_('Coordinator submitted.'))
         return redirect(reverse('oozie:list_oozie_coordinator', kwargs={'job_id': job_id}))
@@ -854,7 +854,7 @@ def submit_bundle(request, doc_id):
 
       jsonify = request.POST.get('format') == 'json'
       if jsonify:
-        return JsonResponse({'status': 0, 'job_id': job_id}, safe=False)
+        return JsonResponse({'status': 0, 'job_id': job_id, 'type': 'bundle'}, safe=False)
       else:
         request.info(_('Bundle submitted.'))
         return redirect(reverse('oozie:list_oozie_bundle', kwargs={'job_id': job_id}))