Browse Source

HUE-6432 [oozie] Submission error not displayed

Romain Rigaux 8 years ago
parent
commit
6d10f55d6e

+ 2 - 0
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -488,9 +488,11 @@ ${ fb_components.menubar() }
   $(document).ready(function () {
     ko.applyBindings(viewModel, $('#fileviewerComponents')[0]);
 
+    % if not is_embeddable:
     $(document).ajaxError(function () {
       $.jHueNotify.error("${_('There was an unexpected server error.')}");
     });
+    % endif
 
     setTimeout(function () {
       resizeText();

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

@@ -531,6 +531,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
     self.workflow_properties = ko.mapping.fromJS(workflow_properties_json);
     loadWorkflowLayout(self, layout_json);
     self.workflow.loadNodes(workflow_json);
+    self.workflow.tracker().markCurrentStateAsClean();
   };
 
   self.tempDocument = ko.observable();
@@ -1256,7 +1257,6 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
 
 
   self.drawArrows = function () {
-
     function linkWidgets(fromId, toId) {
       var _from = $("#wdg_" + (typeof fromId == "function" ? fromId() : fromId));
       var _to = $("#wdg_" + (typeof toId == "function" ? toId() : toId));

+ 10 - 1
apps/oozie/src/oozie/templates/editor2/submit_job_popup.mako

@@ -178,8 +178,17 @@
         type: "POST",
         url: '${ action }',
         data: $('.submit-form').serialize(),
+        dataType: "json",
         success: function (data) {
-          huePubSub.publish('submit.popup.return', data);
+          if (data.status == 0) {
+            huePubSub.publish('submit.popup.return', data);
+          } else {
+            var message = "${ _('Submission was not successful') }";
+            if (data.message) {
+              message = data.message;
+            }
+            $.jHueNotify.error(data.message + (data.detail ? (': ' + data.detail) : ''));
+          }
         }
       });
       e.preventDefault();

+ 0 - 1
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -619,7 +619,6 @@ ${ dashboard.import_bindings() }
   viewModel.currentDraggableSection(defaultSection);
 
   viewModel.init();
-  viewModel.workflow.tracker().markCurrentStateAsClean();
   fullLayout(viewModel);
 
   var globalFilechooserOptions = {

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

@@ -408,7 +408,7 @@ def _submit_workflow_helper(request, workflow, submit_action):
       try:
         job_id = _submit_workflow(request.user, request.fs, request.jt, workflow, mapping)
       except Exception, e:
-        raise PopupException(_('Workflow submission failed'), detail=smart_str(e))
+        raise PopupException(_('Workflow submission failed'), detail=smart_str(e), error_code=200)
       jsonify = request.POST.get('format') == 'json'
       if jsonify:
         return JsonResponse({'status': 0, 'job_id': job_id, 'type': 'workflow'}, safe=False)
@@ -713,7 +713,7 @@ def _submit_coordinator(request, coordinator, mapping):
     return job_id
   except RestException, ex:
     LOG.exception('Error submitting coordinator')
-    raise PopupException(_("Error submitting coordinator %s") % (coordinator,), detail=ex._headers.get('oozie-error-message', ex))
+    raise PopupException(_("Error submitting coordinator %s") % (coordinator,), detail=ex._headers.get('oozie-error-message', ex), error_code=200)
 
 
 @check_editor_access_permission
@@ -904,4 +904,4 @@ def _submit_bundle(request, bundle, properties):
     return job_id
   except RestException, ex:
     LOG.exception('Error submitting bundle')
-    raise PopupException(_("Error submitting bundle %s") % (bundle,), detail=ex._headers.get('oozie-error-message', ex))
+    raise PopupException(_("Error submitting bundle %s") % (bundle,), detail=ex._headers.get('oozie-error-message', ex), error_code=200)