| OLD | NEW |
| 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 <bot-page-data> | 9 <bot-page-data> |
| 10 | 10 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 task[time] = new Date(task[time]); | 212 task[time] = new Date(task[time]); |
| 213 task["human_"+time] = formatDate(task[time]); | 213 task["human_"+time] = formatDate(task[time]); |
| 214 } | 214 } |
| 215 }); | 215 }); |
| 216 | 216 |
| 217 if (task.duration) { | 217 if (task.duration) { |
| 218 task.human_duration = this._humanDuration(task.duration); | 218 task.human_duration = this._humanDuration(task.duration); |
| 219 } else { | 219 } else { |
| 220 var end = task.completed_ts || task.abandoned_ts || task.modified_ts
|| new Date(); | 220 var end = task.completed_ts || task.abandoned_ts || task.modified_ts
|| new Date(); |
| 221 task.human_duration = this._timeDiffExact(task.started_ts, end); | 221 task.human_duration = this._timeDiffExact(task.started_ts, end); |
| 222 task.duration = (end.getTime() - task.started_ts) / 1000; |
| 222 } | 223 } |
| 223 | 224 |
| 224 task.state = task.state || "UNKNOWN"; | 225 task.state = task.state || "UNKNOWN"; |
| 225 if (task.state === "COMPLETED") { | 226 if (task.state === "COMPLETED") { |
| 226 if (task.failure) { | 227 if (task.failure) { |
| 227 task.state = "FAILURE"; | 228 task.state = "FAILURE"; |
| 228 } else { | 229 } else { |
| 229 task.state = "SUCCESS"; | 230 task.state = "SUCCESS"; |
| 230 } | 231 } |
| 231 } | 232 } |
| 232 | 233 |
| 233 }.bind(this)); | 234 }.bind(this)); |
| 234 | 235 |
| 235 // Sort the most recent tasks first. | 236 // Sort the most recent tasks first. |
| 236 tasks.sort(function(a,b) { | 237 tasks.sort(function(a,b) { |
| 237 return b.started_ts - a.started_ts; | 238 return b.started_ts - a.started_ts; |
| 238 }); | 239 }); |
| 239 | 240 |
| 240 return tasks; | 241 return tasks; |
| 241 } | 242 } |
| 242 | 243 |
| 243 }); | 244 }); |
| 244 })(); | 245 })(); |
| 245 </script> | 246 </script> |
| 246 </dom-module> | 247 </dom-module> |
| OLD | NEW |