| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 white-space: pre; | 56 white-space: pre; |
| 57 font-family: monospace; | 57 font-family: monospace; |
| 58 margin-bottom: 10px; | 58 margin-bottom: 10px; |
| 59 } | 59 } |
| 60 | 60 |
| 61 .tasks_table, | 61 .tasks_table, |
| 62 .events_table { | 62 .events_table { |
| 63 border: 3px solid #1F78B4; | 63 border: 3px solid #1F78B4; |
| 64 } | 64 } |
| 65 | 65 |
| 66 .old_version { |
| 67 background-color: #ffffdd; |
| 68 } |
| 69 |
| 66 paper-checkbox { | 70 paper-checkbox { |
| 67 --paper-checkbox-label-color: #fff; | 71 --paper-checkbox-label-color: #fff; |
| 68 --paper-checkbox-checked-color: #fff; | 72 --paper-checkbox-checked-color: #fff; |
| 69 --paper-checkbox-checkmark-color: #000; | 73 --paper-checkbox-checkmark-color: #000; |
| 70 --paper-checkbox-unchecked-color: #fff; | 74 --paper-checkbox-unchecked-color: #fff; |
| 71 padding: 3px; | 75 padding: 3px; |
| 72 } | 76 } |
| 73 | 77 |
| 74 paper-dialog { | 78 paper-dialog { |
| 75 border-radius: 6px; | 79 border-radius: 6px; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 86 value="{{_selected}}"> | 90 value="{{_selected}}"> |
| 87 </url-param> | 91 </url-param> |
| 88 <url-param name="show_state" | 92 <url-param name="show_state" |
| 89 value="{{_show_state}}"> | 93 value="{{_show_state}}"> |
| 90 </url-param> | 94 </url-param> |
| 91 | 95 |
| 92 <swarming-app | 96 <swarming-app |
| 93 client_id="[[client_id]]" | 97 client_id="[[client_id]]" |
| 94 auth_headers="{{_auth_headers}}" | 98 auth_headers="{{_auth_headers}}" |
| 95 permissions="{{_permissions}}" | 99 permissions="{{_permissions}}" |
| 100 server_version="{{_server_version}}" |
| 96 signed_in="{{_signed_in}}" | 101 signed_in="{{_signed_in}}" |
| 97 | 102 |
| 98 busy="[[_busy]]" | 103 busy="[[_busy]]" |
| 99 name="Swarming Bot Page"> | 104 name="Swarming Bot Page"> |
| 100 | 105 |
| 101 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 106 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 102 | 107 |
| 103 <div hidden$="[[_not(_signed_in)]]"> | 108 <div hidden$="[[_not(_signed_in)]]"> |
| 104 | 109 |
| 105 <bot-page-data | 110 <bot-page-data |
| 106 id="data" | 111 id="data" |
| 107 auth_headers="[[_auth_headers]]" | 112 auth_headers="[[_auth_headers]]" |
| 108 bot_id="[[bot_id]]" | 113 bot_id="[[bot_id]]" |
| 109 | 114 |
| 110 bot="{{_bot}}" | 115 bot="{{_bot}}" |
| 111 busy="{{_busy}}" | 116 busy="{{_busy}}" |
| 112 events="{{_events}}" | 117 events="{{_events}}" |
| 113 tasks="{{_tasks}}"> | 118 tasks="{{_tasks}}"> |
| 114 </bot-page-data> | 119 </bot-page-data> |
| 115 | 120 |
| 116 <div class="header horizontal layout"> | 121 <div class="header horizontal layout"> |
| 117 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape
r-input> | 122 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape
r-input> |
| 118 <button on-click="_refresh"> | 123 <button on-click="_refresh"> |
| 119 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> | 124 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> |
| 120 </button> | 125 </button> |
| 121 </div> | 126 </div> |
| 122 | 127 |
| 123 <div> | 128 <div> |
| 124 <table> | 129 <table> |
| 125 <tr class$="[[_isDead(_bot)]]"> | 130 <tr class$="[[_isDead(_bot)]]" title="Last time the bot contacted th
e server."> |
| 126 <td>Last Seen</td> | 131 <td>Last Seen</td> |
| 127 <td title="[[_bot.human_last_seen_ts]]"> | 132 <td title="[[_bot.human_last_seen_ts]]"> |
| 128 [[_timeDiffExact(_bot.last_seen_ts)]] ago</td> | 133 [[_timeDiffExact(_bot.last_seen_ts)]] ago</td> |
| 129 <td> | 134 <td> |
| 130 <!-- dom-ifs are slightly less performant than hidden$=, but | 135 <!-- dom-ifs are slightly less performant than hidden$=, but |
| 131 prevent things from first drawing and then hiding. We prefer to | 136 prevent things from first drawing and then hiding. We prefer to |
| 132 not flash buttons or quarantined messages --> | 137 not flash buttons or quarantined messages --> |
| 133 <template is="dom-if" if="[[_canShutdown(_bot,_permissions)]]"> | 138 <template is="dom-if" if="[[_canShutdown(_bot,_permissions)]]"> |
| 134 <button class="raised" on-click="_promptShutdown"> | 139 <button class="raised" on-click="_promptShutdown"> |
| 135 Shut Down Gracefully | 140 Shut Down Gracefully |
| (...skipping 30 matching lines...) Expand all Loading... |
| 166 <template | 171 <template |
| 167 is="dom-repeat" | 172 is="dom-repeat" |
| 168 items="[[_bot.dimensions]]" | 173 items="[[_bot.dimensions]]" |
| 169 as="dim"> | 174 as="dim"> |
| 170 <tr> | 175 <tr> |
| 171 <td>[[dim.key]]</td> | 176 <td>[[dim.key]]</td> |
| 172 <td>[[_concat(dim.value)]]</td> | 177 <td>[[_concat(dim.value)]]</td> |
| 173 </tr> | 178 </tr> |
| 174 </template> | 179 </template> |
| 175 | 180 |
| 176 <tr> | 181 <tr title="IP address that the server saw the connection from."> |
| 177 <td>External IP</td> | 182 <td>External IP</td> |
| 178 <td><a href$="[[_bot.external_ip]]">[[_bot.external_ip]]</a></td> | 183 <td><a href$="[[_bot.external_ip]]">[[_bot.external_ip]]</a></td> |
| 179 <td></td> | 184 <td></td> |
| 180 </tr> | 185 </tr> |
| 181 <tr> | 186 <tr |
| 182 <td>Swarming Revision</td> | 187 class$="[[_classVersion(_server_version.bot_version,_bot.version
)]]" |
| 188 title="Version is based on the content of swarming_bot.zip which
is the swarming bot code. The bot won't update if quarantined, dead, or busy."> |
| 183 <td> | 189 <td> |
| 184 <a target="_blank" href$="[[_luciLink(_bot.version)]]">[[_shorte
n(_bot.version,'8')]]</a> | 190 Bot Version</td> |
| 185 </td> | 191 <td>[[_shorten(_bot.version,'8')]]</td> |
| 186 <td></td> | 192 <td></td> |
| 187 </tr> | 193 </tr> |
| 188 <tr> | 194 <tr title="The version the server expects the bot to be using."> |
| 195 <td>Expected Bot Version</td> |
| 196 <td>[[_shorten(_server_version.bot_version,'8')]]</td> |
| 197 <td></td> |
| 198 </tr> |
| 199 <tr title="First time ever a bot with this id contacted the server."
> |
| 189 <td>First seen</td> | 200 <td>First seen</td> |
| 190 <td title="[[_bot.human_first_seen_ts]]"> | 201 <td title="[[_bot.human_first_seen_ts]]"> |
| 191 [[_timeDiffApprox(_bot.first_seen_ts)]] ago | 202 [[_timeDiffApprox(_bot.first_seen_ts)]] ago |
| 192 </td> | 203 </td> |
| 193 <td></td> | 204 <td></td> |
| 194 </tr> | 205 </tr> |
| 195 <tr> | 206 <tr title="How the bot is authenticated by the server."> |
| 196 <td>Authenticated as</td> | 207 <td>Authenticated as</td> |
| 197 <td>[[_bot.authenticated_as]]</td> | 208 <td>[[_bot.authenticated_as]]</td> |
| 198 <td></td> | 209 <td></td> |
| 199 </tr> | 210 </tr> |
| 200 </table> | 211 </table> |
| 201 | 212 |
| 202 <span class="title">State</span> | 213 <span class="title">State</span> |
| 203 | 214 |
| 204 <template is="dom-if" if="[[_not(_show_state)]]"> | 215 <template is="dom-if" if="[[_not(_show_state)]]"> |
| 205 <button on-click="_toggleState"> | 216 <button on-click="_toggleState"> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 <th>Version</th> | 276 <th>Version</th> |
| 266 </tr> | 277 </tr> |
| 267 </thead> | 278 </thead> |
| 268 <tbody> | 279 <tbody> |
| 269 <template is="dom-repeat" items="{{_eventList(_events,_show_all)}}
" as="event"> | 280 <template is="dom-repeat" items="{{_eventList(_events,_show_all)}}
" as="event"> |
| 270 <tr> | 281 <tr> |
| 271 <td class="message">[[event.message]]</a></td> | 282 <td class="message">[[event.message]]</a></td> |
| 272 <td>[[event.event_type]]</td> | 283 <td>[[event.event_type]]</td> |
| 273 <td>[[event.human_ts]]</td> | 284 <td>[[event.human_ts]]</td> |
| 274 <td><a target="_blank" href$="[[_taskLink(event.task_id)]]">[[
event.task_id]]</a></td> | 285 <td><a target="_blank" href$="[[_taskLink(event.task_id)]]">[[
event.task_id]]</a></td> |
| 275 <td> | 286 <td class$="[[_classVersion(_server_version.bot_version,event.
version)]]"> |
| 276 <a target="_blank" href$="[[_luciLink(event.version)]]">[[_s
horten(event.version,'8')]]</a> | 287 <a target="_blank" href$="[[_luciLink(event.version)]]">[[_s
horten(event.version,'8')]]</a> |
| 277 </td> | 288 </td> |
| 278 </tr> | 289 </tr> |
| 279 </template> | 290 </template> |
| 280 </tbody> | 291 </tbody> |
| 281 </table> | 292 </table> |
| 282 </template> | 293 </template> |
| 283 </div> | 294 </div> |
| 284 </swarming-app> | 295 </swarming-app> |
| 285 | 296 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 }, | 350 }, |
| 340 | 351 |
| 341 _canDelete: function(bot, permissions) { | 352 _canDelete: function(bot, permissions) { |
| 342 return bot && bot.is_dead && permissions.delete_bot; | 353 return bot && bot.is_dead && permissions.delete_bot; |
| 343 }, | 354 }, |
| 344 | 355 |
| 345 _canShutdown: function(bot, permissions){ | 356 _canShutdown: function(bot, permissions){ |
| 346 return bot && !bot.is_dead && permissions.terminate_bot; | 357 return bot && !bot.is_dead && permissions.terminate_bot; |
| 347 }, | 358 }, |
| 348 | 359 |
| 360 _classVersion: function(serverVersion, otherVersion) { |
| 361 if (serverVersion !== otherVersion) { |
| 362 return "old_version"; |
| 363 } |
| 364 return ""; |
| 365 }, |
| 366 |
| 349 _concat: function(arr) { | 367 _concat: function(arr) { |
| 350 if (!arr) { | 368 if (!arr) { |
| 351 return ""; | 369 return ""; |
| 352 } | 370 } |
| 353 return arr.join(" | "); | 371 return arr.join(" | "); |
| 354 }, | 372 }, |
| 355 | 373 |
| 356 _deleteBot: function() { | 374 _deleteBot: function() { |
| 357 swarming.postWithToast("/_ah/api/swarming/v1/bot/"+this.bot_id+"/delete"
, | 375 swarming.postWithToast("/_ah/api/swarming/v1/bot/"+this.bot_id+"/delete"
, |
| 358 "Deleting "+this.bot_id, this._auth_headers); | 376 "Deleting "+this.bot_id, this._auth_headers); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 }, | 476 }, |
| 459 | 477 |
| 460 _toggleState: function() { | 478 _toggleState: function() { |
| 461 this.set("_show_state", !this._show_state); | 479 this.set("_show_state", !this._show_state); |
| 462 } | 480 } |
| 463 | 481 |
| 464 }); | 482 }); |
| 465 })(); | 483 })(); |
| 466 </script> | 484 </script> |
| 467 </dom-module> | 485 </dom-module> |
| OLD | NEW |