浏览代码

HUE-2291 [oozie] Adding progress call for workflows

Enrico Berti 11 年之前
父节点
当前提交
8996e82

+ 2 - 2
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinators.mako

@@ -384,7 +384,7 @@ ${layout.menubar(section='coordinators', dashboard=True)}
                       'data-message="${ _('The coordinator was killed!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to kill this job?') }"' +
                       '>${ _('Kill') }</a>';
-              suspendCell = '<a class="btn btn-small confirmationModal" ' +
+              suspendCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + coord.suspendUrl + '" ' +
                       'title="${ _('Suspend') } ' + coord.id + '"' +
@@ -392,7 +392,7 @@ ${layout.menubar(section='coordinators', dashboard=True)}
                       'data-message="${ _('The coordinator was suspended!') }" ' +
                       'data-confirmation-message="${ _('Are you sure you\'d like to suspend this job?') }"' +
                       '>${ _('Suspend') }</a>';
-              resumeCell = '<a class="btn btn-small confirmationModal" ' +
+              resumeCell = '<a class="btn btn-mini confirmationModal" ' +
                       'href="javascript:void(0)" ' +
                       'data-url="' + coord.resumeUrl + '" ' +
                       'title="${ _('Resume') } ' + coord.id + '"' +

+ 30 - 5
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflows.mako

@@ -306,6 +306,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
 
     refreshRunning();
     refreshCompleted();
+    refreshProgress();
 
     var numRunning = 0;
 
@@ -318,7 +319,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
           $(nNodes).each(function (iNode, node) {
             var nodeFound = false;
             $(data).each(function (iWf, currentItem) {
-              if ($(node).children("td").eq(5).text() == currentItem.id) {
+              if ($(node).children("td").eq(6).text() == currentItem.id) {
                 nodeFound = true;
               }
             });
@@ -332,7 +333,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
             var wf = new Workflow(item);
             var foundRow = null;
             $(nNodes).each(function (iNode, node) {
-              if ($(node).children("td").eq(5).text() == wf.id) {
+              if ($(node).children("td").eq(6).text() == wf.id) {
                 foundRow = node;
               }
             });
@@ -372,7 +373,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
                     emptyStringIfNull(wf.lastModTime),
                     '<span class="' + wf.statusClass + '">' + wf.status + '</span>',
                     wf.appName,
-                    '<div class="progress"><div class="' + wf.progressClass + '" style="width:' + wf.progress + '%">' + wf.progress + '%</div></div>',
+                    '<div class="progress"></div>',
                     wf.user,
                     emptyStringIfNull(wf.lastModTime),
                     '<a href="' + wf.absoluteUrl + '" data-row-selector="true">' + wf.id + '</a>',
@@ -386,7 +387,6 @@ ${ layout.menubar(section='workflows', dashboard=True) }
             }
             else {
               runningTable.fnUpdate('<span class="' + wf.statusClass + '">' + wf.status + '</span>', foundRow, 1, false);
-              runningTable.fnUpdate('<div class="progress"><div class="' + wf.progressClass + '" style="width:' + wf.progress + '%">' + wf.progress + '%</div></div>', foundRow, 3, false);
               runningTable.fnUpdate(killCell + " " + (['RUNNING', 'PREP', 'WAITING'].indexOf(wf.status) > -1?suspendCell:resumeCell), foundRow, 7, false);
             }
           });
@@ -400,7 +400,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
         }
         numRunning = data.length;
 
-        window.setTimeout(refreshRunning, 1000);
+        window.setTimeout(refreshRunning, 5000);
       });
     }
 
@@ -427,6 +427,31 @@ ${ layout.menubar(section='workflows', dashboard=True) }
       });
     }
 
+    function refreshProgress() {
+      $.getJSON(window.location.pathname + "?format=json&type=progress", function (data) {
+        var nNodes = runningTable.fnGetNodes();
+        $(data).each(function (iWf, item) {
+            var wf = new Workflow(item);
+            var foundRow = null;
+            $(nNodes).each(function (iNode, node) {
+              if ($(node).children("td").eq(6).text() == wf.id) {
+                foundRow = node;
+              }
+            });
+            if (foundRow != null) {
+              runningTable.fnUpdate('<span class="' + wf.statusClass + '">' + wf.status + '</span>', foundRow, 1, false);
+              if (wf.progress == 0){
+                runningTable.fnUpdate('<div class="progress"></div>', foundRow, 3, false);
+              }
+              else {
+                runningTable.fnUpdate('<div class="progress"><div class="' + wf.progressClass + '" style="width:' + wf.progress + '%">' + wf.progress + '%</div></div>', foundRow, 3, false);
+              }
+            }
+          });
+        window.setTimeout(refreshProgress, 30000);
+      });
+    }
+
   });
 
 </script>