Răsfoiți Sursa

[oozie] Drag a node onto workflow editor.

When adding a new node, users are now able to drag the node onto the canvas.
In order to save the workflow, the user will likely have to edit the node first.
Catching the 'dragstop' event, which should be called after 'drop'.
Cannot handle the 'drop' event since the workflow editor must use them and stops event bubbling.
abec 13 ani în urmă
părinte
comite
64a2df6

+ 2 - 1
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -574,6 +574,7 @@ $('#workflow').on('mousedown', '.new-node-link', function(e) {
   var old_position = el.offset();
 
   // Trigger fake mousedown event to start dragging node.
+  var is_dirty = workflow.is_dirty();
   el.offset({ top: e.pageY - el.height()/10, left: e.pageX - el.width()/10 });
   el.trigger($.Event("mousedown", {pageX: e.pageX, pageY: e.pageY, target: el[0], which: 1}));
 
@@ -582,7 +583,7 @@ $('#workflow').on('mousedown', '.new-node-link', function(e) {
     node.detach();
     node.erase();
     modal.hide();
-    workflow.is_dirty( false );
+    workflow.is_dirty( is_dirty );
     $('#workflow').trigger('workflow:rebuild');
   };