| 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-list-data> | 9 <bot-list-data> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 Methods: | 35 Methods: |
| 36 signIn(): Force a signin of the user using OAuth. This happens | 36 signIn(): Force a signin of the user using OAuth. This happens |
| 37 automatically when auth_headers is set. | 37 automatically when auth_headers is set. |
| 38 | 38 |
| 39 Events: | 39 Events: |
| 40 None. | 40 None. |
| 41 --> | 41 --> |
| 42 | 42 |
| 43 <link rel="import" href="/res/imp/common/common-behavior.html"> | 43 <link rel="import" href="/res/imp/common/common-behavior.html"> |
| 44 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 44 | 45 |
| 45 <dom-module id="task-list-data"> | 46 <dom-module id="task-list-data"> |
| 46 <script> | 47 <script> |
| 47 (function(){ | 48 (function(){ |
| 48 var TIMES = ["abandoned_ts", "completed_ts", "created_ts", "modified_ts", "s
tarted_ts"]; | 49 var TIMES = ["abandoned_ts", "completed_ts", "created_ts", "modified_ts", "s
tarted_ts"]; |
| 49 Polymer({ | 50 Polymer({ |
| 50 is: 'task-list-data', | 51 is: 'task-list-data', |
| 51 | 52 |
| 52 behaviors: [ | 53 behaviors: [ |
| 53 SwarmingBehaviors.CommonBehavior, | 54 SwarmingBehaviors.CommonBehavior, |
| 55 SwarmingBehaviors.TaskBehavior, |
| 54 ], | 56 ], |
| 55 | 57 |
| 56 properties: { | 58 properties: { |
| 57 // inputs | 59 // inputs |
| 58 auth_headers: { | 60 auth_headers: { |
| 59 type: Object, | 61 type: Object, |
| 60 observer: "signIn", | 62 observer: "signIn", |
| 61 }, | 63 }, |
| 62 query_params: { | 64 query_params: { |
| 63 type: Object, | 65 type: Object, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 184 } |
| 183 | 185 |
| 184 // Add some options that might not show up. | 186 // Add some options that might not show up. |
| 185 pMap["android_devices"].push("0"); | 187 pMap["android_devices"].push("0"); |
| 186 pMap["device_os"].push("none"); | 188 pMap["device_os"].push("none"); |
| 187 pMap["device_type"].push("none"); | 189 pMap["device_type"].push("none"); |
| 188 pMap["user"].push("none"); | 190 pMap["user"].push("none"); |
| 189 | 191 |
| 190 // Custom filter options | 192 // Custom filter options |
| 191 pMap["name"] = []; | 193 pMap["name"] = []; |
| 192 pMap["state"] = ["PENDING", "RUNNING", "PENDING_RUNNING", "COMPLETED", | 194 // Some of these are hard coded because the server expects something |
| 193 "COMPLETED_SUCCESS","COMPLETED_FAILURE", "EXPIRED", "TIMED_OUT", | 195 // like "DEDUPED" instead of the more human friendly |
| 194 "BOT_DIED", "CANCELED", "ALL", "DEDUPED"]; | 196 // "COMPLETED (DEDUPED)" |
| 197 pMap["state"] = [this.PENDING, this.RUNNING, "PENDING_RUNNING", this.COM
PLETED, |
| 198 "COMPLETED_SUCCESS", "COMPLETED_FAILURE", this.EXPIRED, this.TIMED_O
UT, |
| 199 this.BOT_DIED, this.CANCELED, "DEDUPED", "ALL"]; |
| 195 pMap["costs_usd"] = []; | 200 pMap["costs_usd"] = []; |
| 196 pMap["deduped_from"] = []; | 201 pMap["deduped_from"] = []; |
| 197 pMap["duration"] = []; | 202 pMap["duration"] = []; |
| 198 pMap["server_versions"] = []; | 203 pMap["server_versions"] = []; |
| 199 TIMES.forEach(function(t) { | 204 TIMES.forEach(function(t) { |
| 200 pMap[t] = []; | 205 pMap[t] = []; |
| 201 }); | 206 }); |
| 202 | 207 |
| 203 return pMap; | 208 return pMap; |
| 204 }, | 209 }, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 230 }); | 235 }); |
| 231 t.tagMap = tagMap; | 236 t.tagMap = tagMap; |
| 232 | 237 |
| 233 TIMES.forEach(function(time) { | 238 TIMES.forEach(function(time) { |
| 234 if (t[time]) { | 239 if (t[time]) { |
| 235 t[time] = new Date(t[time]); | 240 t[time] = new Date(t[time]); |
| 236 t["human_"+time] = sk.human.localeTime(t[time]); | 241 t["human_"+time] = sk.human.localeTime(t[time]); |
| 237 } | 242 } |
| 238 }); | 243 }); |
| 239 // Running tasks have no duration set, so we can figure it out. | 244 // Running tasks have no duration set, so we can figure it out. |
| 240 if (!t.duration && t.state === "RUNNING" && t.started_ts){ | 245 if (!t.duration && t.state === this.RUNNING && t.started_ts){ |
| 241 t.duration = (now - t.started_ts) / 1000; | 246 t.duration = (now - t.started_ts) / 1000; |
| 242 } | 247 } |
| 243 // Make the duration human readable | 248 // Make the duration human readable |
| 244 if (t.duration){ | 249 if (t.duration){ |
| 245 t.human_duration = this._humanDuration(t.duration); | 250 t.human_duration = this._humanDuration(t.duration); |
| 246 } | 251 } |
| 247 }.bind(this)); | 252 }.bind(this)); |
| 248 return this._list.items; | 253 return this._list.items; |
| 249 } | 254 } |
| 250 }); | 255 }); |
| 251 })(); | 256 })(); |
| 252 </script> | 257 </script> |
| 253 </dom-module> | 258 </dom-module> |
| OLD | NEW |