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

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: Edited task-page.html as per the code review comments 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.dim~span.dim:before {
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)]]">
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]] dim">[[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(requested_dims, bot_dim) {
769 // requested_dims is the entire _request.properties.dimensions array, bu t we
770 // are only passed in one key at a time from _result.bot_dimensions as t he
771 // bot_dim variable. Therefore we need to loop through the key-value pai rs
772 // of requested_dims to determine whether the current bot dimension was
773 // requested.
774 var boldMap = [];
775 var target = null;
776 requested_dims.forEach(function(dim, i) {
777 if (dim.key === bot_dim.key) {
778 target = i;
779 }
780 });
781 var values = bot_dim.value;
782 if (!Array.isArray(values)) {
783 values = [values];
784 }
785 values.forEach(function(v, i) {
786 // Adjust the proper alias, if necessary
787 if (swarming.alias.has(bot_dim.key)) {
788 values[i] = swarming.alias.apply(v, bot_dim.key);
789 }
790 // Set class attribute to bolded if the value was included in the
791 // requested dimensions
792 var bold = "";
793 if (target != null && requested_dims[target].value === v) {
794 bold = "bolded";
795 }
796 boldMap.push({"name": values[i], "class": bold});
797 });
798
799 // Return an array of objects that map each value to its corresponding
800 // class name based on whether it should be bolded.
801 return boldMap;
802 },
803
752 _bytes: function(sizeInBytes) { 804 _bytes: function(sizeInBytes) {
753 return sk.human.bytes(sizeInBytes); 805 return sk.human.bytes(sizeInBytes);
754 }, 806 },
755 807
756 _canCancelTask: function(result, permissions) { 808 _canCancelTask: function(result, permissions) {
757 return result && result.state === "PENDING" && permissions.cancel_task; 809 return result && result.state === "PENDING" && permissions.cancel_task;
758 }, 810 },
759 811
760 _cancelTask: function() { 812 _cancelTask: function() {
761 var url = "/api/swarming/v1/task/" + this.task_id +"/cancel"; 813 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) { 920 if (!template) {
869 return undefined; 921 return undefined;
870 } 922 }
871 return template.replace("%s", id); 923 return template.replace("%s", id);
872 }, 924 },
873 925
874 _hasActualCIPDPackages: function(result) { 926 _hasActualCIPDPackages: function(result) {
875 return result && result.cipd_pins && result.cipd_pins.packages; 927 return result && result.cipd_pins && result.cipd_pins.packages;
876 }, 928 },
877 929
930 _highlight: function(request, key) {
931 var highlight = false;
932 request.forEach(function (dim) {
933 if (dim.key == key) {
934 highlight = true;
935 }
936 });
937 return highlight ? "Yellow" : "White";
938 },
939
878 _internalClass: function(failure) { 940 _internalClass: function(failure) {
879 if (failure) { 941 if (failure) {
880 return "exception"; 942 return "exception";
881 } 943 }
882 return ""; 944 return "";
883 }, 945 },
884 946
885 _isolateLink: function(ref) { 947 _isolateLink: function(ref) {
886 if (!ref || !ref.isolatedserver) { 948 if (!ref || !ref.isolatedserver) {
887 return undefined; 949 return undefined;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 1133
1072 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams); 1134 this._getJsonAsync("_other_running", "/api/swarming/v1/tasks/count", "_b usyRunningCount", this._auth_headers, taskCountParams);
1073 // change running to pending 1135 // change running to pending
1074 taskCountParams.state = ["PENDING"]; 1136 taskCountParams.state = ["PENDING"];
1075 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams); 1137 this._getJsonAsync("_other_pending", "/api/swarming/v1/tasks/count", "_b usyPendingCount", this._auth_headers, taskCountParams);
1076 } 1138 }
1077 }); 1139 });
1078 })(); 1140 })();
1079 </script> 1141 </script>
1080 </dom-module> 1142 </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