Browse Source

HUE-5769 [oozie] Remove mandatory inclusion of Kill row in the workflow dashobard graph

Opening workflows without a Kill node break several tabs in the dashboard page.
This fix will add the kill-widget only when there is a kill-node in the XML
krish 8 years ago
parent
commit
841f7ef

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

@@ -484,6 +484,12 @@ var Workflow = function (vm, workflow) {
     });
     return _node;
   };
+
+  self.hasKillNode = ko.pureComputed(function() {
+    return $.grep(self.nodes(), function(node) {
+      return node.type() == 'kill-widget';
+    }).length > 0;
+  });
 }
 
 var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_json, workflow_properties_json, subworkflows_json, can_edit_json, history_json) {

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

@@ -79,7 +79,9 @@
 
     <div data-bind="template: { name: 'row-template', data: oozieEndRow }"></div>
 
-    <div data-bind="template: { name: 'row-template', data: oozieKillRow }" style="margin-top: 60px"></div>
+    <!-- ko if: $root.workflow.hasKillNode() -->
+      <div data-bind="template: { name: 'row-template', data: oozieKillRow }" style="margin-top: 60px"></div>
+    <!-- /ko -->
   </div>
 </script>