| 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 <task-page-data> | 9 <task-page-data> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 Methods: | 31 Methods: |
| 32 request(): Force a fetch of the data. This happens automatically when | 32 request(): Force a fetch of the data. This happens automatically when |
| 33 auth_headers is set or task_id is changed. | 33 auth_headers is set or task_id is changed. |
| 34 | 34 |
| 35 Events: | 35 Events: |
| 36 None. | 36 None. |
| 37 --> | 37 --> |
| 38 | 38 |
| 39 | 39 |
| 40 <link rel="import" href="/res/imp/common/common-behavior.html"> | 40 <link rel="import" href="/res/imp/common/common-behavior.html"> |
| 41 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 41 | 42 |
| 42 <dom-module id="task-page-data"> | 43 <dom-module id="task-page-data"> |
| 43 <script> | 44 <script> |
| 44 (function(){ | 45 (function(){ |
| 45 // Time to wait before requesting a new task. This is to allow a user to | 46 // Time to wait before requesting a new task. This is to allow a user to |
| 46 // type in a name and not have it make one set of requests for each | 47 // type in a name and not have it make one set of requests for each |
| 47 // keystroke. | 48 // keystroke. |
| 48 var TASK_ID_DEBOUNCE_MS = 400; | 49 var TASK_ID_DEBOUNCE_MS = 400; |
| 49 var lastRequest; | 50 var lastRequest; |
| 50 | 51 |
| 51 var TIMES = ["abandoned_ts", "completed_ts", "created_ts", "modified_ts", "s
tarted_ts"]; | 52 var TIMES = ["abandoned_ts", "completed_ts", "created_ts", "modified_ts", "s
tarted_ts"]; |
| 52 | 53 |
| 53 Polymer({ | 54 Polymer({ |
| 54 is: 'task-page-data', | 55 is: 'task-page-data', |
| 55 | 56 |
| 56 behaviors: [ | 57 behaviors: [ |
| 57 SwarmingBehaviors.CommonBehavior, | 58 SwarmingBehaviors.CommonBehavior, |
| 59 SwarmingBehaviors.TaskBehavior, |
| 58 ], | 60 ], |
| 59 | 61 |
| 60 properties: { | 62 properties: { |
| 61 // inputs | 63 // inputs |
| 62 auth_headers: { | 64 auth_headers: { |
| 63 type: Object, | 65 type: Object, |
| 64 }, | 66 }, |
| 65 task_id: { | 67 task_id: { |
| 66 type: String, | 68 type: String, |
| 67 }, | 69 }, |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return {}; | 176 return {}; |
| 175 } | 177 } |
| 176 var now = new Date(); | 178 var now = new Date(); |
| 177 TIMES.forEach(function(time) { | 179 TIMES.forEach(function(time) { |
| 178 if (result[time]) { | 180 if (result[time]) { |
| 179 result[time] = new Date(result[time]); | 181 result[time] = new Date(result[time]); |
| 180 result["human_"+time] = sk.human.localeTime(result[time]); | 182 result["human_"+time] = sk.human.localeTime(result[time]); |
| 181 } | 183 } |
| 182 }); | 184 }); |
| 183 // Running tasks have no duration set, so we can figure it out. | 185 // Running tasks have no duration set, so we can figure it out. |
| 184 if (!result.duration && result.state === "RUNNING" && result.started_ts)
{ | 186 if (!result.duration && result.state === this.RUNNING && result.started_
ts){ |
| 185 result.duration = (now - result.started_ts) / 1000; | 187 result.duration = (now - result.started_ts) / 1000; |
| 186 } | 188 } |
| 187 // Make the duration human readable | 189 // Make the duration human readable |
| 188 if (result.duration){ | 190 if (result.duration){ |
| 189 result.human_duration = this._humanDuration(result.duration); | 191 result.human_duration = this._humanDuration(result.duration); |
| 190 } | 192 } |
| 191 // result.bot_dimensions | 193 // result.bot_dimensions |
| 192 if (result.bot_dimensions) { | 194 if (result.bot_dimensions) { |
| 193 result.bot_dimensions.forEach(function(dim){ | 195 result.bot_dimensions.forEach(function(dim){ |
| 194 if (swarming.alias.has(dim.key)) { | 196 if (swarming.alias.has(dim.key)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 206 if (!stdout || !stdout.output) { | 208 if (!stdout || !stdout.output) { |
| 207 return ""; | 209 return ""; |
| 208 } | 210 } |
| 209 return stdout.output; | 211 return stdout.output; |
| 210 } | 212 } |
| 211 | 213 |
| 212 }); | 214 }); |
| 213 })(); | 215 })(); |
| 214 </script> | 216 </script> |
| 215 </dom-module> | 217 </dom-module> |
| OLD | NEW |