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

Side by Side Diff: appengine/swarming/elements/res/imp/botpage/bot-page-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-page-data> 9 <bot-page-data>
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 bot.disks = []; 165 bot.disks = [];
166 for (var i = 0; i < keys.length; i++) { 166 for (var i = 0; i < keys.length; i++) {
167 bot.disks.push({"id":keys[i], "mb":disks[keys[i]].free_mb}); 167 bot.disks.push({"id":keys[i], "mb":disks[keys[i]].free_mb});
168 } 168 }
169 // Sort these so the biggest disk comes first. 169 // Sort these so the biggest disk comes first.
170 bot.disks.sort(function(a, b) { 170 bot.disks.sort(function(a, b) {
171 return b.mb - a.mb; 171 return b.mb - a.mb;
172 }); 172 });
173 } 173 }
174 174
175 bot.dimensions = bot.dimensions || [];
176 bot.dimensions.forEach(function(dim) {
177 if (swarming.alias.DIMENSIONS_WITH_ALIASES.indexOf(dim.key) !== -1) {
178 dim.value.forEach(function(value, i){
179 dim.value[i] = swarming.alias.apply(value, dim.key);
180 });
181 }
182 });
183
175 BOT_TIMES.forEach(function(time) { 184 BOT_TIMES.forEach(function(time) {
176 if (bot[time]) { 185 if (bot[time]) {
177 bot[time] = new Date(bot[time]); 186 bot[time] = new Date(bot[time]);
178 bot["human_"+time] = formatDate(bot[time]); 187 bot["human_"+time] = formatDate(bot[time]);
179 } 188 }
180 }); 189 });
181 return bot; 190 return bot;
182 }, 191 },
183 192
184 _parseEvents: function(events) { 193 _parseEvents: function(events) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return b.started_ts - a.started_ts; 249 return b.started_ts - a.started_ts;
241 }); 250 });
242 251
243 return tasks; 252 return tasks;
244 } 253 }
245 254
246 }); 255 });
247 })(); 256 })();
248 </script> 257 </script>
249 </dom-module> 258 </dom-module>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698