| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 </swarming-app> | 247 </swarming-app> |
| 248 | 248 |
| 249 </template> | 249 </template> |
| 250 <script> | 250 <script> |
| 251 (function(){ | 251 (function(){ |
| 252 var UNKNOWN = "unknown"; | 252 var UNKNOWN = "unknown"; |
| 253 // see dynamic-table for more information on specialColumns, headerMap, | 253 // see dynamic-table for more information on specialColumns, headerMap, |
| 254 // columnMap, and specialSort | 254 // columnMap, and specialSort |
| 255 var specialColumns = ["id", "task", "cloud_console_link", "mp_lease_id"]; | 255 var specialColumns = ["id", "task", "cloud_console_link", "mp_lease_id"]; |
| 256 | 256 |
| 257 var deviceColumns = ["battery_health", "battery_level", "battery_status", "b
attery_temperature", "battery_voltage", "device_temperature"]; |
| 258 |
| 257 var headerMap = { | 259 var headerMap = { |
| 258 // "id" and "task" are special, so they don't go here. They have their | 260 // "id" and "task" are special, so they don't go here. They have their |
| 259 // headers hard-coded above. | 261 // headers hard-coded above. |
| 260 "android_devices": "Android Devices", | 262 "android_devices": "Android Devices", |
| 261 "battery_health": "Battery Health", | 263 "battery_health": "Battery Health", |
| 262 "battery_level": "Battery Level (%)", | 264 "battery_level": "Battery Level (%)", |
| 263 "battery_status": "Battery Status", | 265 "battery_status": "Battery Status", |
| 264 "battery_temperature": "Battery Temp (°C)", | 266 "battery_temperature": "Battery Temp (°C)", |
| 265 "battery_voltage": "Battery Voltage (mV)", | 267 "battery_voltage": "Battery Voltage (mV)", |
| 266 "bot_temperature": "Bot Temp (°C)", | 268 "bot_temperature": "Bot Temp (°C)", |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 }, | 311 }, |
| 310 bot_temperature: function(bot){ | 312 bot_temperature: function(bot){ |
| 311 if (this._verbose) { | 313 if (this._verbose) { |
| 312 return bot.state.temp.zones || UNKNOWN; | 314 return bot.state.temp.zones || UNKNOWN; |
| 313 } | 315 } |
| 314 return bot.state.temp.average || UNKNOWN; | 316 return bot.state.temp.average || UNKNOWN; |
| 315 }, | 317 }, |
| 316 device_temperature: function(){ | 318 device_temperature: function(){ |
| 317 return ""; | 319 return ""; |
| 318 }, | 320 }, |
| 321 device_os: function(bot) { |
| 322 return this._attribute(bot, "device_os", "none").join(" | "); |
| 323 }, |
| 319 disk_space: function(bot) { | 324 disk_space: function(bot) { |
| 320 var aliased = []; | 325 var aliased = []; |
| 321 bot.disks.forEach(function(disk){ | 326 bot.disks.forEach(function(disk){ |
| 322 var alias = sk.human.bytes(disk.mb, sk.MB); | 327 var alias = sk.human.bytes(disk.mb, sk.MB); |
| 323 aliased.push(swarming.alias.apply(disk.mb, disk.id + " "+ alias)); | 328 aliased.push(swarming.alias.apply(disk.mb, disk.id + " "+ alias)); |
| 324 }.bind(this)); | 329 }.bind(this)); |
| 325 if (this._verbose) { | 330 if (this._verbose) { |
| 326 return aliased.join(" | "); | 331 return aliased.join(" | "); |
| 327 } | 332 } |
| 328 return aliased[0]; | 333 return aliased[0]; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 _specialColumns: { | 586 _specialColumns: { |
| 582 type: Array, | 587 type: Array, |
| 583 value: specialColumns, | 588 value: specialColumns, |
| 584 }, | 589 }, |
| 585 _specialSort: { | 590 _specialSort: { |
| 586 type: Object, | 591 type: Object, |
| 587 value: specialSort, | 592 value: specialSort, |
| 588 }, | 593 }, |
| 589 }, | 594 }, |
| 590 | 595 |
| 591 observers:["_reload(_query_params,_auth_headers)"], | 596 observers:[ |
| 597 "_reload(_query_params,_auth_headers)", |
| 598 "_checkDeviceColumns(_columns.*)" |
| 599 ], |
| 592 | 600 |
| 593 _androidAliasDevice: function(device) { | 601 _androidAliasDevice: function(device) { |
| 594 if (device.notReady) { | 602 if (device.notReady) { |
| 595 return UNAUTHENTICATED.toUpperCase(); | 603 return UNAUTHENTICATED.toUpperCase(); |
| 596 } | 604 } |
| 597 return swarming.alias.android(this._deviceType(device)); | 605 return swarming.alias.android(this._deviceType(device)); |
| 598 }, | 606 }, |
| 599 | 607 |
| 600 _botClass: function(bot) { | 608 _botClass: function(bot) { |
| 601 if (bot.is_dead) { | 609 if (bot.is_dead) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 616 }, | 624 }, |
| 617 | 625 |
| 618 _ccText: function(bot){ | 626 _ccText: function(bot){ |
| 619 var z = this._attribute(bot, "zone")[0]; | 627 var z = this._attribute(bot, "zone")[0]; |
| 620 if (z === "unknown") { | 628 if (z === "unknown") { |
| 621 return "Not on GCE"; | 629 return "Not on GCE"; |
| 622 } | 630 } |
| 623 return "View Bot"; | 631 return "View Bot"; |
| 624 }, | 632 }, |
| 625 | 633 |
| 634 _checkDeviceColumns: function() { |
| 635 var shouldAdd = false; |
| 636 for (var i = 0; i< this._columns.length; i++) { |
| 637 var col = this._columns[i]; |
| 638 if (col === "android_devices") { |
| 639 return; |
| 640 } |
| 641 if (deviceColumns.indexOf(col) !== -1) { |
| 642 shouldAdd = true; |
| 643 } |
| 644 } |
| 645 if (shouldAdd) { |
| 646 this.push("_columns", "android_devices"); |
| 647 sk.errorMessage("Some of the columns selected require 'android_devices
' to be displayed. It has been automatically added.", 4000); |
| 648 } |
| 649 }, |
| 650 |
| 626 _deviceColumn: function(col, device) { | 651 _deviceColumn: function(col, device) { |
| 627 var f = deviceColumnMap[col]; | 652 var f = deviceColumnMap[col]; |
| 628 if (!f || !device) { | 653 if (!f || !device) { |
| 629 return ""; | 654 return ""; |
| 630 } | 655 } |
| 631 return f.bind(this)(device); | 656 return f.bind(this)(device); |
| 632 }, | 657 }, |
| 633 | 658 |
| 634 _deviceClass: function(device) { | 659 _deviceClass: function(device) { |
| 635 if (!device.okay) { | 660 if (!device.okay) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 650 return; | 675 return; |
| 651 } | 676 } |
| 652 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); |
| 653 this.$.page_bots.load(url,this._auth_headers); | 678 this.$.page_bots.load(url,this._auth_headers); |
| 654 } | 679 } |
| 655 | 680 |
| 656 }); | 681 }); |
| 657 })(); | 682 })(); |
| 658 </script> | 683 </script> |
| 659 </dom-module> | 684 </dom-module> |
| OLD | NEW |