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 <task-page> | 9 <task-page> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 <link rel="import" href="/res/imp/bower_components/iron-icon/iron-icon.html"> | 27 <link rel="import" href="/res/imp/bower_components/iron-icon/iron-icon.html"> |
| 28 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> | 28 <link rel="import" href="/res/imp/bower_components/iron-icons/iron-icons.html"> |
| 29 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l"> | 29 <link rel="import" href="/res/imp/bower_components/paper-button/paper-button.htm l"> |
| 30 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l"> | 30 <link rel="import" href="/res/imp/bower_components/paper-dialog/paper-dialog.htm l"> |
| 31 <link rel="import" href="/res/imp/bower_components/paper-input/paper-input.html" > | 31 <link rel="import" href="/res/imp/bower_components/paper-input/paper-input.html" > |
| 32 <link rel="import" href="/res/imp/bower_components/paper-tabs/paper-tabs.html"> | 32 <link rel="import" href="/res/imp/bower_components/paper-tabs/paper-tabs.html"> |
| 33 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> | 33 <link rel="import" href="/res/imp/bower_components/polymer/polymer.html"> |
| 34 | 34 |
| 35 <link rel="import" href="/res/imp/common/common-behavior.html"> | 35 <link rel="import" href="/res/imp/common/common-behavior.html"> |
| 36 <link rel="import" href="/res/imp/common/error-toast.html"> | |
| 37 <link rel="import" href="/res/imp/common/interval-timer.html"> | |
| 36 <link rel="import" href="/res/imp/common/single-page-style.html"> | 38 <link rel="import" href="/res/imp/common/single-page-style.html"> |
| 37 <link rel="import" href="/res/imp/common/swarming-app.html"> | 39 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 38 <link rel="import" href="/res/imp/common/task-behavior.html"> | 40 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 39 <link rel="import" href="/res/imp/common/url-param.html"> | 41 <link rel="import" href="/res/imp/common/url-param.html"> |
| 40 | 42 |
| 41 <link rel="import" href="task-page-data.html"> | 43 <link rel="import" href="task-page-data.html"> |
| 42 | 44 |
| 43 <dom-module id="task-page"> | 45 <dom-module id="task-page"> |
| 44 <template> | 46 <template> |
| 45 <style include="iron-flex iron-flex-alignment swarming-app-style single-page -style task-style"> | 47 <style include="iron-flex iron-flex-alignment swarming-app-style single-page -style task-style"> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 <url-param name="id" | 90 <url-param name="id" |
| 89 value="{{task_id}}"> | 91 value="{{task_id}}"> |
| 90 </url-param> | 92 </url-param> |
| 91 <url-param name="request_detail" | 93 <url-param name="request_detail" |
| 92 value="{{_request_detail}}"> | 94 value="{{_request_detail}}"> |
| 93 </url-param> | 95 </url-param> |
| 94 <url-param name="show_raw" | 96 <url-param name="show_raw" |
| 95 value="{{_show_raw}}"> | 97 value="{{_show_raw}}"> |
| 96 </url-param> | 98 </url-param> |
| 97 <url-param name="refresh" | 99 <url-param name="refresh" |
| 98 value="{{_refresh}}" | 100 value="{{_refresh_interval}}" |
| 99 default_value="10"> | 101 default_value="10"> |
| 100 </url-param> | 102 </url-param> |
| 101 | 103 |
| 102 <swarming-app | 104 <swarming-app |
| 103 client_id="[[client_id]]" | 105 client_id="[[client_id]]" |
| 104 auth_headers="{{_auth_headers}}" | 106 auth_headers="{{_auth_headers}}" |
| 107 permissions="{{_permissions}}" | |
| 108 profile="{{_profile}}" | |
| 105 signed_in="{{_signed_in}}" | 109 signed_in="{{_signed_in}}" |
| 106 | 110 |
| 107 busy="[[_busy]]" | 111 busy="[[_busy]]" |
| 108 name="Swarming Task Page"> | 112 name="Swarming Task Page"> |
| 109 | 113 |
| 110 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 114 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 111 | 115 |
| 112 <div hidden$="[[_not(_signed_in)]]"> | 116 <div hidden$="[[_not(_signed_in)]]"> |
| 113 | 117 |
| 114 <task-page-data | 118 <task-page-data |
| 119 id="data" | |
| 115 auth_headers="[[_auth_headers]]" | 120 auth_headers="[[_auth_headers]]" |
| 121 refresh_interval="[[_refresh_interval]]" | |
| 116 task_id="[[task_id]]" | 122 task_id="[[task_id]]" |
| 117 | 123 |
| 118 busy="{{_busy}}" | 124 busy="{{_busy}}" |
| 119 request="{{_request}}" | 125 request="{{_request}}" |
| 120 result="{{_result}}" | 126 result="{{_result}}" |
| 121 stdout="{{_stdout}}"> | 127 stdout="{{_stdout}}"> |
| 122 </task-page-data> | 128 </task-page-data> |
| 123 | 129 |
| 124 <div class="horizontal layout wrap"> | 130 <div class="horizontal layout wrap"> |
| 125 <div class="left flex"> | 131 <div class="left flex"> |
| 126 <div class="horizontal layout"> | 132 <div class="horizontal layout"> |
| 127 <paper-input class="id_input" label="Task id" value="{{task_id}}"> </paper-input> | 133 <paper-input class="id_input" label="Task id" value="{{task_id}}"> </paper-input> |
| 128 <button on-click="_refresh"> | 134 <button on-click="_refresh"> |
| 129 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> | 135 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> |
| 130 </button> | 136 </button> |
| 131 <button on-click="_retry"><span>Retry</span></button> | 137 <button on-click="_promptRetry">Retry</button> |
| 132 <button on-click="_cancel">Cancel</button> | 138 <template is="dom-if" if="[[_canCancelTask(_result,_permissions)]] "> |
| 139 <button on-click="_promptCancel">Cancel</button> | |
| 140 </template> | |
| 133 </div> | 141 </div> |
| 134 <table> | 142 <table> |
| 135 <tr> | 143 <tr> |
| 136 <td>Name</td> | 144 <td>Name</td> |
| 137 <td>[[_request.name]]</td> | 145 <td>[[_request.name]]</td> |
| 138 </tr> | 146 </tr> |
| 139 <tr> | 147 <tr> |
| 140 <td>State</td> | 148 <td>State</td> |
| 141 <td class$="[[_stateClass(_result)]]">[[_state(_result)]]</td> | 149 <td class$="[[_stateClass(_result)]]">[[_state(_result)]]</td> |
| 142 </tr> | 150 </tr> |
| 143 <tr> | 151 <tr> |
| 144 <td>Created</td> | 152 <td>Created</td> |
| 145 <td>[[_request.human_created_ts]]</td> | 153 <td title$="[[_request.created_ts]]">[[_request.human_created_ts ]]</td> |
| 146 </tr> | 154 </tr> |
| 147 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> | 155 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> |
| 148 <tr> | 156 <tr> |
| 149 <td>Started</td> | 157 <td>Started</td> |
| 150 <td>[[_result.human_started_ts]]</td> | 158 <td title$="[[_result.started_ts]]">[[_result.human_started_ts ]]</td> |
| 151 </tr> | 159 </tr> |
| 152 </template> | 160 </template> |
| 153 <template is="dom-if" if="[[_wasNotPickedUp(_result)]]"> | 161 <template is="dom-if" if="[[_wasNotPickedUp(_result)]]"> |
| 154 <tr> | 162 <tr> |
| 155 <td>Expires</td> | 163 <td>Expires</td> |
| 156 <td>[[_expires(_request)]]</td> | 164 <td>[[_expires(_request)]]</td> |
| 157 </tr> | 165 </tr> |
| 158 </template> | 166 </template> |
| 159 <template is="dom-if" if="[[_result.human_completed_ts]]"> | 167 <template is="dom-if" if="[[_result.human_completed_ts]]"> |
| 160 <tr> | 168 <tr> |
| 161 <td>Completed</td> | 169 <td>Completed</td> |
| 162 <td>[[_result.human_completed_ts]]</td> | 170 <td title$="[[_result.completed_ts]]">[[_result.human_complete d_ts]]</td> |
| 163 </tr> | 171 </tr> |
| 164 </template> | 172 </template> |
| 165 <template is="dom-if" if="[[_result.human_abandoned_ts]]"> | 173 <template is="dom-if" if="[[_result.human_abandoned_ts]]"> |
| 166 <tr> | 174 <tr> |
| 167 <td>Abandoned</td> | 175 <td>Abandoned</td> |
| 168 <td>[[_result.human_abandoned_ts]]</td> | 176 <td title$="[[_result.abandoned_ts]]">[[_result.human_abandone d_ts]]</td> |
| 169 </tr> | 177 </tr> |
| 170 </template> | 178 </template> |
| 171 <tr> | 179 <tr> |
| 172 <td>Last Updated</td> | 180 <td>Last Updated</td> |
| 173 <td>[[_result.human_modified_ts]]</td> | 181 <td title$="[[_result.modified_ts]]">[[_result.human_modified_ts ]]</td> |
| 174 </tr> | 182 </tr> |
| 175 <template is="dom-if" if="[[_result.deduped_from]]"> | 183 <template is="dom-if" if="[[_result.deduped_from]]"> |
| 176 <tr> | 184 <tr> |
| 177 <td><b>Deduped from</b></td> | 185 <td><b>Deduped from</b></td> |
| 178 <td> | 186 <td> |
| 179 <a href$="[[_taskLink(_result.deduped_from)]]"> | 187 <a href$="[[_taskLink(_result.deduped_from)]]"> |
| 180 [[_result.deduped_from]] | 188 [[_result.deduped_from]] |
| 181 </a> | 189 </a> |
| 182 </td> | 190 </td> |
| 183 </tr> | 191 </tr> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 </template> | 224 </template> |
| 217 <template is="dom-if" if="[[_request.parent_task_id]]"> | 225 <template is="dom-if" if="[[_request.parent_task_id]]"> |
| 218 <tr> | 226 <tr> |
| 219 <td>Parent Task</td> | 227 <td>Parent Task</td> |
| 220 <td> | 228 <td> |
| 221 <a href$="[[_taskLink(_request.parent_task_id)]]">[[_request .parent_task_id]]</a> | 229 <a href$="[[_taskLink(_request.parent_task_id)]]">[[_request .parent_task_id]]</a> |
| 222 </td> | 230 </td> |
| 223 </tr> | 231 </tr> |
| 224 </template> | 232 </template> |
| 225 <tr> | 233 <tr> |
| 226 <td rowspan$="[[_rowspan(_request.properties.dimensions)]]">Requ ested Dimensions</td> | 234 <td rowspan$="[[_rowspan(_request.properties.dimensions)]]"> |
| 235 <a | |
| 236 title="The list of bots that matches the list of dimension s" | |
| 237 href$="[[_botListLink(_request.properties.dimensions)]]"> | |
| 238 Requested Dimensions | |
| 239 </a> | |
| 240 </td> | |
| 227 </tr> | 241 </tr> |
| 228 <template is="dom-repeat" items="{{_request.properties.dimensions} }" as="dimension"> | 242 <template is="dom-repeat" items="{{_request.properties.dimensions} }" as="dimension"> |
| 229 <tr> | 243 <tr> |
| 230 <td><b>[[dimension.key]]:</b> [[dimension.value]]</td> | 244 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> |
| 231 </tr> | 245 </tr> |
| 232 </template> | 246 </template> |
| 233 <tr> | 247 <tr> |
| 234 <td>Isolated Inputs</td> | 248 <td>Isolated Inputs</td> |
| 235 <td> | 249 <td> |
| 236 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]"> | 250 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]"> |
| 237 [[_request.properties.inputs_ref.isolated]] | 251 [[_request.properties.inputs_ref.isolated]] |
| 238 </a> | 252 </a> |
| 239 </td> | 253 </td> |
| 240 </tr> | 254 </tr> |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 </table> | 336 </table> |
| 323 | 337 |
| 324 <div class="title">Task Execution</div> | 338 <div class="title">Task Execution</div> |
| 325 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> | 339 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> |
| 326 <table> | 340 <table> |
| 327 <tr> | 341 <tr> |
| 328 <td>Bot assigned to task</td> | 342 <td>Bot assigned to task</td> |
| 329 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> | 343 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> |
| 330 </tr> | 344 </tr> |
| 331 <tr> | 345 <tr> |
| 332 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]">Bot Dimens ions</td> | 346 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]"> |
| 347 <a>Bot Dimensions</a> | |
| 348 </td> | |
| 333 </tr> | 349 </tr> |
| 334 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension"> | 350 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension"> |
| 335 <tr> | 351 <tr> |
| 336 <td><b>[[dimension.key]]:</b> [[_join(dimension.value," | ") ]]</td> | 352 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> |
| 337 </tr> | 353 </tr> |
| 338 </template> | 354 </template> |
| 339 | 355 |
| 340 <tr> | 356 <tr> |
| 341 <td>Exit code</td> | 357 <td>Exit code</td> |
| 342 <td>[[_result.exit_code]]</td> | 358 <td>[[_result.exit_code]]</td> |
| 343 </tr> | 359 </tr> |
| 344 <tr> | 360 <tr> |
| 345 <td>Try number</td> | 361 <td>Try number</td> |
| 346 <td>[[_result.try_number]]</td> | 362 <td>[[_result.try_number]]</td> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 <div class="tabs"> | 420 <div class="tabs"> |
| 405 <paper-tabs selected="{{_show_raw}}" no-bar> | 421 <paper-tabs selected="{{_show_raw}}" no-bar> |
| 406 <paper-tab disabled$="[[_noMilo(_request)]]">Milo Output</pape r-tab> | 422 <paper-tab disabled$="[[_noMilo(_request)]]">Milo Output</pape r-tab> |
| 407 <paper-tab>Raw Output</paper-tab> | 423 <paper-tab>Raw Output</paper-tab> |
| 408 </paper-tabs> | 424 </paper-tabs> |
| 409 </div> | 425 </div> |
| 410 | 426 |
| 411 <paper-input | 427 <paper-input |
| 412 class="refresh_input" | 428 class="refresh_input" |
| 413 label="Refresh Interval (seconds)" | 429 label="Refresh Interval (seconds)" |
| 414 value="{{_refresh}}" | 430 value="{{_refresh_interval}}" |
| 415 auto-validate | 431 auto-validate |
| 416 min="1" | 432 min="1" |
| 417 max="1000" | 433 max="1000" |
| 418 pattern="[0-9]+"> | 434 pattern="[0-9]+"> |
| 419 </paper-input> | 435 </paper-input> |
| 420 </div> | 436 </div> |
| 421 | 437 |
| 422 <template is="dom-if" if="[[_supportsMilo(_request,_show_raw)]]"> | 438 <template is="dom-if" if="[[_supportsMilo(_request,_show_raw)]]"> |
| 423 <iframe id="miloFrame" class="milo tabbed" src$="[[_getMiloLink(mi lo_prefix,task_id)]]"></iframe> | 439 <iframe id="miloFrame" class="milo tabbed" src$="[[_getMiloLink(mi lo_prefix,task_id)]]"></iframe> |
| 424 </template> | 440 </template> |
| 425 <template is="dom-if" if="[[_show_raw]]"> | 441 <template is="dom-if" if="[[_show_raw]]"> |
| 426 <div class="code stdout tabbed">[[_stdout]]</div> | 442 <div class="code stdout tabbed">[[_stdout]]</div> |
| 427 </template> | 443 </template> |
| 428 </div> | 444 </div> |
| 429 </div> | 445 </div> |
| 430 </div> | 446 </div> |
| 447 </swarming-app> | |
| 431 | 448 |
| 432 </swarming-app> | 449 <paper-dialog id="prompt" modal on-iron-overlay-closed="_promptClosed"> |
| 450 <h2>Are you sure?</h2> | |
| 451 <div>Are you sure you want to [[_dialogPrompt]]?</div> | |
| 452 <div class="buttons"> | |
| 453 <paper-button dialog-dismiss autofocus>No</paper-button> | |
| 454 <paper-button dialog-confirm>Yes</paper-button> | |
| 455 </div> | |
| 456 </paper-dialog> | |
| 457 | |
| 458 <error-toast></error-toast> | |
| 459 | |
| 460 <interval-timer period="[[_refresh_interval]]" on-trigger="_refreshOutput"> | |
| 461 </interval-timer> | |
| 433 | 462 |
| 434 </template> | 463 </template> |
| 435 <script> | 464 <script> |
| 436 (function(){ | 465 (function(){ |
| 437 Polymer({ | 466 Polymer({ |
| 438 is: 'task-page', | 467 is: 'task-page', |
| 439 | 468 |
| 440 behaviors: [ | 469 behaviors: [ |
| 441 SwarmingBehaviors.CommonBehavior, | 470 SwarmingBehaviors.CommonBehavior, |
| 442 SwarmingBehaviors.TaskBehavior, | 471 SwarmingBehaviors.TaskBehavior, |
| 443 ], | 472 ], |
| 444 | 473 |
| 445 properties: { | 474 properties: { |
| 446 task_id: { | 475 task_id: { |
| 447 type: String, | 476 type: String, |
| 448 }, | 477 }, |
| 449 client_id: { | 478 client_id: { |
| 450 type: String, | 479 type: String, |
| 451 }, | 480 }, |
| 452 milo_prefix: { | 481 milo_prefix: { |
| 453 type: String, | 482 type: String, |
| 454 }, | 483 }, |
| 455 | 484 |
| 485 | |
| 486 _dialogPrompt: { | |
| 487 type: String, | |
| 488 value: "", | |
| 489 }, | |
| 490 _refresh_interval: { | |
| 491 type: Number, | |
| 492 }, | |
| 456 _request: { | 493 _request: { |
| 457 type: Object, | 494 type: Object, |
| 458 observer: "_requestUpdated" | 495 observer: "_requestUpdated" |
| 459 }, | 496 }, |
| 460 _request_detail: { | 497 _request_detail: { |
| 461 type: Boolean, | 498 type: Boolean, |
| 499 }, | |
| 500 _result: { | |
| 501 type: Object, | |
| 502 }, | |
| 503 _stdout: { | |
| 504 type: String, | |
| 462 } | 505 } |
| 463 }, | 506 }, |
| 464 | 507 |
| 508 _alias: function(dim) { | |
| 509 var values = dim.value; | |
| 510 if (!Array.isArray(values)) { | |
| 511 values = [values]; | |
| 512 } | |
| 513 if (swarming.alias.has(dim.key)) { | |
| 514 | |
|
jcgregorio
2016/09/21 14:22:03
No blank line.
kjlubick
2016/09/21 14:51:38
Done.
| |
| 515 values.forEach(function(v, i){ | |
| 516 values[i] = swarming.alias.apply(v, dim.key); | |
| 517 }); | |
| 518 } | |
| 519 return values.join(" | "); | |
| 520 }, | |
| 521 | |
| 465 _bytes: function(sizeInBytes) { | 522 _bytes: function(sizeInBytes) { |
| 466 return sk.human.bytes(sizeInBytes); | 523 return sk.human.bytes(sizeInBytes); |
| 467 }, | 524 }, |
| 468 | 525 |
| 526 _canCancelTask: function(result, permissions) { | |
| 527 return result && result.state === "PENDING" && permissions.cancel_task; | |
| 528 }, | |
| 529 | |
| 530 _cancelTask: function() { | |
| 531 var url = "/_ah/api/swarming/v1/task/" + this.task_id +"/cancel"; | |
| 532 swarming.postWithToast(url, "Canceling task " + this.task_id, this._auth _headers); | |
| 533 }, | |
| 534 | |
| 469 _cipdRowspan: function(request, result) { | 535 _cipdRowspan: function(request, result) { |
| 470 if (!request || !request.properties || !request.properties.cipd_input) { | 536 if (!request || !request.properties || !request.properties.cipd_input) { |
| 471 return 0; | 537 return 0; |
| 472 } | 538 } |
| 473 // We always need to at least double the number of packages because we | 539 // We always need to at least double the number of packages because we |
| 474 // show the path and then the requested. If the actual package info | 540 // show the path and then the requested. If the actual package info |
| 475 // is available, we triple the number of packages to account for that. | 541 // is available, we triple the number of packages to account for that. |
| 476 var rowSpan = (request.properties.cipd_input.packages || []).length; | 542 var rowSpan = (request.properties.cipd_input.packages || []).length; |
| 477 if (result && result.cipd_pins && result.cipd_pins.packages) { | 543 if (result && result.cipd_pins && result.cipd_pins.packages) { |
| 478 rowSpan *= 3; | 544 rowSpan *= 3; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 539 }, | 605 }, |
| 540 | 606 |
| 541 _isolateLink: function(ref) { | 607 _isolateLink: function(ref) { |
| 542 if (!ref || !ref.isolatedserver) { | 608 if (!ref || !ref.isolatedserver) { |
| 543 return undefined; | 609 return undefined; |
| 544 } | 610 } |
| 545 return ref.isolatedserver + "/browse?namespace="+ref.namespace + | 611 return ref.isolatedserver + "/browse?namespace="+ref.namespace + |
| 546 "&hash=" + ref.isolated; | 612 "&hash=" + ref.isolated; |
| 547 }, | 613 }, |
| 548 | 614 |
| 549 _join: function(arr, s) { | |
| 550 arr = arr || []; | |
| 551 return arr.join(s); | |
| 552 }, | |
| 553 | |
| 554 _noMilo: function(result) { | 615 _noMilo: function(result) { |
| 555 return !this._tag(result, "allow_milo"); | 616 return !this._tag(result, "allow_milo"); |
| 556 }, | 617 }, |
| 557 | 618 |
| 558 _pending: function(result) { | 619 _pending: function(result) { |
| 559 if (!result.created_ts) { | 620 if (!result.created_ts) { |
| 560 return ""; | 621 return ""; |
| 561 } | 622 } |
| 562 var end = result.started_ts || result.abandoned_ts || new Date(); | 623 var end = result.started_ts || result.abandoned_ts || new Date(); |
| 563 // In the case of deduplicated tasks, started_ts comes before the task. | 624 // In the case of deduplicated tasks, started_ts comes before the task. |
| 564 if (end <= result.created_ts) { | 625 if (end <= result.created_ts) { |
| 565 return "0s"; | 626 return "0s"; |
| 566 } | 627 } |
| 567 return this._timeDiffExact(result.created_ts, end); | 628 return this._timeDiffExact(result.created_ts, end); |
| 568 }, | 629 }, |
| 569 | 630 |
| 631 _promptClosed: function(e) { | |
| 632 if (e.detail.confirmed) { | |
| 633 if (this._dialogPrompt.startsWith("cancel")) { | |
| 634 this._cancelTask(); | |
| 635 } else { | |
| 636 this._retryTask(); | |
| 637 } | |
| 638 } | |
| 639 }, | |
| 640 | |
| 641 _promptCancel: function() { | |
| 642 this.set("_dialogPrompt", "cancel task "+this.task_id); | |
| 643 this.$.prompt.open(); | |
| 644 }, | |
| 645 | |
| 646 _promptRetry: function() { | |
| 647 this.set("_dialogPrompt", "retry task "+this.task_id); | |
| 648 this.$.prompt.open(); | |
| 649 }, | |
| 650 | |
| 651 _refresh: function() { | |
| 652 this.$.data.reload(); | |
| 653 }, | |
| 654 | |
| 655 _refreshOutput: function() { | |
| 656 this.$.data.reloadStdout(); | |
| 657 var miloFrame = this.$$("iframe") | |
| 658 if (miloFrame) { | |
| 659 miloFrame.src = this._getMiloLink(this.milo_prefix,this.task_id); | |
| 660 } | |
| 661 }, | |
| 662 | |
| 570 _requestUpdated: function(request) { | 663 _requestUpdated: function(request) { |
| 571 if (this._noMilo(request)) { | 664 if (this._noMilo(request)) { |
| 572 this.set("_show_raw", 1); | 665 this.set("_show_raw", 1); |
| 573 } | 666 } |
| 574 }, | 667 }, |
| 575 | 668 |
| 669 _retryTask: function() { | |
| 670 if (!this._request) { | |
| 671 sk.errorMessage("Task not yet loaded", 3000); | |
| 672 return; | |
| 673 } | |
| 674 var newTask = { | |
| 675 expiration_secs: this._request.expiration_secs, | |
| 676 name: this._request.name +" (retry)", | |
| 677 parent_task_id: this._request.parent_task_id, | |
| 678 priority: this._request.priority, | |
| 679 properties:this._request.properties, | |
| 680 tags: this._request.tags, | |
| 681 user: this._profile.email, | |
| 682 service_account: this._request.service_account, | |
| 683 } | |
| 684 swarming.postWithToast("/_ah/api/swarming/v1/tasks/new", "Retrying task " + this.task_id, | |
| 685 this._auth_headers, newTask).then(function(response) { | |
|
jcgregorio
2016/09/21 14:22:03
The value of 'response' will the error message ret
kjlubick
2016/09/21 14:51:38
Fixed.
| |
| 686 response = JSON.parse(response); | |
| 687 if (response && response.task_id) { | |
| 688 this.set("task_id", response.task_id); | |
| 689 } | |
| 690 }.bind(this)); | |
| 691 }, | |
| 692 | |
| 576 _rowspan: function(dims) { | 693 _rowspan: function(dims) { |
| 577 dims = dims || []; | 694 dims = dims || []; |
| 578 return dims.length + 1; | 695 return dims.length + 1; |
| 579 }, | 696 }, |
| 580 | 697 |
| 581 _supportsMilo: function(request, showRaw) { | 698 _supportsMilo: function(request, showRaw) { |
| 582 return !showRaw && request && this._tag(request, "allow_milo"); | 699 return !showRaw && request && this._tag(request, "allow_milo"); |
| 583 }, | 700 }, |
| 584 | 701 |
| 585 _state: function(result) { | 702 _state: function(result) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 617 return result && result.state !== this.PENDING && result.state !== this. CANCELED && result.state != this.EXPIRED; | 734 return result && result.state !== this.PENDING && result.state !== this. CANCELED && result.state != this.EXPIRED; |
| 618 }, | 735 }, |
| 619 | 736 |
| 620 _wasNotPickedUp: function(result) { | 737 _wasNotPickedUp: function(result) { |
| 621 return result && !this._wasPickedUp(result); | 738 return result && !this._wasPickedUp(result); |
| 622 }, | 739 }, |
| 623 }); | 740 }); |
| 624 })(); | 741 })(); |
| 625 </script> | 742 </script> |
| 626 </dom-module> | 743 </dom-module> |
| OLD | NEW |