Răsfoiți Sursa

[oozie] Add kill button to workflow

abec 13 ani în urmă
părinte
comite
d785fd7

+ 18 - 0
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow.mako

@@ -76,6 +76,12 @@ ${ layout.menubar(section='dashboard') }
     </div>
     <div class="span3">
       <span class="label ${ utils.get_status(oozie_workflow.status) }">${ oozie_workflow.status }</span>
+      % if oozie_workflow.status == 'RUNNING':
+        &nbsp;
+        <button type="button" class="btn manage-oozie-job-btn" data-url="${ url('oozie:manage_oozie_jobs', job_id=oozie_workflow.id, action='kill') }">
+          ${ _('Kill') }
+        </button>
+      % endif
     </div>
   </div>
 
@@ -252,6 +258,18 @@ ${ layout.menubar(section='dashboard') }
     $(".action-link").click(function(){
       window.location = $(this).attr('data-edit');
     });
+    $(".manage-oozie-job-btn").click(function() {
+       $.post($(this).attr("data-url"),
+          function(response) {
+            if (response['status'] != 0) {
+              $.jHueNotify.error('Problem: ' + response['data']);
+            } else {
+              window.location.reload();
+            }
+          }
+        );
+        return false;
+    });
 
     $("a[data-row-selector='true']").jHueRowSelector();
   });

+ 6 - 0
apps/oozie/src/oozie/tests.py

@@ -116,6 +116,12 @@ class TestEditor:
     pass
 
 
+  def test_manage_workflow(self):
+    # Kill button in response
+    response = self.c.get(reverse('oozie:list_oozie_workflow', args=[MockOozieApi.WORKFLOW_IDS[0]]), {}, follow=True)
+    assert_true(('%s/kill' % MockOozieApi.WORKFLOW_IDS[0]) in response.content)
+
+
   def test_move_up(self):
     action1 = Node.objects.get(name='action-name-1')
     action2 = Node.objects.get(name='action-name-2')