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

Side by Side Diff: appengine/swarming/elements/res/imp/tasklist/task-list.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, 3 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 unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 Copyright 2016 The LUCI Authors. All rights reserved. 2 Copyright 2016 The LUCI Authors. All rights reserved.
3 Use of this source code is governed under the Apache License, Version 2.0 3 Use of this source code is governed under the Apache License, Version 2.0
4 that can be found in the LICENSE file. 4 that can be found in the LICENSE file.
5 5
6 This in an HTML Import-able file that contains the definition 6 This in an HTML Import-able file that contains the definition
7 of the following elements: 7 of the following elements:
8 8
9 <task-list> 9 <task-list>
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return this._attribute(task, "human_" + attr)[0]; 220 return this._attribute(task, "human_" + attr)[0];
221 } 221 }
222 } 222 }
223 var columnMap = { 223 var columnMap = {
224 abandoned_ts: humanTime("abandoned_ts"), 224 abandoned_ts: humanTime("abandoned_ts"),
225 completed_ts: humanTime("completed_ts"), 225 completed_ts: humanTime("completed_ts"),
226 costs_usd: function(task) { 226 costs_usd: function(task) {
227 return this._attribute(task, "costs_usd", 0)[0]; 227 return this._attribute(task, "costs_usd", 0)[0];
228 }, 228 },
229 created_ts: humanTime("created_ts"), 229 created_ts: humanTime("created_ts"),
230 duration: humanTime("duration"),
230 modified_ts: humanTime("modified_ts"), 231 modified_ts: humanTime("modified_ts"),
231 started_ts: humanTime("started_ts"), 232 started_ts: humanTime("started_ts"),
232 state: function(task) { 233 state: function(task) {
233 var state = this._attribute(task, "state")[0]; 234 var state = this._attribute(task, "state")[0];
234 if (state === "COMPLETED") { 235 if (state === "COMPLETED") {
235 236
236 if (this._attribute(task, "failure", false)[0]) { 237 if (this._attribute(task, "failure", false)[0]) {
237 return "COMPLETED (FAILURE)"; 238 return "COMPLETED (FAILURE)";
238 } 239 }
239 var tryNum = this._attribute(task, "try_number", "-1")[0]; 240 var tryNum = this._attribute(task, "try_number", "-1")[0];
(...skipping 12 matching lines...) Expand all
252 // Given a time attribute like "abandoned_ts", sortableTime returns a functi on 253 // Given a time attribute like "abandoned_ts", sortableTime returns a functi on
253 // that compares the tasks based on the attribute. This is used for sorting . 254 // that compares the tasks based on the attribute. This is used for sorting .
254 function sortableTime(attr) { 255 function sortableTime(attr) {
255 // sort times based on the string they come with, formatted like 256 // sort times based on the string they come with, formatted like
256 // "2016-08-16T13:12:40.606300" which sorts correctly. Locale time 257 // "2016-08-16T13:12:40.606300" which sorts correctly. Locale time
257 // (used in the columns), does not. 258 // (used in the columns), does not.
258 return function(dir, a, b) { 259 return function(dir, a, b) {
259 var aCol = this._attribute(a, attr)[0]; 260 var aCol = this._attribute(a, attr)[0];
260 var bCol = this._attribute(b, attr)[0]; 261 var bCol = this._attribute(b, attr)[0];
261 262
262 return dir * swarming.naturalCompare(aCol, bCol); 263 return dir * (aCol - bCol);
263 } 264 }
264 } 265 }
265 var specialSort = { 266 var specialSort = {
266 abandoned_ts: sortableTime("abandoned_ts"), 267 abandoned_ts: sortableTime("abandoned_ts"),
267 completed_ts: sortableTime("completed_ts"), 268 completed_ts: sortableTime("completed_ts"),
268 created_ts: sortableTime("created_ts"), 269 created_ts: sortableTime("created_ts"),
270 duration: sortableTime("duration"),
269 modified_ts: sortableTime("modified_ts"), 271 modified_ts: sortableTime("modified_ts"),
270 started_ts: sortableTime("started_ts"), 272 started_ts: sortableTime("started_ts"),
271 }; 273 };
272 274
273 Polymer({ 275 Polymer({
274 is: 'task-list', 276 is: 'task-list',
275 behaviors: [ 277 behaviors: [
276 SwarmingBehaviors.DynamicTableBehavior, 278 SwarmingBehaviors.DynamicTableBehavior,
277 ], 279 ],
278 280
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 return undefined; 358 return undefined;
357 } 359 }
358 return task.tagMap[col]; 360 return task.tagMap[col];
359 }, 361 },
360 362
361 _taskLink: function(taskId) { 363 _taskLink: function(taskId) {
362 if (!taskId) { 364 if (!taskId) {
363 return undefined; 365 return undefined;
364 } 366 }
365 // TODO(kjlubick) Make this point to /newui/ when appropriate. 367 // TODO(kjlubick) Make this point to /newui/ when appropriate.
366 return "/restricted/task/"+taskId; 368 return "/user/task/"+taskId;
367 }, 369 },
368 370
369 _taskClass: function(task) { 371 _taskClass: function(task) {
370 var state = this._column("state", task); 372 var state = this._column("state", task);
371 if (state === "CANCELED" ||state === "TIMED_OUT" || state === "EXPIRED") { 373 if (state === "CANCELED" ||state === "TIMED_OUT" || state === "EXPIRED") {
372 return "exception"; 374 return "exception";
373 } 375 }
374 if (state === "BOT_DIED") { 376 if (state === "BOT_DIED") {
375 return "died"; 377 return "died";
376 } 378 }
377 if (state === "COMPLETED (FAILURE)") { 379 if (state === "COMPLETED (FAILURE)") {
378 return "failed"; 380 return "failed";
379 } 381 }
380 if (state === "RUNNING" || state === "PENDING") { 382 if (state === "RUNNING" || state === "PENDING") {
381 return "pending"; 383 return "pending";
382 } 384 }
383 return ""; 385 return "";
384 } 386 }
385 387
386 }); 388 });
387 })(); 389 })();
388 </script> 390 </script>
389 </dom-module> 391 </dom-module>
OLDNEW
« no previous file with comments | « appengine/swarming/elements/build/elements.html ('k') | appengine/swarming/elements/res/imp/tasklist/task-list-data.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698