Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: appengine/swarming/ui/res/imp/taskpage/task-page.html

Issue 2921983002: Swarming UI: Bold requested dimensions in bot dimensions (Closed)
Patch Set: Deleted package-lock.json file Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « appengine/swarming/ui/build/js/js.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 .full-width-container > paper-checkbox { 125 .full-width-container > paper-checkbox {
122 position: absolute; 126 position: absolute;
123 bottom: 10px; 127 bottom: 10px;
124 width: 140px; 128 width: 140px;
125 left: 5px; 129 left: 5px;
126 } 130 }
127 131
128 .italic { 132 .italic {
129 font-style: italic; 133 font-style: italic;
130 } 134 }
135
136 span~span:before {
Ryan Tseng 2017/06/06 00:27:55 This should be restricted to certain classes. ie
cwpayton 2017/06/06 16:04:08 Done.
137 content: " | ";
138 }
131 </style> 139 </style>
132 140
133 <url-param name="id" 141 <url-param name="id"
134 value="{{task_id}}"> 142 value="{{task_id}}">
135 </url-param> 143 </url-param>
136 <url-param name="try_detail" 144 <url-param name="try_detail"
137 value="{{_try_detail}}"> 145 value="{{_try_detail}}">
138 </url-param> 146 </url-param>
139 <url-param name="request_detail" 147 <url-param name="request_detail"
140 value="{{_request_detail}}"> 148 value="{{_request_detail}}">
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 <a 343 <a
336 title="The list of bots that matches the list of dimensi ons" 344 title="The list of bots that matches the list of dimensi ons"
337 href$="[[_botListLink(_request.properties.dimensions)]]" >Bots</a> 345 href$="[[_botListLink(_request.properties.dimensions)]]" >Bots</a>
338 <a 346 <a
339 title="The list of tasks that matches the list of dimens ions" 347 title="The list of tasks that matches the list of dimens ions"
340 href$="[[_taskListLink(_request.properties.dimensions)]] ">Tasks</a> 348 href$="[[_taskListLink(_request.properties.dimensions)]] ">Tasks</a>
341 </td> 349 </td>
342 </tr> 350 </tr>
343 <template is="dom-repeat" items="{{_request.properties.dimension s}}" as="dimension"> 351 <template is="dom-repeat" items="{{_request.properties.dimension s}}" as="dimension">
344 <tr> 352 <tr>
345 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> 353 <td><b>[[dimension.key]]:</b> [[_aliasRequest(dimension)]]</ td>
346 </tr> 354 </tr>
347 </template> 355 </template>
348 <tr> 356 <tr>
349 <td>Isolated Inputs</td> 357 <td>Isolated Inputs</td>
350 <td> 358 <td>
351 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]"> 359 <a href$="[[_isolateLink(_request.properties.inputs_ref)]]">
352 [[_request.properties.inputs_ref.isolated]] 360 [[_request.properties.inputs_ref.isolated]]
353 </a> 361 </a>
354 </td> 362 </td>
355 </tr> 363 </tr>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 <td>Bot assigned to task</td> 484 <td>Bot assigned to task</td>
477 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td> 485 <td><a href$="[[_botLink(_result.bot_id)]]">[[_result.bot_id]] </td>
478 </tr> 486 </tr>
479 <tr> 487 <tr>
480 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]"> 488 <td rowspan$="[[_rowspan(_result.bot_dimensions)]]">
481 <a>Bot Dimensions</a> 489 <a>Bot Dimensions</a>
482 </td> 490 </td>
483 </tr> 491 </tr>
484 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension"> 492 <template is="dom-repeat" items="[[_result.bot_dimensions]]" as= "dimension">
485 <tr> 493 <tr>
486 <td><b>[[dimension.key]]:</b> [[_alias(dimension)]]</td> 494 <td bgcolor$="[[_highlight(_request.properties.dimensions, d imension.key)]]">
kjlubick 2017/06/06 12:26:54 Super minor nit: you only need the $= for certain
cwpayton 2017/06/06 16:04:08 Turns out bgcolor needs a $= instead of a simple =
495 <b>[[dimension.key]]:</b>
496 <template
497 is="dom-repeat"
498 items="[[_aliasResult(_request.properties.dimensions, di mension)]]"
499 as="value">
500 <span class$="[[value.class]]">[[value.name]]</span>
501 </template>
502 </td>
487 </tr> 503 </tr>
488 </template> 504 </template>
489 505
490 <tr> 506 <tr>
491 <td>Exit code</td> 507 <td>Exit code</td>
492 <td>[[_result.exit_code]]</td> 508 <td>[[_result.exit_code]]</td>
493 </tr> 509 </tr>
494 <tr> 510 <tr>
495 <td>Try number</td> 511 <td>Try number</td>
496 <td>[[_result.try_number]]</td> 512 <td>[[_result.try_number]]</td>
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 type: Object, 745 type: Object,
730 }, 746 },
731 _stdout: { 747 _stdout: {
732 type: String, 748 type: String,
733 } 749 }
734 }, 750 },
735 751
736 observers: [ 752 observers: [
737 "_similarLoad(_request,_result,_auth_headers)"], 753 "_similarLoad(_request,_result,_auth_headers)"],
738 754
739 _alias: function(dim) { 755 _aliasRequest: function(request) {
740 var values = dim.value; 756 var values = request.value;
741 if (!Array.isArray(values)) { 757 if (!Array.isArray(values)) {
742 values = [values]; 758 values = [values];
743 } 759 }
744 if (swarming.alias.has(dim.key)) { 760 if (swarming.alias.has(request.key)) {
745 values.forEach(function(v, i){ 761 values.forEach(function(v, i) {
746 values[i] = swarming.alias.apply(v, dim.key); 762 values[i] = swarming.alias.apply(v, request.key);
747 }); 763 });
748 } 764 }
749 return values.join(" | "); 765 return values.join(" | ");
750 }, 766 },
751 767
768 _aliasResult: function(request, result) {
kjlubick 2017/06/06 12:26:54 Please rename request -> request_dims and result -
cwpayton 2017/06/06 16:04:08 Done.
769 // request is the entire _request.properties.dimensions array, but we ar e
Sergey Berezin 2017/06/06 00:14:05 nit: please reformat to fit 80 chars.
cwpayton 2017/06/06 16:04:08 Done.
770 // only passed in one key at a time from _result.bot_dimensions as the
771 // result variable. Therefore we need to loop through the key-value pair s
772 // of request to determine whether the current bot dimension was request ed.
773 var dimensions = [];
774 var target = null;
775 request.forEach(function(dim, i) {
776 if (dim.key == result.key) target = i;
kjlubick 2017/06/06 12:26:54 Use triple equals unless there is a good reason no
cwpayton 2017/06/06 16:04:08 Done.
777 });
778 var values = result.value;
779 if (!Array.isArray(values)) {
kjlubick 2017/06/06 12:26:54 Just curious, is this logic just for safety or is
cwpayton 2017/06/06 16:04:08 This check was written by someone else before me,
780 values = [values];
781 }
782 values.forEach(function(v, i) {
783 // Adjust the proper alias, if necessary
784 if (swarming.alias.has(result.key)){
785 values[i] = swarming.alias.apply(v, result.key);
786 }
787 // Set class attribute to bolded if the value was included in the
788 // requested dimensions
789 var bold = "";
790 if (target != null && request[target].value == v) bold = "bolded"
kjlubick 2017/06/06 12:26:54 Format the if clause onto its own line, with {}
cwpayton 2017/06/06 16:04:08 Done.
791 dimensions.push({"name": values[i], "class": bold});
792 });
793
794 // Return an array of objects that map each value to its corresponding
795 // class name based on whether it should be bolded.
796 return dimensions;
kjlubick 2017/06/06 12:26:54 Minor naming suggestion (take it or leave it), dim
cwpayton 2017/06/06 16:04:08 Done.
797 },
798
752 _bytes: function(sizeInBytes) { 799 _bytes: function(sizeInBytes) {
753 return sk.human.bytes(sizeInBytes); 800 return sk.human.bytes(sizeInBytes);
754 }, 801 },
755 802
756 _canCancelTask: function(result, permissions) { 803 _canCancelTask: function(result, permissions) {
757 return result && result.state === "PENDING" && permissions.cancel_task; 804 return result && result.state === "PENDING" && permissions.cancel_task;
758 }, 805 },
759 806
760 _cancelTask: function() { 807 _cancelTask: function() {
761 var url = "/api/swarming/v1/task/" + this.task_id +"/cancel"; 808 var url = "/api/swarming/v1/task/" + this.task_id +"/cancel";
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 if (!template) { 915 if (!template) {
869 return undefined; 916 return undefined;
870 } 917 }
871 return template.replace("%s", id); 918 return template.replace("%s", id);
872 }, 919 },
873 920
874 _hasActualCIPDPackages: function(result) { 921 _hasActualCIPDPackages: function(result) {
875 return result && result.cipd_pins && result.cipd_pins.packages; 922 return result && result.cipd_pins && result.cipd_pins.packages;
876 }, 923 },
877 924
925 _highlight: function(request, key) {
926 var highlight = false;
927 request.forEach(function (dim) {
928 if (dim.key == key) highlight = true;
kjlubick 2017/06/06 12:26:54 Format the if clause onto its own line, with {}
cwpayton 2017/06/06 16:04:08 Done.
929 });
930 return highlight ? "Yellow" : "White";
931 },
932
878 _internalClass: function(failure) { 933 _internalClass: function(failure) {
879 if (failure) { 934 if (failure) {
880 return "exception"; 935 return "exception";
881 } 936 }
882 return ""; 937 return "";
883 }, 938 },
884 939
885 _isolateLink: function(ref) { 940 _isolateLink: function(ref) {
886 if (!ref || !ref.isolatedserver) { 941 if (!ref || !ref.isolatedserver) {
887 return undefined; 942 return undefined;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1126
1072 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams); 1127 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams);
1073 // change running to pending 1128 // change running to pending
1074 taskCountParams.state = ["PENDING"]; 1129 taskCountParams.state = ["PENDING"];
1075 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams); 1130 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams);
1076 } 1131 }
1077 }); 1132 });
1078 })(); 1133 })();
1079 </script> 1134 </script>
1080 </dom-module> 1135 </dom-module>
OLDNEW
« no previous file with comments | « appengine/swarming/ui/build/js/js.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698