| 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 file contains most of the logic needed to create a dynamic table. It is b
roken up into two | 6 This file contains most of the logic needed to create a dynamic table. It is b
roken up into two |
| 7 parts, a style dom-module called "dynamic-table-style" and a behavior called | 7 parts, a style dom-module called "dynamic-table-style" and a behavior called |
| 8 SwarmingBehaviors.DynamicTableBehavior. This behavior ties together filtering,
sorting and column | 8 SwarmingBehaviors.DynamicTableBehavior. This behavior ties together filtering,
sorting and column |
| 9 content. It also offers a few utilities to make creating the table easier. A c
lient of these two | 9 content. It also offers a few utilities to make creating the table easier. A c
lient of these two |
| 10 parts needs to create the templates to actually draw the <table>,<tr> and so o
n. See | 10 parts needs to create the templates to actually draw the <table>,<tr> and so o
n. See |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 _stripSpecial: function(){ | 210 _stripSpecial: function(){ |
| 211 return this._columns.filter(function(c) { | 211 return this._columns.filter(function(c) { |
| 212 return this._specialColumns.indexOf(c) === -1; | 212 return this._specialColumns.indexOf(c) === -1; |
| 213 }.bind(this)).sort(); | 213 }.bind(this)).sort(); |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 // Common columns shared between tasklist and botlist | 216 // Common columns shared between tasklist and botlist |
| 217 _commonColumns: function() { | 217 _commonColumns: function() { |
| 218 // return a fresh object so all elements have their own copy | 218 // return a fresh object so all elements have their own copy |
| 219 return { | 219 return { |
| 220 android_devices: function(bot) { | |
| 221 var devs = this._attribute(bot, "android_devices", "0"); | |
| 222 if (this._verbose) { | |
| 223 return devs.join(" | ") + " devices available"; | |
| 224 } | |
| 225 // max() works on strings as long as they can be coerced to Number. | |
| 226 return Math.max(...devs) + " devices available"; | |
| 227 }, | |
| 228 device_type: function(bot) { | 220 device_type: function(bot) { |
| 229 var dt = this._attribute(bot, "device_type", "none"); | 221 var dt = this._attribute(bot, "device_type", "none"); |
| 230 dt = dt[0]; | 222 dt = dt[0]; |
| 231 var alias = swarming.alias.android(dt); | 223 var alias = swarming.alias.android(dt); |
| 232 if (alias === "unknown") { | 224 if (alias === "unknown") { |
| 233 return dt; | 225 return dt; |
| 234 } | 226 } |
| 235 return swarming.alias.apply(dt, alias); | 227 return swarming.alias.apply(dt, alias); |
| 236 }, | 228 }, |
| 237 gpu: function(bot){ | 229 gpu: function(bot){ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 263 var pool = this._attribute(bot, "pool"); | 255 var pool = this._attribute(bot, "pool"); |
| 264 return pool.join(" | "); | 256 return pool.join(" | "); |
| 265 }, | 257 }, |
| 266 }; | 258 }; |
| 267 }, | 259 }, |
| 268 | 260 |
| 269 | 261 |
| 270 }]; | 262 }]; |
| 271 })(); | 263 })(); |
| 272 </script> | 264 </script> |
| OLD | NEW |