| 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 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 <link rel="import" href="/res/imp/common/error-toast.html"> | 37 <link rel="import" href="/res/imp/common/error-toast.html"> |
| 38 <link rel="import" href="/res/imp/common/pageable-data.html"> | 38 <link rel="import" href="/res/imp/common/pageable-data.html"> |
| 39 <link rel="import" href="/res/imp/common/single-page-style.html"> | 39 <link rel="import" href="/res/imp/common/single-page-style.html"> |
| 40 <link rel="import" href="/res/imp/common/swarming-app.html"> | 40 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 41 <link rel="import" href="/res/imp/common/task-behavior.html"> | 41 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 42 <link rel="import" href="/res/imp/common/url-param.html"> | 42 <link rel="import" href="/res/imp/common/url-param.html"> |
| 43 | 43 |
| 44 <link rel="import" href="bot-page-data.html"> | 44 <link rel="import" href="bot-page-data.html"> |
| 45 <link rel="import" href="bot-page-shared-behavior.html"> | 45 <link rel="import" href="bot-page-shared-behavior.html"> |
| 46 <link rel="import" href="bot-page-summary.html"> |
| 46 | 47 |
| 47 | 48 |
| 48 <dom-module id="bot-page"> | 49 <dom-module id="bot-page"> |
| 49 <template> | 50 <template> |
| 50 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app-
style single-page-style task-style"> | 51 <style include="iron-flex iron-flex-alignment iron-positioning swarming-app-
style single-page-style task-style"> |
| 51 .message { | 52 .message { |
| 52 white-space: pre-line; | 53 white-space: pre-line; |
| 53 font-family: monospace; | 54 font-family: monospace; |
| 54 } | 55 } |
| 55 | 56 |
| 56 .bot_state { | 57 .bot_state { |
| 57 white-space: pre; | 58 white-space: pre; |
| 58 font-family: monospace; | 59 font-family: monospace; |
| 59 margin-bottom: 10px; | 60 margin-bottom: 10px; |
| 60 } | 61 } |
| 61 | 62 |
| 62 .tasks_table, | 63 .tasks_table, |
| 63 .events_table { | 64 .events_table { |
| 64 border: 3px solid #1F78B4; | 65 border: 3px solid #1F78B4; |
| 65 } | 66 } |
| 66 | 67 |
| 67 .old_version { | 68 .old_version { |
| 68 background-color: #ffffdd; | 69 background-color: #ffffdd; |
| 69 } | 70 } |
| 70 | 71 |
| 72 .stats { |
| 73 min-width: 700px; |
| 74 flex-grow: 2; |
| 75 } |
| 76 |
| 77 #collapse { |
| 78 max-width: 700px; |
| 79 } |
| 80 |
| 71 paper-checkbox { | 81 paper-checkbox { |
| 72 --paper-checkbox-label-color: #fff; | 82 --paper-checkbox-label-color: #fff; |
| 73 --paper-checkbox-checked-color: #fff; | 83 --paper-checkbox-checked-color: #fff; |
| 74 --paper-checkbox-checkmark-color: #000; | 84 --paper-checkbox-checkmark-color: #000; |
| 75 --paper-checkbox-unchecked-color: #fff; | 85 --paper-checkbox-unchecked-color: #fff; |
| 76 padding: 3px; | 86 padding: 3px; |
| 77 } | 87 } |
| 78 | 88 |
| 79 paper-dialog { | 89 paper-dialog { |
| 80 border-radius: 6px; | 90 border-radius: 6px; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 on-reload="_clearAndReload"> | 130 on-reload="_clearAndReload"> |
| 121 </bot-page-data> | 131 </bot-page-data> |
| 122 | 132 |
| 123 <div class="header horizontal layout"> | 133 <div class="header horizontal layout"> |
| 124 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape
r-input> | 134 <paper-input class="id_input" label="Bot id" value="{{bot_id}}"></pape
r-input> |
| 125 <button on-click="_refresh"> | 135 <button on-click="_refresh"> |
| 126 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> | 136 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> |
| 127 </button> | 137 </button> |
| 128 </div> | 138 </div> |
| 129 | 139 |
| 130 <div> | 140 <div class="horizontal wrap layout"> |
| 131 <table> | 141 <div class="flex"> |
| 132 <tr class$="[[_isDead(_bot)]]" title="Last time the bot contacted th
e server."> | 142 <table> |
| 133 <td>Last Seen</td> | 143 <tr class$="[[_isDead(_bot)]]" title="Last time the bot contacted
the server."> |
| 134 <td title="[[_bot.human_last_seen_ts]]"> | 144 <td>Last Seen</td> |
| 135 [[_timeDiffExact(_bot.last_seen_ts)]] ago</td> | 145 <td title="[[_bot.human_last_seen_ts]]"> |
| 136 <td> | 146 [[_timeDiffExact(_bot.last_seen_ts)]] ago</td> |
| 137 <!-- dom-ifs are slightly less performant than hidden$=, but | 147 <td> |
| 138 prevent things from first drawing and then hiding. We prefer to | 148 <!-- dom-ifs are slightly less performant than hidden$=, but |
| 139 not flash buttons or quarantined messages --> | 149 prevent things from first drawing and then hiding. We prefer to |
| 140 <template is="dom-if" if="[[_canShutdown(_bot,_permissions)]]"> | 150 not flash buttons or quarantined messages --> |
| 141 <button class="raised" on-click="_promptShutdown"> | 151 <template is="dom-if" if="[[_canShutdown(_bot,_permissions)]]"
> |
| 142 Shut Down Gracefully | 152 <button class="raised" on-click="_promptShutdown"> |
| 143 </button> | 153 Shut Down Gracefully |
| 144 </template> | 154 </button> |
| 145 <template is="dom-if" if="[[_canDelete(_bot,_permissions)]]"> | 155 </template> |
| 146 <button class="raised" on-click="_promptDelete"> | 156 <template is="dom-if" if="[[_canDelete(_bot,_permissions)]]"> |
| 147 Delete | 157 <button class="raised" on-click="_promptDelete"> |
| 148 </button> | 158 Delete |
| 149 </template> | 159 </button> |
| 150 </td> | 160 </template> |
| 151 </tr> | 161 </td> |
| 152 <template is="dom-if" if="[[_bot.quarantined]]"> | |
| 153 <tr class="quarantined"> | |
| 154 <td>Quarantined</td> | |
| 155 <td colspan="2" class="message">[[_quarantineMessage(_bot)]]</td
> | |
| 156 </tr> | 162 </tr> |
| 157 </template> | 163 <template is="dom-if" if="[[_bot.quarantined]]"> |
| 158 <tr> | 164 <tr class="quarantined"> |
| 159 <td>Current Task</td> | 165 <td>Quarantined</td> |
| 160 <td> | 166 <td colspan="2" class="message">[[_quarantineMessage(_bot)]]</
td> |
| 161 <a target="_blank" href$="[[_taskLink(_bot.task_id)]]"> | 167 </tr> |
| 162 [[_task(_bot)]] | 168 </template> |
| 163 </a> | |
| 164 </td> | |
| 165 <td> | |
| 166 <!-- TODO(kjlubick) add the cancel button when swarming can | |
| 167 cancel running tasks --> | |
| 168 </td> | |
| 169 </tr> | |
| 170 <tr> | |
| 171 <td rowspan$="[[_numRows(_bot.dimensions)]]">Dimensions</td> | |
| 172 </tr> | |
| 173 <template | |
| 174 is="dom-repeat" | |
| 175 items="[[_bot.dimensions]]" | |
| 176 as="dim"> | |
| 177 <tr> | 169 <tr> |
| 178 <td>[[dim.key]]</td> | 170 <td>Current Task</td> |
| 179 <td>[[_concat(dim.value)]]</td> | 171 <td> |
| 172 <a target="_blank" href$="[[_taskLink(_bot.task_id)]]"> |
| 173 [[_task(_bot)]] |
| 174 </a> |
| 175 </td> |
| 176 <td> |
| 177 <!-- TODO(kjlubick) add the cancel button when swarming can |
| 178 cancel running tasks --> |
| 179 </td> |
| 180 </tr> | 180 </tr> |
| 181 <tr> |
| 182 <td rowspan$="[[_numRows(_bot.dimensions)]]">Dimensions</td> |
| 183 </tr> |
| 184 <template |
| 185 is="dom-repeat" |
| 186 items="[[_bot.dimensions]]" |
| 187 as="dim"> |
| 188 <tr> |
| 189 <td>[[dim.key]]</td> |
| 190 <td>[[_concat(dim.value)]]</td> |
| 191 </tr> |
| 192 </template> |
| 193 |
| 194 <tr title="IP address that the server saw the connection from."> |
| 195 <td>External IP</td> |
| 196 <td><a href$="[[_bot.external_ip]]">[[_bot.external_ip]]</a></td
> |
| 197 <td></td> |
| 198 </tr> |
| 199 <tr |
| 200 class$="[[_classVersion(_server_version.bot_version,_bot.versi
on)]]" |
| 201 title="Version is based on the content of swarming_bot.zip whi
ch is the swarming bot code. The bot won't update if quarantined, dead, or busy.
"> |
| 202 <td>Bot Version</td> |
| 203 <td>[[_shorten(_bot.version,'8')]]</td> |
| 204 <td></td> |
| 205 </tr> |
| 206 <tr title="The version the server expects the bot to be using."> |
| 207 <td>Expected Bot Version</td> |
| 208 <td>[[_shorten(_server_version.bot_version,'8')]]</td> |
| 209 <td></td> |
| 210 </tr> |
| 211 <tr title="First time ever a bot with this id contacted the server
."> |
| 212 <td>First seen</td> |
| 213 <td title="[[_bot.human_first_seen_ts]]"> |
| 214 [[_timeDiffApprox(_bot.first_seen_ts)]] ago |
| 215 </td> |
| 216 <td></td> |
| 217 </tr> |
| 218 <tr title="How the bot is authenticated by the server."> |
| 219 <td>Authenticated as</td> |
| 220 <td colspan=2>[[_bot.authenticated_as]]</td> |
| 221 </tr> |
| 222 </table> |
| 223 |
| 224 <span class="title">State</span> |
| 225 |
| 226 <template is="dom-if" if="[[_not(_show_state)]]"> |
| 227 <button on-click="_toggleState"> |
| 228 <iron-icon icon="icons:add-circle-outline"></iron-icon> |
| 229 </button> |
| 181 </template> | 230 </template> |
| 182 | 231 |
| 183 <tr title="IP address that the server saw the connection from."> | 232 <template is="dom-if" if="[[_show_state]]"> |
| 184 <td>External IP</td> | 233 <button on-click="_toggleState"> |
| 185 <td><a href$="[[_bot.external_ip]]">[[_bot.external_ip]]</a></td> | 234 <iron-icon icon="icons:remove-circle-outline"></iron-icon> |
| 186 <td></td> | 235 </button> |
| 187 </tr> | 236 </template> |
| 188 <tr | |
| 189 class$="[[_classVersion(_server_version.bot_version,_bot.version
)]]" | |
| 190 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."> | |
| 191 <td> | |
| 192 Bot Version</td> | |
| 193 <td>[[_shorten(_bot.version,'8')]]</td> | |
| 194 <td></td> | |
| 195 </tr> | |
| 196 <tr title="The version the server expects the bot to be using."> | |
| 197 <td>Expected Bot Version</td> | |
| 198 <td>[[_shorten(_server_version.bot_version,'8')]]</td> | |
| 199 <td></td> | |
| 200 </tr> | |
| 201 <tr title="First time ever a bot with this id contacted the server."
> | |
| 202 <td>First seen</td> | |
| 203 <td title="[[_bot.human_first_seen_ts]]"> | |
| 204 [[_timeDiffApprox(_bot.first_seen_ts)]] ago | |
| 205 </td> | |
| 206 <td></td> | |
| 207 </tr> | |
| 208 <tr title="How the bot is authenticated by the server."> | |
| 209 <td>Authenticated as</td> | |
| 210 <td>[[_bot.authenticated_as]]</td> | |
| 211 <td></td> | |
| 212 </tr> | |
| 213 </table> | |
| 214 | 237 |
| 215 <span class="title">State</span> | 238 <iron-collapse id="collapse" opened="[[_show_state]]"> |
| 239 <div class="bot_state">[[_prettyPrint(_bot.state)]]</div> |
| 240 </iron-collapse> |
| 241 </div> |
| 216 | 242 |
| 217 <template is="dom-if" if="[[_not(_show_state)]]"> | 243 <div class="stats flex"> |
| 218 <button on-click="_toggleState"> | 244 <bot-page-summary |
| 219 <iron-icon icon="icons:add-circle-outline"></iron-icon> | 245 tasks="[[_tasks]]"> |
| 220 </button> | 246 </bot-page-summary> |
| 221 </template> | 247 </div> |
| 222 | |
| 223 <template is="dom-if" if="[[_show_state]]"> | |
| 224 <button on-click="_toggleState"> | |
| 225 <iron-icon icon="icons:remove-circle-outline"></iron-icon> | |
| 226 </button> | |
| 227 </template> | |
| 228 | |
| 229 <iron-collapse id="collapse" opened="[[_show_state]]"> | |
| 230 <div class="bot_state">[[_prettyPrint(_bot.state)]]</div> | |
| 231 </iron-collapse> | |
| 232 </div> | 248 </div> |
| 233 | 249 |
| 234 <div class="tabs"> | 250 <div class="tabs"> |
| 235 <paper-tabs selected="{{_selected}}" no-bar> | 251 <paper-tabs selected="{{_selected}}" no-bar> |
| 236 <paper-tab>Tasks</paper-tab> | 252 <paper-tab>Tasks</paper-tab> |
| 237 <paper-tab>Events</paper-tab> | 253 <paper-tab>Events</paper-tab> |
| 238 </paper-tabs> | 254 </paper-tabs> |
| 239 | 255 |
| 240 <template is="dom-if" if="[[_showEvents]]"> | 256 <template is="dom-if" if="[[_showEvents]]"> |
| 241 <paper-checkbox checked="{{_show_all}}"> | 257 <paper-checkbox checked="{{_show_all}}"> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 <th>Message</th> | 290 <th>Message</th> |
| 275 <th>Type</th> | 291 <th>Type</th> |
| 276 <th>Timestamp</th> | 292 <th>Timestamp</th> |
| 277 <th>Task ID</th> | 293 <th>Task ID</th> |
| 278 <th>Version</th> | 294 <th>Version</th> |
| 279 </tr> | 295 </tr> |
| 280 </thead> | 296 </thead> |
| 281 <tbody> | 297 <tbody> |
| 282 <template is="dom-repeat" items="{{_eventList(_show_all,_events.*)
}}" as="event"> | 298 <template is="dom-repeat" items="{{_eventList(_show_all,_events.*)
}}" as="event"> |
| 283 <tr> | 299 <tr> |
| 284 <td class="message">[[event.message]]</a></td> | 300 <td class="message">[[event.message]]</td> |
| 285 <td>[[event.event_type]]</td> | 301 <td>[[event.event_type]]</td> |
| 286 <td>[[event.human_ts]]</td> | 302 <td>[[event.human_ts]]</td> |
| 287 <td><a target="_blank" href$="[[_taskLink(event.task_id)]]">[[
event.task_id]]</a></td> | 303 <td><a target="_blank" href$="[[_taskLink(event.task_id)]]">[[
event.task_id]]</a></td> |
| 288 <td class$="[[_classVersion(_server_version.bot_version,event.
version)]]"> | 304 <td class$="[[_classVersion(_server_version.bot_version,event.
version)]]"> |
| 289 <a target="_blank" href$="[[_luciLink(event.version)]]">[[_s
horten(event.version,'8')]]</a> | 305 <a target="_blank" href$="[[_luciLink(event.version)]]">[[_s
horten(event.version,'8')]]</a> |
| 290 </td> | 306 </td> |
| 291 </tr> | 307 </tr> |
| 292 </template> | 308 </template> |
| 293 </tbody> | 309 </tbody> |
| 294 </table> | 310 </table> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 305 parse="[[_parseTasks]]"> | 321 parse="[[_parseTasks]]"> |
| 306 </pageable-data> | 322 </pageable-data> |
| 307 <pageable-data | 323 <pageable-data |
| 308 id="page_events" | 324 id="page_events" |
| 309 hidden$="[[_not(_showEvents)]]" | 325 hidden$="[[_not(_showEvents)]]" |
| 310 busy="{{_busy3}}" | 326 busy="{{_busy3}}" |
| 311 label="Show more events" | 327 label="Show more events" |
| 312 output="{{_events}}" | 328 output="{{_events}}" |
| 313 parse="[[_parseEvents]]"> | 329 parse="[[_parseEvents]]"> |
| 314 </pageable-data> | 330 </pageable-data> |
| 315 </div> | 331 </div> <!-- hidden when not signed in--> |
| 316 </swarming-app> | 332 </swarming-app> |
| 317 | 333 |
| 318 <paper-dialog id="prompt" modal on-iron-overlay-closed="_promptClosed"> | 334 <paper-dialog id="prompt" modal on-iron-overlay-closed="_promptClosed"> |
| 319 <h2>Are you sure?</h2> | 335 <h2>Are you sure?</h2> |
| 320 <div>Are you sure you want to [[_dialogPrompt]]?</div> | 336 <div>Are you sure you want to [[_dialogPrompt]]?</div> |
| 321 <div class="buttons"> | 337 <div class="buttons"> |
| 322 <paper-button dialog-dismiss autofocus>No</paper-button> | 338 <paper-button dialog-dismiss autofocus>No</paper-button> |
| 323 <paper-button dialog-confirm>Yes</paper-button> | 339 <paper-button dialog-confirm>Yes</paper-button> |
| 324 </div> | 340 </div> |
| 325 </paper-dialog> | 341 </paper-dialog> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 }, | 549 }, |
| 534 | 550 |
| 535 _toggleState: function() { | 551 _toggleState: function() { |
| 536 this.set("_show_state", !this._show_state); | 552 this.set("_show_state", !this._show_state); |
| 537 } | 553 } |
| 538 | 554 |
| 539 }); | 555 }); |
| 540 })(); | 556 })(); |
| 541 </script> | 557 </script> |
| 542 </dom-module> | 558 </dom-module> |
| OLD | NEW |