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

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

Issue 2375993002: Add bot uptime and swarming uptime (Closed) Base URL: git@github.com:luci/luci-py@limit-tasks
Patch Set: rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 "device": "Non-android Device", 242 "device": "Non-android Device",
243 "device_os": "Device OS", 243 "device_os": "Device OS",
244 "device_temperature": "Device Temp (°C)", 244 "device_temperature": "Device Temp (°C)",
245 "device_type": "Device Type", 245 "device_type": "Device Type",
246 "disk_space": "Free Space (MB)", 246 "disk_space": "Free Space (MB)",
247 "first_seen": "First Seen", 247 "first_seen": "First Seen",
248 "gpu": "GPU", 248 "gpu": "GPU",
249 "last_seen": "Last Seen", 249 "last_seen": "Last Seen",
250 "os": "OS", 250 "os": "OS",
251 "pool": "Pool", 251 "pool": "Pool",
252 "running_time": "Swarming Uptime",
252 "status": "Status", 253 "status": "Status",
254 "uptime": "Bot Uptime",
253 "xcode_version": "XCode Version", 255 "xcode_version": "XCode Version",
254 }; 256 };
255 257
256 var columnMap = { 258 var columnMap = {
257 android_devices: function(bot) { 259 android_devices: function(bot) {
258 var devs = this._attribute(bot, "android_devices", "0"); 260 var devs = this._attribute(bot, "android_devices", "0");
259 if (this._verbose) { 261 if (this._verbose) {
260 return devs.join(" | ") + " devices available"; 262 return devs.join(" | ") + " devices available";
261 } 263 }
262 // max() works on strings as long as they can be coerced to Number. 264 // max() works on strings as long as they can be coerced to Number.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 }, 308 },
307 id: function(bot) { 309 id: function(bot) {
308 return bot.bot_id; 310 return bot.bot_id;
309 }, 311 },
310 last_seen: function(bot) { 312 last_seen: function(bot) {
311 if (this._verbose) { 313 if (this._verbose) {
312 return sk.human.localeTime(bot.last_seen_ts); 314 return sk.human.localeTime(bot.last_seen_ts);
313 } 315 }
314 return this._timeDiffApprox(bot.last_seen_ts) + " ago"; 316 return this._timeDiffApprox(bot.last_seen_ts) + " ago";
315 }, 317 },
318 running_time: function(bot) {
319 var u = this._state(bot, "running_time");
320 if (!u) {
321 return "unknown";
322 }
323 return sk.human.strDuration(u);
324 },
316 status: function(bot) { 325 status: function(bot) {
317 // If a bot is both dead and quarantined, show the deadness over the 326 // If a bot is both dead and quarantined, show the deadness over the
318 // quarentinedness. 327 // quarentinedness.
319 if (bot.is_dead) { 328 if (bot.is_dead) {
320 return "Dead. Last seen " + sk.human.diffDate(bot.last_seen_ts) + 329 return "Dead. Last seen " + sk.human.diffDate(bot.last_seen_ts) +
321 " ago"; 330 " ago";
322 } 331 }
323 if (bot.quarantined) { 332 if (bot.quarantined) {
324 var msg = this._state(bot, "quarantined")[0]; 333 var msg = this._state(bot, "quarantined")[0];
325 // Sometimes, the quarantined message is actually in "error". This 334 // Sometimes, the quarantined message is actually in "error". This
326 // happens when the bot code has thrown an exception. 335 // happens when the bot code has thrown an exception.
327 if (msg === UNKNOWN || msg === "true" || msg === true) { 336 if (msg === UNKNOWN || msg === "true" || msg === true) {
328 msg = this._attribute(bot, "error"); 337 msg = this._attribute(bot, "error");
329 } 338 }
330 return "Quarantined: " + msg; 339 return "Quarantined: " + msg;
331 } 340 }
332 return "Alive"; 341 return "Alive";
333 }, 342 },
334 task: function(bot) { 343 task: function(bot) {
335 return this._taskId(bot); 344 return this._taskId(bot);
336 }, 345 },
346 uptime: function(bot) {
347 var u = this._state(bot, "uptime");
348 if (!u) {
349 return "unknown";
350 }
351 return sk.human.strDuration(u);
352 },
337 version: function(bot) { 353 version: function(bot) {
338 var v = bot.version || UNKNOWN 354 var v = bot.version || UNKNOWN
339 return v.substring(0, 10); 355 return v.substring(0, 10);
340 } 356 }
341 }; 357 };
342 358
343 var deviceColumnMap = { 359 var deviceColumnMap = {
344 android_devices: function(device) { 360 android_devices: function(device) {
345 var str = this._androidAliasDevice(device); 361 var str = this._androidAliasDevice(device);
346 if (device.okay) { 362 if (device.okay) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 }, 455 },
440 first_seen: function(dir, botA, botB) { 456 first_seen: function(dir, botA, botB) {
441 var botACol = botA.first_seen_ts; 457 var botACol = botA.first_seen_ts;
442 var botBCol = botB.first_seen_ts; 458 var botBCol = botB.first_seen_ts;
443 return dir * swarming.naturalCompare(botACol, botBCol) 459 return dir * swarming.naturalCompare(botACol, botBCol)
444 }, 460 },
445 last_seen: function(dir, botA, botB) { 461 last_seen: function(dir, botA, botB) {
446 var botACol = botA.last_seen_ts; 462 var botACol = botA.last_seen_ts;
447 var botBCol = botB.last_seen_ts; 463 var botBCol = botB.last_seen_ts;
448 return dir * swarming.naturalCompare(botACol, botBCol) 464 return dir * swarming.naturalCompare(botACol, botBCol)
449 } 465 },
466 running_time: function(dir, botA, botB) {
467 var botACol = this._state(botA, "running_time") || 0;
468 var botBCol = this._state(botB, "running_time") || 0;
469 return dir * swarming.naturalCompare(botACol, botBCol)
470 },
471 uptime: function(dir, botA, botB) {
472 var botACol = this._state(botA, "uptime") || 0;
473 var botBCol = this._state(botB, "uptime") || 0;
474 return dir * swarming.naturalCompare(botACol, botBCol)
475 },
450 }; 476 };
451 477
452 Polymer({ 478 Polymer({
453 is: 'bot-list', 479 is: 'bot-list',
454 480
455 // The order behaviors are applied in matters - later ones overwrite 481 // The order behaviors are applied in matters - later ones overwrite
456 // attributes of earlier ones 482 // attributes of earlier ones
457 behaviors: [ 483 behaviors: [
458 SwarmingBehaviors.BotListBehavior, 484 SwarmingBehaviors.BotListBehavior,
459 SwarmingBehaviors.DynamicTableBehavior, 485 SwarmingBehaviors.DynamicTableBehavior,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return; 569 return;
544 } 570 }
545 var url = "/_ah/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this ._query_params); 571 var url = "/_ah/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this ._query_params);
546 this.$.page_bots.load(url,this._auth_headers); 572 this.$.page_bots.load(url,this._auth_headers);
547 } 573 }
548 574
549 }); 575 });
550 })(); 576 })();
551 </script> 577 </script>
552 </dom-module> 578 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698