Browse Source

HUE-6724 [jb] Job progress can have too many decimals

Enrico Berti 8 năm trước cách đây
mục cha
commit
cd6b794376
1 tập tin đã thay đổi với 11 bổ sung1 xóa
  1. 11 1
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

+ 11 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -209,7 +209,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
                       <td data-bind="text: user"></td>
                       <td data-bind="text: type"></td>
                       <td data-bind="text: status"></td>
-                      <td data-bind="text: progress"></td>
+                      <td data-bind="text: $root.formatProgress(progress)"></td>
                       <td data-bind="text: queue"></td>
                       <td data-bind="moment: {data: submitted, format: 'LLL'}"></td>
                       <td data-bind="text: duration().toHHMMSS()"></td>
@@ -2258,6 +2258,16 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         return path;
       }
 
+      self.formatProgress = function (progress) {
+        if (typeof progress === 'function') {
+          progress = progress();
+        }
+        if (!isNaN(progress)) {
+          return Math.round(progress*100)/100 + '%';
+        }
+        return progress;
+      }
+
       self.load = function() {
         var h = window.location.hash;
         %if not is_mini: