Chromium Code Reviews| 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 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-page> | 9 <bot-page> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 .stats { | 72 .stats { |
| 73 min-width: 700px; | 73 min-width: 700px; |
| 74 flex-grow: 2; | 74 flex-grow: 2; |
| 75 } | 75 } |
| 76 | 76 |
| 77 #collapse { | 77 #collapse { |
| 78 max-width: 700px; | 78 max-width: 700px; |
| 79 } | 79 } |
| 80 | 80 |
| 81 .cloud { | |
| 82 white-space: nowrap; | |
| 83 margin-bottom: 5px; | |
| 84 margin-top: auto; | |
| 85 } | |
| 86 | |
| 81 paper-checkbox { | 87 paper-checkbox { |
| 82 --paper-checkbox-label-color: #fff; | 88 --paper-checkbox-label-color: #fff; |
| 83 --paper-checkbox-checked-color: #fff; | 89 --paper-checkbox-checked-color: #fff; |
| 84 --paper-checkbox-checkmark-color: #000; | 90 --paper-checkbox-checkmark-color: #000; |
| 85 --paper-checkbox-unchecked-color: #fff; | 91 --paper-checkbox-unchecked-color: #fff; |
| 86 padding: 3px; | 92 padding: 3px; |
| 87 } | 93 } |
| 88 | 94 |
| 89 paper-dialog { | 95 paper-dialog { |
| 90 border-radius: 6px; | 96 border-radius: 6px; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 | 131 |
| 126 bot="{{_bot}}" | 132 bot="{{_bot}}" |
| 127 busy="{{_busy1}}" | 133 busy="{{_busy1}}" |
| 128 events="{{_events}}" | 134 events="{{_events}}" |
| 129 tasks="{{_tasks}}" | 135 tasks="{{_tasks}}" |
| 130 on-reload="_clearAndReload"> | 136 on-reload="_clearAndReload"> |
| 131 </bot-page-data> | 137 </bot-page-data> |
| 132 | 138 |
| 133 <div class="header horizontal layout"> | 139 <div class="header horizontal layout"> |
| 134 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape r-input> | 140 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape r-input> |
| 141 <template is="dom-if" if="[[_cloudConsoleLink(_bot)]]"> | |
| 142 <div class="vertical layout"> | |
| 143 <a href$="[[_cloudConsoleLink(_bot)]]" class="cloud">Cloud Console </a> | |
| 144 </div> | |
| 145 </template> | |
| 135 <button on-click="_refresh"> | 146 <button on-click="_refresh"> |
| 136 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> | 147 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> |
| 137 </button> | 148 </button> |
| 138 </div> | 149 </div> |
| 139 | 150 |
| 140 <div class="horizontal wrap layout"> | 151 <div class="horizontal wrap layout"> |
| 141 <div class="flex"> | 152 <div class="flex"> |
| 142 <table> | 153 <table> |
| 143 <tr class$="[[_isDead(_bot)]]" title="Last time the bot contacted the server."> | 154 <tr class$="[[_isDead(_bot)]]" title="Last time the bot contacted the server."> |
| 144 <td>Last Seen</td> | 155 <td>Last Seen</td> |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 162 </tr> | 173 </tr> |
| 163 <template is="dom-if" if="[[_bot.quarantined]]"> | 174 <template is="dom-if" if="[[_bot.quarantined]]"> |
| 164 <tr class="quarantined"> | 175 <tr class="quarantined"> |
| 165 <td>Quarantined</td> | 176 <td>Quarantined</td> |
| 166 <td colspan="2" class="message">[[_quarantineMessage(_bot)]]</ td> | 177 <td colspan="2" class="message">[[_quarantineMessage(_bot)]]</ td> |
| 167 </tr> | 178 </tr> |
| 168 </template> | 179 </template> |
| 169 <tr> | 180 <tr> |
| 170 <td>Current Task</td> | 181 <td>Current Task</td> |
| 171 <td> | 182 <td> |
| 172 <a target="_blank" href$="[[_taskLink(_bot.task_id)]]"> | 183 <a target="_blank" rel="noopener" |
| 184 href$="[[_taskLink(_bot.task_id)]]"> | |
| 173 [[_task(_bot)]] | 185 [[_task(_bot)]] |
| 174 </a> | 186 </a> |
| 175 </td> | 187 </td> |
| 176 <td> | 188 <td> |
| 177 <!-- TODO(kjlubick) add the cancel button when swarming can | 189 <!-- TODO(kjlubick) add the cancel button when swarming can |
| 178 cancel running tasks --> | 190 cancel running tasks --> |
| 179 </td> | 191 </td> |
| 180 </tr> | 192 </tr> |
| 181 <tr> | 193 <tr> |
| 182 <td rowspan$="[[_numRows(_bot.dimensions)]]">Dimensions</td> | 194 <td rowspan$="[[_numRows(_bot.dimensions)]]">Dimensions</td> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 <tr> | 278 <tr> |
| 267 <th>Task</th> | 279 <th>Task</th> |
| 268 <th>Started</th> | 280 <th>Started</th> |
| 269 <th>Duration</th> | 281 <th>Duration</th> |
| 270 <th>Result</th> | 282 <th>Result</th> |
| 271 </tr> | 283 </tr> |
| 272 </thead> | 284 </thead> |
| 273 <tbody> | 285 <tbody> |
| 274 <template is="dom-repeat" items="{{_tasks}}" as="task"> | 286 <template is="dom-repeat" items="{{_tasks}}" as="task"> |
| 275 <tr class$="[[_taskClass(task)]]"> | 287 <tr class$="[[_taskClass(task)]]"> |
| 276 <td><a target="_blank" href$="[[_taskLink(task.task_id)]]">[[t ask.name]]</a></td> | 288 <td> |
| 289 <a target="_blank" rel="noopener" | |
| 290 href$="[[_taskLink(task.task_id)]]"> | |
| 291 [[task.name]] | |
| 292 </a> | |
| 293 </td> | |
| 277 <td>[[task.human_started_ts]]</td> | 294 <td>[[task.human_started_ts]]</td> |
| 278 <td title="[[task.human_completed_ts]]">[[task.human_duration] ]</td> | 295 <td title="[[task.human_completed_ts]]">[[task.human_duration] ]</td> |
| 279 <td>[[task.state]]</td> | 296 <td>[[task.state]]</td> |
| 280 </tr> | 297 </tr> |
| 281 </template> | 298 </template> |
| 282 </tbody> | 299 </tbody> |
| 283 </table> | 300 </table> |
| 284 </template> | 301 </template> |
| 285 | 302 |
| 286 <template is="dom-if" if="[[_showEvents]]"> | 303 <template is="dom-if" if="[[_showEvents]]"> |
| 287 <table class="events_table"> | 304 <table class="events_table"> |
| 288 <thead> | 305 <thead> |
| 289 <tr> | 306 <tr> |
| 290 <th>Message</th> | 307 <th>Message</th> |
| 291 <th>Type</th> | 308 <th>Type</th> |
| 292 <th>Timestamp</th> | 309 <th>Timestamp</th> |
| 293 <th>Task ID</th> | 310 <th>Task ID</th> |
| 294 <th>Version</th> | 311 <th>Version</th> |
| 295 </tr> | 312 </tr> |
| 296 </thead> | 313 </thead> |
| 297 <tbody> | 314 <tbody> |
| 298 <template is="dom-repeat" items="{{_eventList(_show_all,_events.*) }}" as="event"> | 315 <template is="dom-repeat" items="{{_eventList(_show_all,_events.*) }}" as="event"> |
| 299 <tr> | 316 <tr> |
| 300 <td class="message">[[event.message]]</td> | 317 <td class="message">[[event.message]]</td> |
| 301 <td>[[event.event_type]]</td> | 318 <td>[[event.event_type]]</td> |
| 302 <td>[[event.human_ts]]</td> | 319 <td>[[event.human_ts]]</td> |
| 303 <td><a target="_blank" href$="[[_taskLink(event.task_id)]]">[[ event.task_id]]</a></td> | 320 <td> |
| 321 <a target="_blank" rel="noopener" | |
| 322 href$="[[_taskLink(event.task_id)]]"> | |
| 323 [[event.task_id]] | |
| 324 </a> | |
| 325 </td> | |
| 304 <td class$="[[_classVersion(_server_version.bot_version,event. version)]]"> | 326 <td class$="[[_classVersion(_server_version.bot_version,event. version)]]"> |
| 305 <a target="_blank" href$="[[_luciLink(event.version)]]">[[_s horten(event.version,'8')]]</a> | 327 <a target="_blank" rel="noopener" |
| 328 href$="[[_luciLink(event.version)]]"> | |
| 329 [[_shorten(event.version,'8')]] | |
| 330 </a> | |
| 306 </td> | 331 </td> |
| 307 </tr> | 332 </tr> |
| 308 </template> | 333 </template> |
| 309 </tbody> | 334 </tbody> |
| 310 </table> | 335 </table> |
| 311 </template> | 336 </template> |
| 312 <!-- https://github.com/Polymer/polymer/issues/3669 hidden$ doesn't | 337 <!-- https://github.com/Polymer/polymer/issues/3669 hidden$ doesn't |
| 313 respect truthiness, only booleanness, so we have _showEvents | 338 respect truthiness, only booleanness, so we have _showEvents |
| 314 instead of using _selected directly.--> | 339 instead of using _selected directly.--> |
| 315 <pageable-data | 340 <pageable-data |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 } | 443 } |
| 419 return ""; | 444 return ""; |
| 420 }, | 445 }, |
| 421 | 446 |
| 422 _clearAndReload: function(botID) { | 447 _clearAndReload: function(botID) { |
| 423 this.$.page_tasks.clear(); | 448 this.$.page_tasks.clear(); |
| 424 this.$.page_events.clear(); | 449 this.$.page_events.clear(); |
| 425 this._reload(); | 450 this._reload(); |
| 426 }, | 451 }, |
| 427 | 452 |
| 453 _cloudConsoleLink(bot) { | |
|
stephana
2016/10/03 19:58:35
Should this be
_cloudConsoleLink: function(bot)
kjlubick
2016/10/03 20:07:45
yes. I'm surprised it worked.
| |
| 454 // We create a link to this bot in cloud console if we detect it is | |
| 455 // on GCE. We look for the zone dimension and create the link using | |
| 456 // that. | |
| 457 if (!bot || !bot.dimensions) { | |
| 458 return undefined; | |
|
stephana
2016/10/03 19:58:35
return false or empty string instead of undefined.
kjlubick
2016/10/03 20:07:45
Done.
| |
| 459 } | |
| 460 var link; | |
| 461 bot.dimensions.forEach(function(d){ | |
| 462 if (d.key === "zone") { | |
| 463 link = this._cloudConsoleLink(d.value[0], bot.bot_id); | |
|
stephana
2016/10/03 19:58:35
what's the second argument ? wouldn't this make a
kjlubick
2016/10/03 20:07:45
This was, correctly but inexplicably, calling comm
stephana
2016/10/04 13:24:31
Acknowledged.
| |
| 464 } | |
| 465 }.bind(this)) | |
| 466 return link; | |
| 467 }, | |
| 468 | |
| 428 _concat: function(arr) { | 469 _concat: function(arr) { |
| 429 if (!arr) { | 470 if (!arr) { |
| 430 return ""; | 471 return ""; |
| 431 } | 472 } |
| 432 return arr.join(" | "); | 473 return arr.join(" | "); |
| 433 }, | 474 }, |
| 434 | 475 |
| 435 _deleteBot: function() { | 476 _deleteBot: function() { |
| 436 swarming.postWithToast("/_ah/api/swarming/v1/bot/"+this.bot_id+"/delete" , | 477 swarming.postWithToast("/_ah/api/swarming/v1/bot/"+this.bot_id+"/delete" , |
| 437 "Deleting "+this.bot_id, this._auth_headers); | 478 "Deleting "+this.bot_id, this._auth_headers); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 }, | 590 }, |
| 550 | 591 |
| 551 _toggleState: function() { | 592 _toggleState: function() { |
| 552 this.set("_show_state", !this._show_state); | 593 this.set("_show_state", !this._show_state); |
| 553 } | 594 } |
| 554 | 595 |
| 555 }); | 596 }); |
| 556 })(); | 597 })(); |
| 557 </script> | 598 </script> |
| 558 </dom-module> | 599 </dom-module> |
| OLD | NEW |