| 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> | 9 <bot-list> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bot-filters, bot-list-summary { | 44 bot-filters, bot-list-summary { |
| 45 margin-bottom: 8px; | 45 margin-bottom: 8px; |
| 46 margin-right: 10px; | 46 margin-right: 10px; |
| 47 } | 47 } |
| 48 .quarantined, .bad-device { | 48 .quarantined, .bad-device { |
| 49 background-color: #ffdddd; | 49 background-color: #ffdddd; |
| 50 } | 50 } |
| 51 .dead { | 51 .dead { |
| 52 background-color: #cccccc; | 52 background-color: #cccccc; |
| 53 } | 53 } |
| 54 .alt { |
| 55 background-color: #f8f8f8; |
| 56 } |
| 54 .bot-list th > span { | 57 .bot-list th > span { |
| 55 /* Leave space for sort-toggle*/ | 58 /* Leave space for sort-toggle*/ |
| 56 padding-right: 30px; | 59 padding-right: 30px; |
| 57 } | 60 } |
| 58 </style> | 61 </style> |
| 59 | 62 |
| 60 <url-param name="s" | 63 <url-param name="s" |
| 61 value="{{_sortstr}}" | 64 value="{{_sortstr}}" |
| 62 default_value="id:asc"> | 65 default_value="id:asc"> |
| 63 </url-param> | 66 </url-param> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 74 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 77 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 75 | 78 |
| 76 <div hidden$="[[_not(_signed_in)]]"> | 79 <div hidden$="[[_not(_signed_in)]]"> |
| 77 | 80 |
| 78 <div class="horizontal layout"> | 81 <div class="horizontal layout"> |
| 79 | 82 |
| 80 <bot-filters | 83 <bot-filters |
| 81 dimensions="[[_dimensions]]" | 84 dimensions="[[_dimensions]]" |
| 82 primary_map="[[_primary_map]]" | 85 primary_map="[[_primary_map]]" |
| 83 primary_arr="[[_primary_arr]]" | 86 primary_arr="[[_primary_arr]]" |
| 87 special_columns="[[_specialColumns]]" |
| 84 | 88 |
| 85 columns="{{_columns}}" | 89 columns="{{_columns}}" |
| 86 query_params="{{_query_params}}" | 90 query_params="{{_query_params}}" |
| 87 filter="{{_filter}}" | 91 filter="{{_filter}}" |
| 88 verbose="{{_verbose}}"> | 92 verbose="{{_verbose}}"> |
| 89 </bot-filters> | 93 </bot-filters> |
| 90 | 94 |
| 91 <bot-list-summary | 95 <bot-list-summary |
| 92 auth_headers="[[_auth_headers]]" | 96 auth_headers="[[_auth_headers]]" |
| 93 busy="{{_busy3}}" | 97 busy="{{_busy3}}" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 </td> | 214 </td> |
| 211 </template> | 215 </template> |
| 212 | 216 |
| 213 </tr> | 217 </tr> |
| 214 <template | 218 <template |
| 215 is="dom-repeat" | 219 is="dom-repeat" |
| 216 items="[[_devices(bot)]]" | 220 items="[[_devices(bot)]]" |
| 217 as="device"> | 221 as="device"> |
| 218 <tr | 222 <tr |
| 219 hidden$="[[_hide('android_devices', _columns.*)]]" | 223 hidden$="[[_hide('android_devices', _columns.*)]]" |
| 220 class$="[[_deviceClass(device)]]"> | 224 class$="[[_deviceClass(device,index)]]"> |
| 221 <td></td> | 225 <td></td> |
| 226 <td hidden$="[[_hide('cloud_console_link', _columns.*)]]"></td
> |
| 227 <td hidden$="[[_hide('mp_lease_id', _columns.*)]]"></td> |
| 222 <td hidden$="[[_hide('task', _columns.*)]]"></td> | 228 <td hidden$="[[_hide('task', _columns.*)]]"></td> |
| 223 <template | 229 <template |
| 224 is="dom-repeat" | 230 is="dom-repeat" |
| 225 items="[[_plainColumns]]" | 231 items="[[_plainColumns]]" |
| 226 as="c"> | 232 as="c"> |
| 227 <td hidden$="[[_hide(c)]]"> | 233 <td hidden$="[[_hide(c)]]"> |
| 228 [[_deviceColumn(c, device, _verbose)]] | 234 [[_deviceColumn(c, device, _verbose)]] |
| 229 </td> | 235 </td> |
| 230 </template> | 236 </template> |
| 231 </tr> | 237 </tr> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 243 </div> | 249 </div> |
| 244 | 250 |
| 245 </swarming-app> | 251 </swarming-app> |
| 246 | 252 |
| 247 </template> | 253 </template> |
| 248 <script> | 254 <script> |
| 249 (function(){ | 255 (function(){ |
| 250 var UNKNOWN = "unknown"; | 256 var UNKNOWN = "unknown"; |
| 251 // see dynamic-table for more information on specialColumns, headerMap, | 257 // see dynamic-table for more information on specialColumns, headerMap, |
| 252 // columnMap, and specialSort | 258 // columnMap, and specialSort |
| 253 var specialColumns = ["id", "task", "cloud_console_link", "mp_lease_id"]; | 259 var specialColumns = ["id", "cloud_console_link", "mp_lease_id", "task"]; |
| 254 | 260 |
| 255 var deviceColumns = ["battery_health", "battery_level", "battery_status", "b
attery_temperature", "battery_voltage", "device_temperature"]; | 261 var deviceColumns = ["battery_health", "battery_level", "battery_status", "b
attery_temperature", "battery_voltage", "device_temperature"]; |
| 256 | 262 |
| 257 var headerMap = { | 263 var headerMap = { |
| 258 // "id" and "task" are special, so they don't go here. They have their | 264 // "id", "task" and other special columns don't go here. They have their |
| 259 // headers hard-coded above. | 265 // headers hard-coded above. |
| 260 "android_devices": "Android Devices", | 266 "android_devices": "Android Devices", |
| 261 "battery_health": "Battery Health", | 267 "battery_health": "Battery Health", |
| 262 "battery_level": "Battery Level (%)", | 268 "battery_level": "Battery Level (%)", |
| 263 "battery_status": "Battery Status", | 269 "battery_status": "Battery Status", |
| 264 "battery_temperature": "Battery Temp (°C)", | 270 "battery_temperature": "Battery Temp (°C)", |
| 265 "battery_voltage": "Battery Voltage (mV)", | 271 "battery_voltage": "Battery Voltage (mV)", |
| 266 "bot_temperature": "Bot Temp (°C)", | 272 "bot_temperature": "Bot Temp (°C)", |
| 267 "cores": "Cores", | 273 "cores": "Cores", |
| 268 "cpu": "CPU", | 274 "cpu": "CPU", |
| 269 "device": "Non-android Device", | 275 "device": "Non-android Device", |
| 270 "device_os": "Device OS", | 276 "device_os": "Device OS", |
| 271 "device_temperature": "Device Temp (°C)", | 277 "device_temperature": "Device Temp (°C)", |
| 272 "device_type": "Device Type", | 278 "device_type": "Device Type", |
| 273 "disk_space": "Free Space (MB)", | 279 "disk_space": "Free Space (MB)", |
| 280 "external_ip": "External IP", |
| 274 "first_seen": "First Seen", | 281 "first_seen": "First Seen", |
| 275 "gpu": "GPU", | 282 "gpu": "GPU", |
| 283 "internal_ip": "Internal or Local IP", |
| 276 "last_seen": "Last Seen", | 284 "last_seen": "Last Seen", |
| 277 "mp_lease_expires": "Machine Provider Lease Expires", | 285 "mp_lease_expires": "Machine Provider Lease Expires", |
| 278 "os": "OS", | 286 "os": "OS", |
| 279 "pool": "Pool", | 287 "pool": "Pool", |
| 280 "running_time": "Swarming Uptime", | 288 "running_time": "Swarming Uptime", |
| 281 "status": "Status", | 289 "status": "Status", |
| 282 "uptime": "Bot Uptime", | 290 "uptime": "Bot Uptime", |
| 283 "xcode_version": "XCode Version", | 291 "xcode_version": "XCode Version", |
| 284 }; | 292 }; |
| 285 | 293 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 }, | 340 }, |
| 333 external_ip: function(bot) { | 341 external_ip: function(bot) { |
| 334 return bot.external_ip || "none"; | 342 return bot.external_ip || "none"; |
| 335 }, | 343 }, |
| 336 first_seen: function(bot) { | 344 first_seen: function(bot) { |
| 337 return sk.human.localeTime(bot.first_seen_ts) | 345 return sk.human.localeTime(bot.first_seen_ts) |
| 338 }, | 346 }, |
| 339 id: function(bot) { | 347 id: function(bot) { |
| 340 return bot.bot_id; | 348 return bot.bot_id; |
| 341 }, | 349 }, |
| 350 internal_ip: function(bot) { |
| 351 return this._attribute(bot, "ip", "none")[0]; |
| 352 }, |
| 342 last_seen: function(bot) { | 353 last_seen: function(bot) { |
| 343 if (this._verbose) { | 354 if (this._verbose) { |
| 344 return sk.human.localeTime(bot.last_seen_ts); | 355 return sk.human.localeTime(bot.last_seen_ts); |
| 345 } | 356 } |
| 346 return this._timeDiffApprox(bot.last_seen_ts) + " ago"; | 357 return this._timeDiffApprox(bot.last_seen_ts) + " ago"; |
| 347 }, | 358 }, |
| 348 mp_lease_id: function(bot) { | 359 mp_lease_id: function(bot) { |
| 349 var id = bot.lease_id || "none"; | 360 var id = bot.lease_id || "none"; |
| 350 if (this._verbose) { | 361 if (this._verbose) { |
| 351 return id; | 362 return id; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 // We sort based on the raw number of MB of the first disk. | 511 // We sort based on the raw number of MB of the first disk. |
| 501 var botACol = botA.disks[0].mb; | 512 var botACol = botA.disks[0].mb; |
| 502 var botBCol = botB.disks[0].mb; | 513 var botBCol = botB.disks[0].mb; |
| 503 return dir * swarming.naturalCompare(botACol, botBCol); | 514 return dir * swarming.naturalCompare(botACol, botBCol); |
| 504 }, | 515 }, |
| 505 first_seen: function(dir, botA, botB) { | 516 first_seen: function(dir, botA, botB) { |
| 506 var botACol = botA.first_seen_ts; | 517 var botACol = botA.first_seen_ts; |
| 507 var botBCol = botB.first_seen_ts; | 518 var botBCol = botB.first_seen_ts; |
| 508 return dir * swarming.naturalCompare(botACol, botBCol); | 519 return dir * swarming.naturalCompare(botACol, botBCol); |
| 509 }, | 520 }, |
| 510 gpu: function(dir, botA, botB) { | |
| 511 // We want all the "none" GPU bots to come last in the list. | |
| 512 var botACol = this._column("gpu", botA); | |
| 513 if (botACol === "none") { | |
| 514 botACol = "ZZZ"; | |
| 515 } | |
| 516 var botBCol = this._column("gpu", botB); | |
| 517 if (botBCol === "none") { | |
| 518 botBCol = "ZZZ"; | |
| 519 } | |
| 520 return dir * swarming.naturalCompare(botACol, botBCol); | |
| 521 }, | |
| 522 last_seen: function(dir, botA, botB) { | 521 last_seen: function(dir, botA, botB) { |
| 523 var botACol = botA.last_seen_ts; | 522 var botACol = botA.last_seen_ts; |
| 524 var botBCol = botB.last_seen_ts; | 523 var botBCol = botB.last_seen_ts; |
| 525 return dir * swarming.naturalCompare(botACol, botBCol) | 524 return dir * swarming.naturalCompare(botACol, botBCol) |
| 526 }, | 525 }, |
| 527 running_time: function(dir, botA, botB) { | 526 running_time: function(dir, botA, botB) { |
| 528 var botACol = this._state(botA, "running_time") || 0; | 527 var botACol = this._state(botA, "running_time") || 0; |
| 529 var botBCol = this._state(botB, "running_time") || 0; | 528 var botBCol = this._state(botB, "running_time") || 0; |
| 530 return dir * swarming.naturalCompare(botACol, botBCol) | 529 return dir * swarming.naturalCompare(botACol, botBCol) |
| 531 }, | 530 }, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 }, | 646 }, |
| 648 | 647 |
| 649 _deviceColumn: function(col, device) { | 648 _deviceColumn: function(col, device) { |
| 650 var f = deviceColumnMap[col]; | 649 var f = deviceColumnMap[col]; |
| 651 if (!f || !device) { | 650 if (!f || !device) { |
| 652 return ""; | 651 return ""; |
| 653 } | 652 } |
| 654 return f.bind(this)(device); | 653 return f.bind(this)(device); |
| 655 }, | 654 }, |
| 656 | 655 |
| 657 _deviceClass: function(device) { | 656 _deviceClass: function(device, idx) { |
| 658 if (!device.okay) { | 657 if (!device.okay) { |
| 659 return "bad-device"; | 658 return "bad-device"; |
| 660 } | 659 } |
| 660 if (idx % 2 === 0){ |
| 661 return "alt"; |
| 662 } |
| 661 return ""; | 663 return ""; |
| 662 }, | 664 }, |
| 663 | 665 |
| 664 _mpLink: function(bot, template) { | 666 _mpLink: function(bot, template) { |
| 665 if (!bot || !bot.lease_id || !template) { | 667 if (!bot || !bot.lease_id || !template) { |
| 666 return false; | 668 return false; |
| 667 } | 669 } |
| 668 return template.replace("%s", bot.lease_id); | 670 return template.replace("%s", bot.lease_id); |
| 669 }, | 671 }, |
| 670 | 672 |
| 671 _reload: function() { | 673 _reload: function() { |
| 672 if (!this._auth_headers || !this._query_params) { | 674 if (!this._auth_headers || !this._query_params) { |
| 673 return; | 675 return; |
| 674 } | 676 } |
| 675 var url = "/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this._qu
ery_params); | 677 var url = "/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this._qu
ery_params); |
| 676 this.$.page_bots.load(url,this._auth_headers); | 678 this.$.page_bots.load(url,this._auth_headers); |
| 677 } | 679 } |
| 678 | 680 |
| 679 }); | 681 }); |
| 680 })(); | 682 })(); |
| 681 </script> | 683 </script> |
| 682 </dom-module> | 684 </dom-module> |
| OLD | NEW |