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

Side by Side Diff: appengine/swarming/elements/res/imp/tasklist/task-list-data.html

Issue 2306103002: Add aliases to bot-page and refactor duplicated code (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@fix-buttons
Patch Set: rebase again Created 4 years, 3 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
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 <bot-list-data> 9 <bot-list-data>
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 }); 165 });
166 }); 166 });
167 167
168 // Turn the Map<Object,Map<Boolean>> into a Map<Object,Array<String>> 168 // Turn the Map<Object,Map<Boolean>> into a Map<Object,Array<String>>
169 // with all of the aliases applied. 169 // with all of the aliases applied.
170 var pMap = {}; 170 var pMap = {};
171 for (key in map) { 171 for (key in map) {
172 var values = Object.keys(map[key]); 172 var values = Object.keys(map[key]);
173 if (swarming.alias.DIMENSIONS_WITH_ALIASES.indexOf(key) === -1) { 173 if (swarming.alias.DIMENSIONS_WITH_ALIASES.indexOf(key) === -1) {
174 pMap[key] = values; 174 pMap[key] = values;
175 } else if (key === "gpu") {
176 var gpus = [];
177 values.forEach(function(g){
178 var alias = swarming.alias.gpu(g);
179 if (alias !== "unknown") {
180 gpus.push(swarming.alias.apply(g, alias));
181 } else {
182 gpus.push(g);
183 }
184 }.bind(this));
185 pMap["gpu"] = gpus;
186 } else if (key === "device_type") {
187 var devs = [];
188 values.forEach(function(dt){
189 var alias = swarming.alias.android(dt);
190 if (alias !== "unknown") {
191 devs.push(swarming.alias.apply(dt, alias));
192 } else {
193 devs.push(dt);
194 }
195 }.bind(this));
196 pMap["device_type"] = devs;
197 } else { 175 } else {
198 console.log("Unknown alias type: ", d); 176 var aliased = [];
177 values.forEach(function(value){
178 aliased.push(swarming.alias.apply(value, key));
179 });
180 pMap[key] = aliased;
199 } 181 }
200 } 182 }
201 183
202 // Add some options that might not show up. 184 // Add some options that might not show up.
203 pMap["android_devices"].push("0"); 185 pMap["android_devices"].push("0");
204 pMap["device_os"].push("none"); 186 pMap["device_os"].push("none");
205 pMap["device_type"].push("none"); 187 pMap["device_type"].push("none");
206 pMap["user"].push("none"); 188 pMap["user"].push("none");
207 189
208 // Custom filter options 190 // Custom filter options
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (t.duration){ 248 if (t.duration){
267 t.human_duration = sk.human.strDuration(t.duration); 249 t.human_duration = sk.human.strDuration(t.duration);
268 } 250 }
269 }); 251 });
270 return this._list.items; 252 return this._list.items;
271 } 253 }
272 }); 254 });
273 })(); 255 })();
274 </script> 256 </script>
275 </dom-module> 257 </dom-module>
OLDNEW
« no previous file with comments | « appengine/swarming/elements/res/imp/tasklist/task-list.html ('k') | appengine/swarming/elements/res/js/alias.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698