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

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

Issue 2404883002: Add links to MP and resolve minor fixes (Closed)
Patch Set: Address Polymer comments 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 <url-param name="s" 61 <url-param name="s"
62 value="{{_sortstr}}" 62 value="{{_sortstr}}"
63 default_value="id:asc"> 63 default_value="id:asc">
64 </url-param> 64 </url-param>
65 65
66 <swarming-app 66 <swarming-app
67 client_id="[[client_id]]" 67 client_id="[[client_id]]"
68 auth_headers="{{_auth_headers}}" 68 auth_headers="{{_auth_headers}}"
69 signed_in="{{_signed_in}}" 69 signed_in="{{_signed_in}}"
70 server_details="{{_server_details}}"
70 71
71 busy="[[_or(_busy1,_busy2)]]" 72 busy="[[_or(_busy1,_busy2)]]"
72 name="Swarming Bot List"> 73 name="Swarming Bot List">
73 74
74 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> 75 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2>
75 76
76 <div hidden$="[[_not(_signed_in)]]"> 77 <div hidden$="[[_not(_signed_in)]]">
77 78
78 <div class="horizontal layout"> 79 <div class="horizontal layout">
79 80
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 array (we are listening to all subproperties). The element returne d is 133 array (we are listening to all subproperties). The element returne d is
133 not of much use, so we'll ignore it in _hide() and use this._colum ns. 134 not of much use, so we'll ignore it in _hide() and use this._colum ns.
134 --> 135 -->
135 <th hidden$="[[_hide('cloud_console_link', _columns.*)]]"> 136 <th hidden$="[[_hide('cloud_console_link', _columns.*)]]">
136 <span>Bot in Cloud Console</span> 137 <span>Bot in Cloud Console</span>
137 <sort-toggle 138 <sort-toggle
138 name="cloud_console_link" 139 name="cloud_console_link"
139 current="[[_sort]]"> 140 current="[[_sort]]">
140 </sort-toggle> 141 </sort-toggle>
141 </th> 142 </th>
143 <th hidden$="[[_hide('mp_lease_id', _columns.*)]]">
144 <span>Machine Provider Lease Id</span>
145 <sort-toggle
146 name="mp_lease_id"
147 current="[[_sort]]">
148 </sort-toggle>
149 </th>
142 <th hidden$="[[_hide('task', _columns.*)]]"> 150 <th hidden$="[[_hide('task', _columns.*)]]">
143 <span>Current Task</span> 151 <span>Current Task</span>
144 <sort-toggle 152 <sort-toggle
145 name="task" 153 name="task"
146 current="[[_sort]]"> 154 current="[[_sort]]">
147 </sort-toggle> 155 </sort-toggle>
148 </th> 156 </th>
149 157
150 <template 158 <template
151 is="dom-repeat" 159 is="dom-repeat"
(...skipping 23 matching lines...) Expand all
175 class="center" 183 class="center"
176 href$="[[_botLink(bot.bot_id)]]" 184 href$="[[_botLink(bot.bot_id)]]"
177 target="_blank" 185 target="_blank"
178 rel="noopener"> 186 rel="noopener">
179 [[bot.bot_id]] 187 [[bot.bot_id]]
180 </a> 188 </a>
181 </td> 189 </td>
182 <td hidden$="[[_hide('cloud_console_link', _columns.*)]]"> 190 <td hidden$="[[_hide('cloud_console_link', _columns.*)]]">
183 <a href$="[[_ccLink(bot)]]">[[_ccText(bot)]]</a> 191 <a href$="[[_ccLink(bot)]]">[[_ccText(bot)]]</a>
184 </td> 192 </td>
193 <td hidden$="[[_hide('mp_lease_id', _columns.*)]]">
194 <a href$="[[_mpLink(bot, _server_details.machine_provider_temp late)]]">
195 [[_column('mp_lease_id', bot,_verbose)]]
196 </a>
197 </td>
185 <td hidden$="[[_hide('task', _columns.*)]]"> 198 <td hidden$="[[_hide('task', _columns.*)]]">
186 <a href$="[[_taskLink(bot.task_id)]]">[[_taskId(bot)]]</a> 199 <a href$="[[_taskLink(bot.task_id)]]">[[_taskId(bot)]]</a>
187 </td> 200 </td>
188 201
189 <template 202 <template
190 is="dom-repeat" 203 is="dom-repeat"
191 items="[[_plainColumns]]" 204 items="[[_plainColumns]]"
192 as="c"> 205 as="c">
193 <td hidden$="[[_hide(c)]]"> 206 <td hidden$="[[_hide(c)]]">
194 [[_column(c, bot, _verbose)]] 207 [[_column(c, bot, _verbose)]]
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 242
230 <error-toast></error-toast> 243 <error-toast></error-toast>
231 </swarming-app> 244 </swarming-app>
232 245
233 </template> 246 </template>
234 <script> 247 <script>
235 (function(){ 248 (function(){
236 var UNKNOWN = "unknown"; 249 var UNKNOWN = "unknown";
237 // see dynamic-table for more information on specialColumns, headerMap, 250 // see dynamic-table for more information on specialColumns, headerMap,
238 // columnMap, and specialSort 251 // columnMap, and specialSort
239 var specialColumns = ["id", "task"]; 252 var specialColumns = ["id", "task", "cloud_console_link", "mp_lease_id"];
240 253
241 var headerMap = { 254 var headerMap = {
242 // "id" and "task" are special, so they don't go here. They have their 255 // "id" and "task" are special, so they don't go here. They have their
243 // headers hard-coded above. 256 // headers hard-coded above.
244 "android_devices": "Android Devices", 257 "android_devices": "Android Devices",
245 "battery_health": "Battery Health", 258 "battery_health": "Battery Health",
246 "battery_level": "Battery Level (%)", 259 "battery_level": "Battery Level (%)",
247 "battery_status": "Battery Status", 260 "battery_status": "Battery Status",
248 "battery_temperature": "Battery Temp (°C)", 261 "battery_temperature": "Battery Temp (°C)",
249 "battery_voltage": "Battery Voltage (mV)", 262 "battery_voltage": "Battery Voltage (mV)",
250 "bot_temperature": "Bot Temp (°C)", 263 "bot_temperature": "Bot Temp (°C)",
251 "cores": "Cores", 264 "cores": "Cores",
252 "cpu": "CPU", 265 "cpu": "CPU",
253 "device": "Non-android Device", 266 "device": "Non-android Device",
254 "device_os": "Device OS", 267 "device_os": "Device OS",
255 "device_temperature": "Device Temp (°C)", 268 "device_temperature": "Device Temp (°C)",
256 "device_type": "Device Type", 269 "device_type": "Device Type",
257 "disk_space": "Free Space (MB)", 270 "disk_space": "Free Space (MB)",
258 "first_seen": "First Seen", 271 "first_seen": "First Seen",
259 "gpu": "GPU", 272 "gpu": "GPU",
260 "last_seen": "Last Seen", 273 "last_seen": "Last Seen",
274 "mp_lease_expires": "Machine Provider Lease Expires",
261 "os": "OS", 275 "os": "OS",
262 "pool": "Pool", 276 "pool": "Pool",
263 "running_time": "Swarming Uptime", 277 "running_time": "Swarming Uptime",
264 "status": "Status", 278 "status": "Status",
265 "uptime": "Bot Uptime", 279 "uptime": "Bot Uptime",
266 "xcode_version": "XCode Version", 280 "xcode_version": "XCode Version",
267 }; 281 };
268 282
269 var columnMap = { 283 var columnMap = {
270 android_devices: function(bot) { 284 android_devices: function(bot) {
(...skipping 24 matching lines...) Expand all
295 return bot.state.temp.zones || UNKNOWN; 309 return bot.state.temp.zones || UNKNOWN;
296 } 310 }
297 return bot.state.temp.average || UNKNOWN; 311 return bot.state.temp.average || UNKNOWN;
298 }, 312 },
299 device_temperature: function(){ 313 device_temperature: function(){
300 return ""; 314 return "";
301 }, 315 },
302 disk_space: function(bot) { 316 disk_space: function(bot) {
303 var aliased = []; 317 var aliased = [];
304 bot.disks.forEach(function(disk){ 318 bot.disks.forEach(function(disk){
305 var alias = sk.human.bytes(disk.mb, swarming.MB); 319 var alias = sk.human.bytes(disk.mb, sk.MB);
306 aliased.push(swarming.alias.apply(disk.mb, disk.id + " "+ alias)); 320 aliased.push(swarming.alias.apply(disk.mb, disk.id + " "+ alias));
307 }.bind(this)); 321 }.bind(this));
308 if (this._verbose) { 322 if (this._verbose) {
309 return aliased.join(" | "); 323 return aliased.join(" | ");
310 } 324 }
311 return aliased[0]; 325 return aliased[0];
312 }, 326 },
313
314 external_ip: function(bot) { 327 external_ip: function(bot) {
315 return bot.external_ip || "none"; 328 return bot.external_ip || "none";
316 }, 329 },
317 first_seen: function(bot) { 330 first_seen: function(bot) {
318 return sk.human.localeTime(bot.first_seen_ts) 331 return sk.human.localeTime(bot.first_seen_ts)
319 }, 332 },
320 id: function(bot) { 333 id: function(bot) {
321 return bot.bot_id; 334 return bot.bot_id;
322 }, 335 },
323 last_seen: function(bot) { 336 last_seen: function(bot) {
324 if (this._verbose) { 337 if (this._verbose) {
325 return sk.human.localeTime(bot.last_seen_ts); 338 return sk.human.localeTime(bot.last_seen_ts);
326 } 339 }
327 return this._timeDiffApprox(bot.last_seen_ts) + " ago"; 340 return this._timeDiffApprox(bot.last_seen_ts) + " ago";
328 }, 341 },
342 mp_lease_id: function(bot) {
343 var id = bot.lease_id || "none";
344 if (this._verbose) {
345 return id;
346 }
347 return id.substring(0, 10);
348 },
349 mp_lease_expires: function(bot) {
350 if (!bot.lease_expiration_ts) {
351 return "N/A";
352 }
353 if (this._verbose) {
354 return sk.human.localeTime(bot.lease_expiration_ts);
355 }
356 if (bot.lease_expiration_ts < new Date()) {
357 return this._timeDiffApprox(bot.lease_expiration_ts) + " ago";
358 }
359 return "in " + this._timeDiffApprox(bot.lease_expiration_ts);
360 },
329 running_time: function(bot) { 361 running_time: function(bot) {
330 var u = this._state(bot, "running_time"); 362 var u = this._state(bot, "running_time");
331 if (!u) { 363 if (!u) {
332 return "unknown"; 364 return "unknown";
333 } 365 }
334 return sk.human.strDuration(u); 366 return sk.human.strDuration(u);
335 }, 367 },
336 status: function(bot) { 368 status: function(bot) {
337 // If a bot is both dead and quarantined, show the deadness over the 369 // If a bot is both dead and quarantined, show the deadness over the
338 // quarentinedness. 370 // quarentinedness.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 value: specialColumns, 568 value: specialColumns,
537 }, 569 },
538 _specialSort: { 570 _specialSort: {
539 type: Object, 571 type: Object,
540 value: specialSort, 572 value: specialSort,
541 }, 573 },
542 }, 574 },
543 575
544 observers:["_reload(_query_params,_auth_headers)"], 576 observers:["_reload(_query_params,_auth_headers)"],
545 577
578 _androidAliasDevice: function(device) {
579 if (device.notReady) {
580 return UNAUTHENTICATED.toUpperCase();
581 }
582 return swarming.alias.android(this._deviceType(device));
583 },
584
546 _botClass: function(bot) { 585 _botClass: function(bot) {
547 if (bot.is_dead) { 586 if (bot.is_dead) {
548 return "dead"; 587 return "dead";
549 } 588 }
550 if (bot.quarantined) { 589 if (bot.quarantined) {
551 return "quarantined"; 590 return "quarantined";
552 } 591 }
553 return ""; 592 return "";
554 }, 593 },
555 594
556 _ccLink: function(bot){ 595 _ccLink: function(bot){
557 var z = this._attribute(bot, "zone")[0]; 596 var z = this._attribute(bot, "zone")[0];
558 if (z === "unknown") { 597 if (z === "unknown") {
559 return undefined; 598 return undefined;
560 } 599 }
561 return this._cloudConsoleLink(z, bot.bot_id); 600 return this._cloudConsoleLink(z, bot.bot_id);
562 }, 601 },
563 602
564 _ccText: function(bot){ 603 _ccText: function(bot){
565 var z = this._attribute(bot, "zone")[0]; 604 var z = this._attribute(bot, "zone")[0];
566 if (z === "unknown") { 605 if (z === "unknown") {
567 return "Not on GCE"; 606 return "Not on GCE";
568 } 607 }
569 return "View Bot"; 608 return "View Bot";
570 }, 609 },
571 610
572 _androidAliasDevice: function(device) {
573 if (device.notReady) {
574 return UNAUTHENTICATED.toUpperCase();
575 }
576 return swarming.alias.android(this._deviceType(device));
577 },
578
579 _deviceColumn: function(col, device) { 611 _deviceColumn: function(col, device) {
580 var f = deviceColumnMap[col]; 612 var f = deviceColumnMap[col];
581 if (!f || !device) { 613 if (!f || !device) {
582 return ""; 614 return "";
583 } 615 }
584 return f.bind(this)(device); 616 return f.bind(this)(device);
585 }, 617 },
586 618
587 _deviceClass: function(device) { 619 _deviceClass: function(device) {
588 if (!device.okay) { 620 if (!device.okay) {
589 return "bad-device"; 621 return "bad-device";
590 } 622 }
591 return ""; 623 return "";
592 }, 624 },
593 625
626 _mpLink: function(bot, template) {
627 if (!bot || !bot.lease_id || !template) {
628 return false;
629 }
630 return template.replace("%s", bot.lease_id);
631 },
632
594 _reload: function() { 633 _reload: function() {
595 if (!this._auth_headers || !this._query_params) { 634 if (!this._auth_headers || !this._query_params) {
596 return; 635 return;
597 } 636 }
598 var url = "/_ah/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this ._query_params); 637 var url = "/_ah/api/swarming/v1/bots/list?" + sk.query.fromParamSet(this ._query_params);
599 this.$.page_bots.load(url,this._auth_headers); 638 this.$.page_bots.load(url,this._auth_headers);
600 } 639 }
601 640
602 }); 641 });
603 })(); 642 })();
604 </script> 643 </script>
605 </dom-module> 644 </dom-module>
OLDNEW
« no previous file with comments | « appengine/swarming/elements/Makefile ('k') | appengine/swarming/elements/res/imp/botlist/bot-list-data.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698