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

Side by Side Diff: appengine/swarming/elements/res/imp/tasklist/task-list.html

Issue 2338383002: Refactor prior to adding task-page (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: Address nits 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 "user": "Requesting User", 261 "user": "Requesting User",
262 }; 262 };
263 263
264 // Given a time attribute like "abandoned_ts", sortableTime returns a functi on 264 // Given a time attribute like "abandoned_ts", sortableTime returns a functi on
265 // that compares the tasks based on the attribute. This is used for sorting . 265 // that compares the tasks based on the attribute. This is used for sorting .
266 function sortableTime(attr) { 266 function sortableTime(attr) {
267 // sort times based on the string they come with, formatted like 267 // sort times based on the string they come with, formatted like
268 // "2016-08-16T13:12:40.606300" which sorts correctly. Locale time 268 // "2016-08-16T13:12:40.606300" which sorts correctly. Locale time
269 // (used in the columns), does not. 269 // (used in the columns), does not.
270 return function(dir, a, b) { 270 return function(dir, a, b) {
271 var aCol = this._attribute(a, attr)[0]; 271 var aCol = this._attribute(a, attr, "0")[0];
272 var bCol = this._attribute(b, attr)[0]; 272 var bCol = this._attribute(b, attr, "0")[0];
273 273
274 return dir * (aCol - bCol); 274 return dir * (aCol - bCol);
275 } 275 }
276 } 276 }
277 var specialSort = { 277 var specialSort = {
278 abandoned_ts: sortableTime("abandoned_ts"), 278 abandoned_ts: sortableTime("abandoned_ts"),
279 completed_ts: sortableTime("completed_ts"), 279 completed_ts: sortableTime("completed_ts"),
280 created_ts: sortableTime("created_ts"), 280 created_ts: sortableTime("created_ts"),
281 duration: sortableTime("duration"), 281 duration: sortableTime("duration"),
282 modified_ts: sortableTime("modified_ts"), 282 modified_ts: sortableTime("modified_ts"),
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 this.$.prompt.open(); 363 this.$.prompt.open();
364 }, 364 },
365 365
366 _tag: function(task, col) { 366 _tag: function(task, col) {
367 if (!task || !task.tagMap) { 367 if (!task || !task.tagMap) {
368 return undefined; 368 return undefined;
369 } 369 }
370 return task.tagMap[col]; 370 return task.tagMap[col];
371 }, 371 },
372 372
373 _taskLink: function(taskId) {
374 if (!taskId) {
375 return undefined;
376 }
377 // TODO(kjlubick) Make this point to /newui/ when appropriate.
378 return "/user/task/"+taskId;
379 },
380
381 _taskClass: function(task) { 373 _taskClass: function(task) {
382 var state = this._column("state", task); 374 var state = this._column("state", task);
383 if (state === "CANCELED" ||state === "TIMED_OUT" || state === "EXPIRED") { 375 if (state === "CANCELED" ||state === "TIMED_OUT" || state === "EXPIRED") {
384 return "exception"; 376 return "exception";
385 } 377 }
386 if (state === "BOT_DIED") { 378 if (state === "BOT_DIED") {
387 return "died"; 379 return "died";
388 } 380 }
389 if (state === "COMPLETED (FAILURE)") { 381 if (state === "COMPLETED (FAILURE)") {
390 return "failed"; 382 return "failed";
391 } 383 }
392 if (state === "RUNNING" || state === "PENDING") { 384 if (state === "RUNNING" || state === "PENDING") {
393 return "pending"; 385 return "pending";
394 } 386 }
395 return ""; 387 return "";
396 } 388 }
397 389
398 }); 390 });
399 })(); 391 })();
400 </script> 392 </script>
401 </dom-module> 393 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698