Chromium Code Reviews| Index: appengine/swarming/ui/res/imp/common/common-behavior.html |
| diff --git a/appengine/swarming/ui/res/imp/common/common-behavior.html b/appengine/swarming/ui/res/imp/common/common-behavior.html |
| index bbb605d58194a3cdc3888bfd70f80b42a45dd10d..2b753162608abdd0073f3cdc396adf8f68691fb5 100644 |
| --- a/appengine/swarming/ui/res/imp/common/common-behavior.html |
| +++ b/appengine/swarming/ui/res/imp/common/common-behavior.html |
| @@ -157,7 +157,29 @@ |
| }, |
| _humanDuration: function(timeInSecs) { |
| - return sk.human.strDuration(timeInSecs) || "0s"; |
| + // If the timeInSecs is 0 (e.g. duration of Terminate bot tasks), we |
| + // still want to display 0s. |
| + if (timeInSecs === 0 || timeInSecs === "0") { |
|
stephana
2017/05/31 15:00:42
.... timeInSecs === "0" should be omitted IMO. Str
kjlubick
2017/05/31 15:02:53
I put it in there such that 0 and "0" become "0s"
stephana
2017/05/31 17:29:19
Ack
|
| + return "0s"; |
| + } |
| + // Otherwise, if timeInSecs is falsey (e.g. undefined), return empty |
| + // string to reflect that. |
| + if (!timeInSecs) { |
| + return ""; |
| + } |
| + ptimeInSecs = parseFloat(timeInSecs); |
| + // On a bad parse (shouldn't happen), show original. |
| + if (!ptimeInSecs) { |
| + return timeInSecs + " seconds"; |
| + } |
| + |
| + // For times greater than a minute, make them human readable |
| + // e.g. 2h 43m or 13m 42s |
| + if (ptimeInSecs > 60){ |
| + return sk.human.strDuration(ptimeInSecs); |
| + } |
| + // For times less than a minute, add 10ms resolution. |
| + return ptimeInSecs.toFixed(2)+"s"; |
| }, |
| _not: function(a) { |