Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: appengine/swarming/elements/res/imp/tasklist/task-list-data.html

Issue 2297853002: Make durations look nice on the task list (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/elements/res/imp/tasklist/task-list-data.html
diff --git a/appengine/swarming/elements/res/imp/tasklist/task-list-data.html b/appengine/swarming/elements/res/imp/tasklist/task-list-data.html
index d393ac7dbb64b3ba394627e8c0b77bd2778232a5..aceba1f3b9fb1d1932740f06502f0a75a9e962e7 100644
--- a/appengine/swarming/elements/res/imp/tasklist/task-list-data.html
+++ b/appengine/swarming/elements/res/imp/tasklist/task-list-data.html
@@ -237,7 +237,8 @@
// Date.toString() looks like "Mon Aug 29 2016 09:03:41 GMT-0400 (EDT)"
// we want to extract the time zone part and append it to the
// locale time.
- var str = (new Date()).toString();
+ var now = new Date();
+ var str = now.toString();
var timeZone = str.substring(str.indexOf("("))
// Do any preprocessing here
@@ -252,11 +253,19 @@
t.tagMap = tagMap;
TIMES.forEach(function(time) {
if (t[time]) {
- var d = new Date(t[time]);
- var locale = d.toLocaleString();
+ t[time] = new Date(t[time]);
+ var locale = t[time].toLocaleString();
t["human_"+time] = locale + " " + timeZone;
}
});
+ // Running tasks have no duration set, so we can figure it out.
+ if (!t.duration && t.state === "RUNNING" && t.started_ts){
+ t.duration = (now - t.started_ts) / 1000;
+ }
+ // Make the duration human readable
+ if (t.duration){
+ t.human_duration = sk.human.strDuration(t.duration);
+ }
});
return this._list.items;
}
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698