| 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] |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 _gpuAlias: function(gpu) { | 126 _gpuAlias: function(gpu) { |
| 127 var a = GPU_ALIASES[gpu]; | 127 var a = GPU_ALIASES[gpu]; |
| 128 if (!a) { | 128 if (!a) { |
| 129 return "UNKNOWN"; | 129 return "UNKNOWN"; |
| 130 } | 130 } |
| 131 return a; | 131 return a; |
| 132 }, | 132 }, |
| 133 | 133 |
| 134 _not: function(a) { | 134 _not: function(a) { |
| 135 return a; | 135 return !a; |
| 136 }, |
| 137 |
| 138 _or: function() { |
| 139 var result = false; |
| 140 // can't use .foreach, as arguments isn't really a function. |
| 141 for (var i = 0; i < arguments.length; i++) { |
| 142 result = result || arguments[i]; |
| 143 } |
| 144 return result; |
| 136 }, | 145 }, |
| 137 | 146 |
| 138 _taskId: function(bot) { | 147 _taskId: function(bot) { |
| 139 if (bot && bot.task_id) { | 148 if (bot && bot.task_id) { |
| 140 return bot.task_id; | 149 return bot.task_id; |
| 141 } | 150 } |
| 142 return "idle"; | 151 return "idle"; |
| 143 }, | 152 }, |
| 144 | 153 |
| 145 // _unalias will return the base dimension/state with its alias removed | 154 // _unalias will return the base dimension/state with its alias removed |
| 146 // if it had one. This is handy for sorting and filtering. | 155 // if it had one. This is handy for sorting and filtering. |
| 147 _unalias: function(str) { | 156 _unalias: function(str) { |
| 148 var match = ALIAS_REGEXP.exec(str); | 157 var match = ALIAS_REGEXP.exec(str); |
| 149 if (match) { | 158 if (match) { |
| 150 return match[1]; | 159 return match[1]; |
| 151 } | 160 } |
| 152 return str; | 161 return str; |
| 153 }, | 162 }, |
| 154 } | 163 } |
| 155 })() | 164 })() |
| 156 </script> | 165 </script> |
| OLD | NEW |