| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 <link rel="import" href="bot-list-shared-behavior.html"> | 54 <link rel="import" href="bot-list-shared-behavior.html"> |
| 55 | 55 |
| 56 <dom-module id="bot-list-data"> | 56 <dom-module id="bot-list-data"> |
| 57 | 57 |
| 58 <script> | 58 <script> |
| 59 (function(){ | 59 (function(){ |
| 60 var AVAILABLE = "available"; | 60 var AVAILABLE = "available"; |
| 61 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; | 61 var BLACKLIST_DIMENSIONS = ["quarantined", "error"]; |
| 62 | 62 |
| 63 var BOT_TIMES = ["first_seen_ts", "last_seen_ts", "lease_expiration_ts"]; |
| 64 |
| 63 function aggregateTemps(temps) { | 65 function aggregateTemps(temps) { |
| 64 if (!temps) { | 66 if (!temps) { |
| 65 return {}; | 67 return {}; |
| 66 } | 68 } |
| 67 var zones = []; | 69 var zones = []; |
| 68 var avg = 0; | 70 var avg = 0; |
| 69 for (k in temps) { | 71 for (k in temps) { |
| 70 zones.push(k +": "+temps[k]); | 72 zones.push(k +": "+temps[k]); |
| 71 avg += temps[k]; | 73 avg += temps[k]; |
| 72 } | 74 } |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 // still have devices in their state (the last known device attached
) | 201 // still have devices in their state (the last known device attached
) |
| 200 // but don't have the device_type dimension. In that case, we punt | 202 // but don't have the device_type dimension. In that case, we punt |
| 201 // on device type. | 203 // on device type. |
| 202 var types = this._dimension(bot, "device_type") || ["unknown"]; | 204 var types = this._dimension(bot, "device_type") || ["unknown"]; |
| 203 o.device_type = types[0]; | 205 o.device_type = types[0]; |
| 204 o.temp = aggregateTemps(o.temp); | 206 o.temp = aggregateTemps(o.temp); |
| 205 devices.push(o); | 207 devices.push(o); |
| 206 } | 208 } |
| 207 bot.state.devices = devices; | 209 bot.state.devices = devices; |
| 208 | 210 |
| 209 if (bot.last_seen_ts) { | 211 BOT_TIMES.forEach(function(time) { |
| 210 bot.last_seen_ts = new Date(bot.last_seen_ts); | 212 swarming.sanitizeAndHumanizeTime(bot, time); |
| 211 } | 213 }); |
| 212 if (bot.first_seen_ts) { | |
| 213 bot.first_seen_ts = new Date(bot.first_seen_ts); | |
| 214 } | |
| 215 if (bot.lease_expiration_ts) { | |
| 216 bot.lease_expiration_ts = new Date(bot.lease_expiration_ts); | |
| 217 } | |
| 218 | 214 |
| 219 }.bind(this)); | 215 }.bind(this)); |
| 220 return json.items; | 216 return json.items; |
| 221 }, | 217 }, |
| 222 | 218 |
| 223 _fleet: function() { | 219 _fleet: function() { |
| 224 if (!this._count) { | 220 if (!this._count) { |
| 225 return {}; | 221 return {}; |
| 226 } | 222 } |
| 227 return { | 223 return { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 283 |
| 288 // No need to sort any of this, bot-filters sorts secondary items | 284 // No need to sort any of this, bot-filters sorts secondary items |
| 289 // automatically, especially when the user types a query. | 285 // automatically, especially when the user types a query. |
| 290 return pMap; | 286 return pMap; |
| 291 }, | 287 }, |
| 292 | 288 |
| 293 }); | 289 }); |
| 294 })(); | 290 })(); |
| 295 </script> | 291 </script> |
| 296 </dom-module> | 292 </dom-module> |
| OLD | NEW |