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

Side by Side Diff: appengine/swarming/ui/res/imp/common/common-behavior.html

Issue 2921433002: Add in similar load (Closed)
Patch Set: 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
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 It contains the definition of the following Behaviors: 6 It contains the definition of the following Behaviors:
7 7
8 SwarmingBehaviors.CommonBehavior 8 SwarmingBehaviors.CommonBehavior
9 9
10 To use it, include 10 To use it, include
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 209 }
210 return "/task?id=" + taskId; 210 return "/task?id=" + taskId;
211 }, 211 },
212 212
213 // Create a link to a task list with the preloaded filters and columns. 213 // Create a link to a task list with the preloaded filters and columns.
214 // filters - Array<Object> or Array<String>. If Array<Object>, Object 214 // filters - Array<Object> or Array<String>. If Array<Object>, Object
215 // should be {key:String, value:String} or 215 // should be {key:String, value:String} or
216 // {key:String, value:Array<String>}. If Array<String>, the Strings 216 // {key:String, value:Array<String>}. If Array<String>, the Strings
217 // should be valid filters (e.g. "foo:bar"). 217 // should be valid filters (e.g. "foo:bar").
218 // columns - Array<String> , the the column names that should be shown. 218 // columns - Array<String> , the the column names that should be shown.
219 // Any trailing args after columns will be assumed to be strings that
220 // should be treated as valid filters.
219 _taskListLink: function(filters, columns) { 221 _taskListLink: function(filters, columns) {
220 filters = filters || []; 222 filters = filters || [];
221 columns = columns || []; 223 columns = columns || [];
222 var fArr = []; 224 var fArr = [];
223 filters.forEach(function(f){ 225 filters.forEach(function(f){
224 if (f.key && f.value) { 226 if (f.key && f.value) {
225 if (Array.isArray(f.value)) { 227 if (Array.isArray(f.value)) {
226 f.value.forEach(function(v) { 228 f.value.forEach(function(v) {
227 fArr.push(f.key + ":" + v); 229 fArr.push(f.key + ":" + v);
228 }); 230 });
229 } else { 231 } else {
230 fArr.push(f.key + ":" + f.value); 232 fArr.push(f.key + ":" + f.value);
231 } 233 }
232 } else { 234 } else {
233 fArr.push(f); 235 fArr.push(f);
234 } 236 }
235 }); 237 });
238 // can't use .foreach, as arguments isn't really an Array.
239 for (var i = 2; i < arguments.length; i++) {
240 fArr.push(arguments[i]);
241 }
236 var obj = { 242 var obj = {
237 f: fArr, 243 f: fArr,
238 c: columns, 244 c: columns,
239 } 245 }
240 return "/tasklist?" + sk.query.fromParamSet(obj); 246 return "/tasklist?" + sk.query.fromParamSet(obj);
241 }, 247 },
242 248
243 // _timeDiffApprox returns the approximate difference between now and 249 // _timeDiffApprox returns the approximate difference between now and
244 // the specified date. 250 // the specified date.
245 _timeDiffApprox: function(date){ 251 _timeDiffApprox: function(date){
(...skipping 15 matching lines...) Expand all
261 } 267 }
262 return this._humanDuration((second.getTime() - first.getTime())/1000); 268 return this._humanDuration((second.getTime() - first.getTime())/1000);
263 }, 269 },
264 270
265 _truthy: function(a){ 271 _truthy: function(a){
266 return !!a; 272 return !!a;
267 } 273 }
268 }; 274 };
269 })(); 275 })();
270 </script> 276 </script>
OLDNEW
« no previous file with comments | « appengine/swarming/ui/build/elements.html ('k') | appengine/swarming/ui/res/imp/taskpage/task-page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698