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 window.SwarmingBehaviors.BotListBehavior contains any shared functions and | 6 window.SwarmingBehaviors.BotListBehavior contains any shared functions and |
7 constants used by the bot-list and its sub-elements. | 7 constants used by the bot-list and its sub-elements. |
8 | 8 |
9 To use it, include | 9 To use it, include |
10 behaviors: [SwarmingBehaviors.BotListBehavior] | 10 behaviors: [SwarmingBehaviors.BotListBehavior] |
11 in the creation of your Polymer element. | 11 in the creation of your Polymer element. |
12 --> | 12 --> |
13 <link rel="import" href="/res/imp/common/common-behavior.html"> | 13 <link rel="import" href="/res/imp/common/common-behavior.html"> |
14 <script> | 14 <script> |
15 (function(){ | 15 (function(){ |
16 var UNKNOWN = "unknown"; | 16 var UNKNOWN = "unknown"; |
17 | 17 |
18 // This behavior wraps up all the shared bot-list functionality by | 18 // This behavior wraps up all the shared bot-list functionality by |
19 // extending SwarmingBehaviors.CommonBehavior | 19 // extending SwarmingBehaviors.CommonBehavior |
20 SwarmingBehaviors.BotListBehavior = [SwarmingBehaviors.CommonBehavior, { | 20 SwarmingBehaviors.BotListBehavior = [SwarmingBehaviors.CommonBehavior, { |
21 | 21 |
22 properties: { | 22 properties: { |
23 BOT_PROPERTIES: { | 23 BOT_PROPERTIES: { |
24 type: Array, | 24 type: Array, |
25 value: function() { | 25 value: function() { |
26 // TODO(kjlubick): Add more of these things from state, as they | 26 // TODO(kjlubick): Add more of these things from state, as they |
27 // needed/useful/requested. | 27 // needed/useful/requested. |
28 return ["disk_space", "uptime", "running_time", "task", "status", "v
ersion", "external_ip", "internal_ip", "mp_lease_id", "mp_lease_expires", "last_
seen", "first_seen", "battery_level", "battery_voltage", "battery_temperature",
"battery_status", "battery_health", "bot_temperature", "device_temperature"]; | 28 return ["disk_space", "uptime", "running_time", "task", "status", "v
ersion", "external_ip", "internal_ip", "mp_lease_id", "mp_lease_expires", "last_
seen", "first_seen", "battery_level", "battery_voltage", "battery_temperature",
"battery_status", "battery_health", "bot_temperature", "device_temperature", "is
_mp_bot"]; |
29 } | 29 } |
30 }, | 30 }, |
31 }, | 31 }, |
32 | 32 |
33 // _attribute looks first in dimension and then in state for the | 33 // _attribute looks first in dimension and then in state for the |
34 // specified attribute. This will always return an array. If there is | 34 // specified attribute. This will always return an array. If there is |
35 // no matching attribute, ["unknown"] will be returned. | 35 // no matching attribute, ["unknown"] will be returned. |
36 _attribute: function(bot, attr, none) { | 36 _attribute: function(bot, attr, none) { |
37 none = none || UNKNOWN; | 37 none = none || UNKNOWN; |
38 return this._dimension(bot, attr) || this._state(bot, attr) || [none]; | 38 return this._dimension(bot, attr) || this._state(bot, attr) || [none]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 _taskId: function(bot) { | 78 _taskId: function(bot) { |
79 if (bot && bot.task_id) { | 79 if (bot && bot.task_id) { |
80 return bot.task_id; | 80 return bot.task_id; |
81 } | 81 } |
82 return "idle"; | 82 return "idle"; |
83 }, | 83 }, |
84 | 84 |
85 }]; | 85 }]; |
86 })() | 86 })() |
87 </script> | 87 </script> |
OLD | NEW |