| 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 23 matching lines...) Expand all Loading... |
| 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"> | 36 <link rel="import" href="/res/imp/common/error-toast.html"> |
| 37 <link rel="import" href="/res/imp/common/interval-timer.html"> | 37 <link rel="import" href="/res/imp/common/interval-timer.html"> |
| 38 <link rel="import" href="/res/imp/common/single-page-style.html"> | 38 <link rel="import" href="/res/imp/common/single-page-style.html"> |
| 39 <link rel="import" href="/res/imp/common/swarming-app.html"> | 39 <link rel="import" href="/res/imp/common/swarming-app.html"> |
| 40 <link rel="import" href="/res/imp/common/task-behavior.html"> | 40 <link rel="import" href="/res/imp/common/task-behavior.html"> |
| 41 <link rel="import" href="/res/imp/common/url-param.html"> | 41 <link rel="import" href="/res/imp/common/url-param.html"> |
| 42 | 42 |
| 43 <link rel="import" href="task-page-data.html"> | 43 <link rel="import" href="task-page-data.html"> |
| 44 <link rel="import" href="task-disambiguation.html"> |
| 44 | 45 |
| 45 <dom-module id="task-page"> | 46 <dom-module id="task-page"> |
| 46 <template> | 47 <template> |
| 47 <style include="iron-flex iron-flex-alignment swarming-app-style single-page
-style task-style"> | 48 <style include="iron-flex iron-flex-alignment swarming-app-style single-page
-style task-style"> |
| 48 .milo { | 49 .milo { |
| 49 width: calc(100% - 11px); | 50 width: calc(100% - 11px); |
| 50 /** We don't control the milo site and it's on a different domain than | 51 /** We don't control the milo site and it's on a different domain than |
| 51 us, so there's no good way to avoid scrolling other than tell the iframe | 52 us, so there's no good way to avoid scrolling other than tell the iframe |
| 52 it is really tall.*/ | 53 it is really tall.*/ |
| 53 height: 2000px; | 54 height: 2000px; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 .tabbed { | 84 .tabbed { |
| 84 border: 3px solid #1F78B4; | 85 border: 3px solid #1F78B4; |
| 85 margin-left: 5px; | 86 margin-left: 5px; |
| 86 min-height: 80vh; | 87 min-height: 80vh; |
| 87 } | 88 } |
| 88 </style> | 89 </style> |
| 89 | 90 |
| 90 <url-param name="id" | 91 <url-param name="id" |
| 91 value="{{task_id}}"> | 92 value="{{task_id}}"> |
| 92 </url-param> | 93 </url-param> |
| 94 <url-param name="try_detail" |
| 95 value="{{_try_detail}}"> |
| 96 </url-param> |
| 93 <url-param name="request_detail" | 97 <url-param name="request_detail" |
| 94 value="{{_request_detail}}"> | 98 value="{{_request_detail}}"> |
| 95 </url-param> | 99 </url-param> |
| 96 <url-param name="show_raw" | 100 <url-param name="show_raw" |
| 97 value="{{_show_raw}}"> | 101 value="{{_show_raw}}"> |
| 98 </url-param> | 102 </url-param> |
| 99 <url-param name="refresh" | 103 <url-param name="refresh" |
| 100 value="{{_refresh_interval}}" | 104 value="{{_refresh_interval}}" |
| 101 default_value="10"> | 105 default_value="10"> |
| 102 </url-param> | 106 </url-param> |
| 103 | 107 |
| 104 <swarming-app | 108 <swarming-app |
| 105 client_id="[[client_id]]" | 109 client_id="[[client_id]]" |
| 106 auth_headers="{{_auth_headers}}" | 110 auth_headers="{{_auth_headers}}" |
| 107 permissions="{{_permissions}}" | 111 permissions="{{_permissions}}" |
| 108 profile="{{_profile}}" | 112 profile="{{_profile}}" |
| 109 server_details="{{_server_details}}" | 113 server_details="{{_server_details}}" |
| 110 signed_in="{{_signed_in}}" | 114 signed_in="{{_signed_in}}" |
| 111 | 115 |
| 112 busy="[[_busy]]" | 116 busy="[[_or(_busy1,busy2)]]" |
| 113 name="Swarming Task Page"> | 117 name="Swarming Task Page"> |
| 114 | 118 |
| 115 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> | 119 <h2 hidden$="[[_signed_in]]">You must sign in to see anything useful.</h2> |
| 116 | 120 |
| 117 <div hidden$="[[_not(_signed_in)]]"> | 121 <div hidden$="[[_not(_signed_in)]]"> |
| 118 | 122 |
| 119 <task-page-data | 123 <task-page-data |
| 120 id="data" | 124 id="data" |
| 121 auth_headers="[[_auth_headers]]" | 125 auth_headers="[[_auth_headers]]" |
| 122 task_id="[[task_id]]" | 126 task_id="[[task_id]]" |
| 123 | 127 |
| 124 busy="{{_busy}}" | 128 busy="{{_busy1}}" |
| 125 request="{{_request}}" | 129 request="{{_request}}" |
| 126 result="{{_result}}" | 130 result="{{_result}}" |
| 127 stdout="{{_stdout}}" | 131 stdout="{{_stdout}}" |
| 128 task_exists="{{_task_exists}}"> | 132 task_exists="{{_task_exists}}"> |
| 129 </task-page-data> | 133 </task-page-data> |
| 130 | 134 |
| 131 <div class="horizontal layout wrap"> | 135 <div class="horizontal layout wrap"> |
| 132 <div class="left flex"> | 136 <div class="left flex"> |
| 133 <div class="horizontal layout"> | 137 <div class="horizontal layout"> |
| 134 <paper-input class="id_input" label="Task id" value="{{task_id}}">
</paper-input> | 138 <paper-input class="id_input" label="Task id" value="{{task_id}}">
</paper-input> |
| 135 <button on-click="_refresh"> | 139 <button on-click="_refresh"> |
| 136 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> | 140 <iron-icon class="refresh" icon="icons:refresh"></iron-icon> |
| 137 </button> | 141 </button> |
| 138 <button on-click="_promptRetry">Retry</button> | 142 <button on-click="_promptRetry">Retry</button> |
| 139 <template is="dom-if" if="[[_canCancelTask(_result,_permissions)]]
"> | 143 <template is="dom-if" if="[[_canCancelTask(_result,_permissions)]]
"> |
| 140 <button on-click="_promptCancel">Cancel</button> | 144 <button on-click="_promptCancel">Cancel</button> |
| 141 </template> | 145 </template> |
| 142 </div> | 146 </div> |
| 143 <h2 hidden$="[[_task_exists]]">Task not found.</h2> | 147 <h2 hidden$="[[_task_exists]]">Task not found.</h2> |
| 148 |
| 149 <template is="dom-if" if="[[_disambiguate(task_id,_result)]]"> |
| 150 <h2>Displaying a summary for a task with multiple tries</h2> |
| 151 <task-disambiguation |
| 152 busy="{{busy2}}" |
| 153 auth_headers="[[_auth_headers]]" |
| 154 task_id="[[task_id]]" |
| 155 summary_result="[[_result]]"> |
| 156 </task-disambiguation> |
| 157 </template> |
| 158 |
| 144 <table hidden$="[[_not(_task_exists)]]"> | 159 <table hidden$="[[_not(_task_exists)]]"> |
| 145 <tr> | 160 <tr> |
| 146 <td>Name</td> | 161 <td>Name</td> |
| 147 <td>[[_request.name]]</td> | 162 <td>[[_request.name]]</td> |
| 148 </tr> | 163 </tr> |
| 149 <tr> | 164 <tr> |
| 150 <td>State</td> | 165 <td>State</td> |
| 151 <td class$="[[_stateClass(_result)]]">[[_state(_result)]]</td> | 166 <td class$="[[_stateClass(_result)]]">[[state(_result)]]</td> |
| 152 </tr> | 167 </tr> |
| 153 <tr> | 168 <tr> |
| 154 <td>Created</td> | 169 <td>Created</td> |
| 155 <td title$="[[_request.created_ts]]">[[_request.human_created_ts
]]</td> | 170 <td title$="[[_request.created_ts]]">[[_request.human_created_ts
]]</td> |
| 156 </tr> | 171 </tr> |
| 157 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> | 172 <template is="dom-if" if="[[_wasPickedUp(_result)]]"> |
| 158 <tr> | 173 <tr> |
| 159 <td>Started</td> | 174 <td>Started</td> |
| 160 <td title$="[[_result.started_ts]]">[[_result.human_started_ts
]]</td> | 175 <td title$="[[_result.started_ts]]">[[_result.human_started_ts
]]</td> |
| 161 </tr> | 176 </tr> |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 value="{{_refresh_interval}}" | 467 value="{{_refresh_interval}}" |
| 453 title="How often to refresh all information about the task" | 468 title="How often to refresh all information about the task" |
| 454 auto-validate | 469 auto-validate |
| 455 min="1" | 470 min="1" |
| 456 max="1000" | 471 max="1000" |
| 457 pattern="[0-9]+"> | 472 pattern="[0-9]+"> |
| 458 </paper-input> | 473 </paper-input> |
| 459 </div> | 474 </div> |
| 460 | 475 |
| 461 <template is="dom-if" if="[[_supportsMilo(_request,_show_raw)]]"> | 476 <template is="dom-if" if="[[_supportsMilo(_request,_show_raw)]]"> |
| 477 <div class="milo tabbed" hidden$="[[_isSummaryLink(task_id)]]"> |
| 478 Milo results are only generated for task summaires, that is, tas
ks whose ids end in 0. Tasks ending in 1 or 2 represent possible retries of tas
ks. See <a href="//goo.gl/LE4rwV">the docs</a> for more. |
| 479 </div> |
| 462 <iframe id="miloFrame" class="milo tabbed" src$="[[_getDisplayServ
erLink(_server_details.display_server_url_template,task_id)]]"></iframe> | 480 <iframe id="miloFrame" class="milo tabbed" src$="[[_getDisplayServ
erLink(_server_details.display_server_url_template,task_id)]]"></iframe> |
| 463 </template> | 481 </template> |
| 464 <template is="dom-if" if="[[_show_raw]]"> | 482 <template is="dom-if" if="[[_show_raw]]"> |
| 465 <div class="code stdout tabbed">[[_stdout]]</div> | 483 <div class="code stdout tabbed">[[_stdout]]</div> |
| 466 </template> | 484 </template> |
| 467 </div> | 485 </div> |
| 468 </div> | 486 </div> |
| 469 </div> | 487 </div> |
| 470 </swarming-app> | 488 </swarming-app> |
| 471 | 489 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 p.requested = p.package_name + ":" + p.version; | 598 p.requested = p.package_name + ":" + p.version; |
| 581 actual.forEach(function(c) { | 599 actual.forEach(function(c) { |
| 582 if (c.path === p.path) { | 600 if (c.path === p.path) { |
| 583 p.actual = c.package_name + ":" + c.version; | 601 p.actual = c.package_name + ":" + c.version; |
| 584 } | 602 } |
| 585 }); | 603 }); |
| 586 }); | 604 }); |
| 587 return packages; | 605 return packages; |
| 588 }, | 606 }, |
| 589 | 607 |
| 608 _disambiguate: function(taskId, result) { |
| 609 if (!taskId.endsWith("0") || !result) { |
| 610 return false; |
| 611 } |
| 612 return result.try_number > 1; |
| 613 }, |
| 614 |
| 590 _expires: function(request) { | 615 _expires: function(request) { |
| 591 var delta = parseInt(request.expiration_secs); | 616 var delta = parseInt(request.expiration_secs); |
| 592 if (delta) { | 617 if (delta) { |
| 593 return sk.human.localeTime(new Date(request.created_ts.getTime() + del
ta * 1000)); | 618 return sk.human.localeTime(new Date(request.created_ts.getTime() + del
ta * 1000)); |
| 594 } | 619 } |
| 595 // Fall back to something | 620 // Fall back to something |
| 596 return request.expiration_secs + " seconds from created time"; | 621 return request.expiration_secs + " seconds from created time"; |
| 597 }, | 622 }, |
| 598 | 623 |
| 599 _extraArgs: function(request) { | 624 _extraArgs: function(request) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 626 }, | 651 }, |
| 627 | 652 |
| 628 _isolateLink: function(ref) { | 653 _isolateLink: function(ref) { |
| 629 if (!ref || !ref.isolatedserver) { | 654 if (!ref || !ref.isolatedserver) { |
| 630 return undefined; | 655 return undefined; |
| 631 } | 656 } |
| 632 return ref.isolatedserver + "/browse?namespace="+ref.namespace + | 657 return ref.isolatedserver + "/browse?namespace="+ref.namespace + |
| 633 "&hash=" + ref.isolated; | 658 "&hash=" + ref.isolated; |
| 634 }, | 659 }, |
| 635 | 660 |
| 661 _isSummaryLink: function(taskId) { |
| 662 return taskId && taskId.endsWith(0); |
| 663 }, |
| 664 |
| 636 _noMilo: function(result) { | 665 _noMilo: function(result) { |
| 637 return !this._tag(result, "allow_milo"); | 666 return !this._tag(result, "allow_milo"); |
| 638 }, | 667 }, |
| 639 | 668 |
| 640 _pending: function(result) { | 669 _pending: function(result) { |
| 641 if (!result.created_ts) { | 670 if (!result.created_ts) { |
| 642 return ""; | 671 return ""; |
| 643 } | 672 } |
| 644 var end = result.started_ts || result.abandoned_ts || new Date(); | 673 var end = result.started_ts || result.abandoned_ts || new Date(); |
| 645 // In the case of deduplicated tasks, started_ts comes before the task. | 674 // In the case of deduplicated tasks, started_ts comes before the task. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 }, | 754 }, |
| 726 | 755 |
| 727 _empty: function(array) { | 756 _empty: function(array) { |
| 728 return !array || array.length == 0; | 757 return !array || array.length == 0; |
| 729 }, | 758 }, |
| 730 | 759 |
| 731 _supportsMilo: function(request, showRaw) { | 760 _supportsMilo: function(request, showRaw) { |
| 732 return !showRaw && request && this._tag(request, "allow_milo"); | 761 return !showRaw && request && this._tag(request, "allow_milo"); |
| 733 }, | 762 }, |
| 734 | 763 |
| 735 _state: function(result) { | |
| 736 if (!result) { | |
| 737 return ""; | |
| 738 } | |
| 739 if (result.state === this.COMPLETED) { | |
| 740 if (result.failure) { | |
| 741 return this.COMPLETED_FAILURE; | |
| 742 } | |
| 743 if (result.try_number === "0") { | |
| 744 return this.COMPLETED_DEDUPED; | |
| 745 } | |
| 746 return this.COMPLETED_SUCCESS; | |
| 747 } | |
| 748 return result.state; | |
| 749 }, | |
| 750 | 764 |
| 751 _stateClass: function(result) { | |
| 752 return this.stateClass(this._state(result)); | |
| 753 }, | |
| 754 | 765 |
| 755 _toggleDetails: function() { | 766 _toggleDetails: function() { |
| 756 this.set("_request_detail", !this._request_detail); | 767 this.set("_request_detail", !this._request_detail); |
| 757 }, | 768 }, |
| 758 | 769 |
| 759 _tag: function(result, col) { | 770 _tag: function(result, col) { |
| 760 if (!result || !result.tagMap) { | 771 if (!result || !result.tagMap) { |
| 761 return undefined; | 772 return undefined; |
| 762 } | 773 } |
| 763 return result.tagMap[col]; | 774 return result.tagMap[col]; |
| 764 }, | 775 }, |
| 765 | 776 |
| 766 _wasPickedUp: function(result) { | 777 _wasPickedUp: function(result) { |
| 767 return result && result.state !== this.PENDING && result.state !== this.
CANCELED && result.state != this.EXPIRED; | 778 return result && result.state !== this.PENDING && result.state !== this.
CANCELED && result.state != this.EXPIRED; |
| 768 }, | 779 }, |
| 769 | 780 |
| 770 _wasNotPickedUp: function(result) { | 781 _wasNotPickedUp: function(result) { |
| 771 return result && !this._wasPickedUp(result); | 782 return result && !this._wasPickedUp(result); |
| 772 }, | 783 }, |
| 773 }); | 784 }); |
| 774 })(); | 785 })(); |
| 775 </script> | 786 </script> |
| 776 </dom-module> | 787 </dom-module> |
| OLD | NEW |