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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 } | 56 } |
| 57 | 57 |
| 58 .right { | 58 .right { |
| 59 margin-top: 8px; | 59 margin-top: 8px; |
| 60 } | 60 } |
| 61 | 61 |
| 62 .break-all { | 62 .break-all { |
| 63 word-break: break-all; | 63 word-break: break-all; |
| 64 } | 64 } |
| 65 | 65 |
| 66 .bolded { | |
| 67 font-weight: bold; | |
| 68 } | |
| 69 | |
| 66 .expand { | 70 .expand { |
| 67 min-width: 3em; | 71 min-width: 3em; |
| 68 vertical-align: middle; | 72 vertical-align: middle; |
| 69 padding: .5em; | 73 padding: .5em; |
| 70 } | 74 } |
| 71 | 75 |
| 72 .code { | 76 .code { |
| 73 font-family: monospace; | 77 font-family: monospace; |
| 74 } | 78 } |
| 75 | 79 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 335 <a | 339 <a |
| 336 title="The list of bots that matches the list of dimensi ons" | 340 title="The list of bots that matches the list of dimensi ons" |
| 337 href$="[[_botListLink(_request.properties.dimensions)]]" >Bots</a> | 341 href$="[[_botListLink(_request.properties.dimensions)]]" >Bots</a> |
| 338 <a | 342 <a |
| 339 title="The list of tasks that matches the list of dimens ions" | 343 title="The list of tasks that matches the list of dimens ions" |
| 340 href$="[[_taskListLink(_request.properties.dimensions)]] ">Tasks</a> | 344 href$="[[_taskListLink(_request.properties.dimensions)]] ">Tasks</a> |
| 341 </td> | 345 </td> |
| 342 </tr> | 346 </tr> |
| 343 <template is="dom-repeat" items="{{_request.properties.dimension s}}" as="dimension"> | 347 <template is="dom-repeat" items="{{_request.properties.dimension s}}" as="dimension"> |
| 344 <tr> | 348 <tr> |
| 345 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> | 349 <td><b>[[dimension.key]]:</b> [[_aliasRequest(dimension)]]</ td> |
| 346 </tr> | 350 </tr> |
| 347 </template> | 351 </template> |
| 348 <tr> | 352 <tr> |
| 349 <td>Isolated Inputs</td> | 353 <td>Isolated Inputs</td> |
| 350 <td> | 354 <td> |
| 351 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]"> | 355 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]"> |
| 352 [[_request.properties.inputs_ref.isolated]] | 356 [[_request.properties.inputs_ref.isolated]] |
| 353 </a> | 357 </a> |
| 354 </td> | 358 </td> |
| 355 </tr> | 359 </tr> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 476 <td>Bot assigned to task</td> | 480 <td>Bot assigned to task</td> |
| 477 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> | 481 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> |
| 478 </tr> | 482 </tr> |
| 479 <tr> | 483 <tr> |
| 480 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]"> | 484 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]"> |
| 481 <a>Bot Dimensions</a> | 485 <a>Bot Dimensions</a> |
| 482 </td> | 486 </td> |
| 483 </tr> | 487 </tr> |
| 484 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension"> | 488 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension"> |
| 485 <tr> | 489 <tr> |
| 486 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> | 490 <td bgcolor$="[[_highlightIfRequested(_request.properties.di mensions, dimension.key)]]"> |
| 491 <b>[[dimension.key]]:</b> | <!-- Leave this divider in for readability --> | |
|
Ryan Tseng
2017/06/05 21:46:50
Put divider and comment on new line for 80 char
cwpayton
2017/06/05 22:35:43
Done.
| |
| 492 <template is="dom-repeat" items="[[_aliasResult(_request.p roperties.dimensions, dimension)]]" as="value"> | |
|
Ryan Tseng
2017/06/05 21:46:53
<template
is="..."
items="...."
as="..
cwpayton
2017/06/05 22:35:43
Done.
| |
| 493 <span class$="[[value.class]]">[[value.name]]</span> | < !-- Leave this divider in for readability --> | |
|
Ryan Tseng
2017/06/05 21:46:52
Divider and comment on new line.
cwpayton
2017/06/05 22:35:43
Done.
| |
| 494 </template> | |
| 495 </td> | |
| 487 </tr> | 496 </tr> |
| 488 </template> | 497 </template> |
| 489 | 498 |
| 490 <tr> | 499 <tr> |
| 491 <td>Exit code</td> | 500 <td>Exit code</td> |
| 492 <td>[[_result.exit_code]]</td> | 501 <td>[[_result.exit_code]]</td> |
| 493 </tr> | 502 </tr> |
| 494 <tr> | 503 <tr> |
| 495 <td>Try number</td> | 504 <td>Try number</td> |
| 496 <td>[[_result.try_number]]</td> | 505 <td>[[_result.try_number]]</td> |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 type: Object, | 738 type: Object, |
| 730 }, | 739 }, |
| 731 _stdout: { | 740 _stdout: { |
| 732 type: String, | 741 type: String, |
| 733 } | 742 } |
| 734 }, | 743 }, |
| 735 | 744 |
| 736 observers: [ | 745 observers: [ |
| 737 "_similarLoad(_request,_result,_auth_headers)"], | 746 "_similarLoad(_request,_result,_auth_headers)"], |
| 738 | 747 |
| 739 _alias: function(dim) { | 748 _aliasRequest: function(request) { |
| 740 var values = dim.value; | 749 // Refactor of the old "_alias" function for distinction from the |
|
Ryan Tseng
2017/06/05 21:46:51
You don't have to put in code comments for code ch
cwpayton
2017/06/05 22:35:43
Done.
| |
| 750 // _aliasResult function | |
| 751 var values = request.value; | |
| 741 if (!Array.isArray(values)) { | 752 if (!Array.isArray(values)) { |
| 742 values = [values]; | 753 values = [values]; |
| 743 } | 754 } |
| 744 if (swarming.alias.has(dim.key)) { | 755 if (swarming.alias.has(request.key)) { |
| 745 values.forEach(function(v, i){ | 756 values.forEach(function(v, i) { |
| 746 values[i] = swarming.alias.apply(v, dim.key); | 757 values[i] = swarming.alias.apply(v, request.key); |
| 747 }); | 758 }); |
| 748 } | 759 } |
| 749 return values.join(" | "); | 760 return values.join(" | "); |
| 750 }, | 761 }, |
| 751 | 762 |
| 763 _aliasResult: function(request, result) { | |
| 764 // request is the entire _request.properties.dimensions array, but we ar e | |
| 765 // only passed in one key at a time from _result.bot_dimensions as the | |
| 766 // result variable. Therefore we need to loop through the key-value pair s | |
| 767 // of request to determine whether the current bot dimension was request ed. | |
|
Ryan Tseng
2017/06/05 21:46:50
nit: 80 chars.
cwpayton
2017/06/05 22:35:43
Done.
| |
| 768 var map = []; | |
|
Ryan Tseng
2017/06/05 21:46:50
nit: this isn't a map, it's an array of objects.
cwpayton
2017/06/05 22:35:43
Done.
| |
| 769 var target = null; | |
| 770 request.forEach(function(dim, i) { | |
| 771 if (dim.key == result.key) target = i; | |
| 772 }); | |
| 773 var values = result.value; | |
| 774 if (!Array.isArray(values)) { | |
| 775 values = [values]; | |
| 776 } | |
| 777 values.forEach(function(v, i) { | |
| 778 // Adjust the proper alias, if necessary | |
| 779 values[i] = swarming.alias.has(result.key) ? | |
|
Ryan Tseng
2017/06/05 21:46:51
nit: this is two lines, so just use an if/else sta
cwpayton
2017/06/05 22:35:43
Done.
| |
| 780 swarming.alias.apply(v, result.key) : v; | |
| 781 | |
| 782 // Set class attribute to bolded if the value was included in the | |
| 783 // requested dimensions | |
| 784 bold = target != null && request[target].value == v ? "bolded" : ""; | |
|
Ryan Tseng
2017/06/05 21:46:51
This is a bit hard to parse, if statements are pre
cwpayton
2017/06/05 22:35:43
Done.
| |
| 785 map.push({"name": values[i], "class": bold}); | |
| 786 }); | |
| 787 | |
| 788 // Return an array of objects that map each value to its corresponding | |
| 789 // class name based on whether it should be bolded. | |
| 790 return map; | |
| 791 }, | |
| 792 | |
| 752 _bytes: function(sizeInBytes) { | 793 _bytes: function(sizeInBytes) { |
| 753 return sk.human.bytes(sizeInBytes); | 794 return sk.human.bytes(sizeInBytes); |
| 754 }, | 795 }, |
| 755 | 796 |
| 756 _canCancelTask: function(result, permissions) { | 797 _canCancelTask: function(result, permissions) { |
| 757 return result && result.state === "PENDING" && permissions.cancel_task; | 798 return result && result.state === "PENDING" && permissions.cancel_task; |
| 758 }, | 799 }, |
| 759 | 800 |
| 760 _cancelTask: function() { | 801 _cancelTask: function() { |
| 761 var url = "/api/swarming/v1/task/" + this.task_id +"/cancel"; | 802 var url = "/api/swarming/v1/task/" + this.task_id +"/cancel"; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 if (!template) { | 909 if (!template) { |
| 869 return undefined; | 910 return undefined; |
| 870 } | 911 } |
| 871 return template.replace("%s", id); | 912 return template.replace("%s", id); |
| 872 }, | 913 }, |
| 873 | 914 |
| 874 _hasActualCIPDPackages: function(result) { | 915 _hasActualCIPDPackages: function(result) { |
| 875 return result && result.cipd_pins && result.cipd_pins.packages; | 916 return result && result.cipd_pins && result.cipd_pins.packages; |
| 876 }, | 917 }, |
| 877 | 918 |
| 919 _highlightIfRequested: function(request, key) { | |
| 920 var yellow = false; | |
| 921 request.forEach(function (dim){ | |
|
Ryan Tseng
2017/06/05 21:46:51
nit: space before {
cwpayton
2017/06/05 22:35:43
Done.
| |
| 922 if (dim.key == key) yellow = true; | |
| 923 }); | |
| 924 return yellow ? "Yellow" : "White"; | |
| 925 }, | |
| 926 | |
| 878 _internalClass: function(failure) { | 927 _internalClass: function(failure) { |
| 879 if (failure) { | 928 if (failure) { |
| 880 return "exception"; | 929 return "exception"; |
| 881 } | 930 } |
| 882 return ""; | 931 return ""; |
| 883 }, | 932 }, |
| 884 | 933 |
| 885 _isolateLink: function(ref) { | 934 _isolateLink: function(ref) { |
| 886 if (!ref || !ref.isolatedserver) { | 935 if (!ref || !ref.isolatedserver) { |
| 887 return undefined; | 936 return undefined; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 | 1120 |
| 1072 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams); | 1121 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams); |
| 1073 // change running to pending | 1122 // change running to pending |
| 1074 taskCountParams.state = ["PENDING"]; | 1123 taskCountParams.state = ["PENDING"]; |
| 1075 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams); | 1124 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams); |
| 1076 } | 1125 } |
| 1077 }); | 1126 }); |
| 1078 })(); | 1127 })(); |
| 1079 </script> | 1128 </script> |
| 1080 </dom-module> | 1129 </dom-module> |
| OLD | NEW |