Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: appengine/swarming/elements/res/imp/botlist/bot-list.html

Issue 2269643002: Extract shared filters and aliasing code (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Documentation Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/elements/res/imp/botlist/bot-list.html
diff --git a/appengine/swarming/elements/res/imp/botlist/bot-list.html b/appengine/swarming/elements/res/imp/botlist/bot-list.html
index 14ae82a352c9366aa465d674c8ab5272fbcc2a88..75b73afa302ded5d361b49fd42eedd382349cd15 100644
--- a/appengine/swarming/elements/res/imp/botlist/bot-list.html
+++ b/appengine/swarming/elements/res/imp/botlist/bot-list.html
@@ -234,23 +234,6 @@
};
var columnMap = {
- android_devices: function(bot) {
- var devs = this._attribute(bot, "android_devices", "0");
- if (this._verbose) {
- return devs.join(" | ") + " devices available";
- }
- // max() works on strings as long as they can be coerced to Number.
- return Math.max(...devs) + " devices available";
- },
- device_type: function(bot) {
- var dt = this._attribute(bot, "device_type", "none");
- dt = dt[0];
- var alias = this._androidAlias(dt);
- if (alias === "unknown") {
- return dt;
- }
- return this._applyAlias(dt, alias);
- },
disk_space: function(bot) {
var aliased = [];
bot.disks.forEach(function(disk){
@@ -262,38 +245,9 @@
}
return aliased[0];
},
- gpu: function(bot){
- var gpus = this._attribute(bot, "gpu", "none")
- var verbose = []
- var named = [];
- // non-verbose mode has only the top level GPU info "e.g. NVidia"
- // which is found by looking for gpu ids w/o a colon.
- gpus.forEach(function(g){
- var alias = this._gpuAlias(g);
- if (alias === "unknown") {
- verbose.push(g);
- if (g.indexOf(":") === -1) {
- named.push(g);
- }
- return;
- }
- verbose.push(this._applyAlias(g, alias));
- if (g.indexOf(":") === -1) {
- named.push(this._applyAlias(g, alias));
- }
- }.bind(this))
- if (this._verbose) {
- return verbose.join(" | ");
- }
- return named.join(" | ");
- },
id: function(bot) {
return bot.bot_id;
},
- pool: function(bot) {
- var pool = this._attribute(bot, "pool");
- return pool.join(" | ");
- },
status: function(bot) {
// If a bot is both dead and quarantined, show the deadness over the
// quarentinedness.
@@ -302,7 +256,13 @@
" ago";
}
if (bot.quarantined) {
- return "Quarantined: " + this._attribute(bot, "quarantined");
+ var msg = this._state(bot, "quarantined")[0];
+ // Sometimes, the quarantined message is actually in "error". This
+ // happens when the bot code has thrown an exception.
+ if (msg === "unknown" || msg === "true" || msg === true) {
+ msg = this._attribute(bot, "error");
+ }
+ return "Quarantined: " + msg;
}
return "Alive";
},
@@ -352,8 +312,13 @@
Polymer({
is: 'bot-list',
- behaviors: [SwarmingBehaviors.BotListBehavior,
- SwarmingBehaviors.DynamicTableBehavior],
+
+ // The order behaviors are applied in matters - later ones overwrite
+ // attributes of earlier ones
+ behaviors: [
+ SwarmingBehaviors.BotListBehavior,
+ SwarmingBehaviors.DynamicTableBehavior,
jcgregorio 2016/08/23 13:07:44 So we have SwarmingBehaviors.BotListBehavior which
kjlubick 2016/08/23 17:43:19 Done.
+ ],
properties: {
client_id: {
@@ -363,7 +328,13 @@
// For dynamic table.
_columnMap: {
type: Object,
- value: columnMap,
+ value: function() {
+ var base = this._commonColumns();
+ for (var attr in columnMap) {
+ base[attr] = columnMap[attr];
+ }
+ return base;
+ },
},
_headerMap: {
type: Object,

Powered by Google App Engine
This is Rietveld 408576698