Browse Source

[ui-oozie] Hide the widget drop zone above end if a decision node is present in the workflow (#3793)

This takes care of a bug where it was possible to add a "detached" widget after a decision node in the Oozie workflow editor.
Johan Åhlén 1 year ago
parent
commit
fa15c5b16e

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

@@ -1432,6 +1432,13 @@ var ExtendedColumn = function (size, rows, viewModel) {
     return _row;
   }, self);
 
+  self.containsDecisionNode = ko.pureComputed(function () {
+    return self.rows().some(function (row) {
+      return row.widgets().some(function (widget) {
+        return widget.widgetType() === 'decision-widget';
+      });
+    });
+  });
 
   self.oozieRows = ko.computed(function () {
     var _rows = [];

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -69,7 +69,7 @@
     </div>
     <div data-bind="template: { name: 'internal-row-template', foreach: oozieRows}">
     </div>
-    <div class="container-fluid" data-bind="visible: $root.isEditing() && rows().length > 0">
+    <div class="container-fluid" data-bind="visible: $root.isEditing() && rows().length > 0 && !containsDecisionNode()">
       <div class="row-fluid">
         <div data-bind="visible: enableOozieDropOnAfter, css: {'span4 offset4': true, 'drop-target': true, 'drop-target-dragging': $root.isDragging(), 'is-editing': $root.isEditing}, droppable: {enabled: $root.isEditing, onDrop: function(){ var _w = $root.addDraggedWidget($data, false); widgetDraggedAdditionalHandler(_w); } }">
           <span data-bind="visible: oozieRows().length == 0">${ _('Drop your action here') }</span>