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

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

Issue 2553563003: Link Swarming Tasklist and Botlist together (Closed)
Patch Set: Rebuild Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/ui/res/imp/common/common-behavior.html
diff --git a/appengine/swarming/ui/res/imp/common/common-behavior.html b/appengine/swarming/ui/res/imp/common/common-behavior.html
index e3db4d5d0239ae4cf5e679da195d35590b8a50e2..fdc9808a9cdd59f0e756e57167ad3f04886bd193 100644
--- a/appengine/swarming/ui/res/imp/common/common-behavior.html
+++ b/appengine/swarming/ui/res/imp/common/common-behavior.html
@@ -30,14 +30,27 @@
},
// Create a link to a bot list with the preloaded filters and columns.
- // filters should be an array of {key:String, value:String} and
- // columns should be an array of Strings.
+ // filters - Array<Object> or Array<String>. If Array<Object>, Object
+ // should be {key:String, value:String} or
+ // {key:String, value:Array<String>}. If Array<String>, the Strings
+ // should be valid filters (e.g. "foo:bar").
+ // columns - Array<String> , the the column names that should be shown.
_botListLink: function(filters, columns) {
filters = filters || [];
columns = columns || [];
var fArr = [];
filters.forEach(function(f){
- fArr.push(f.key + ":" + f.value);
+ if (f.key && f.value) {
+ if (Array.isArray(f.value)) {
+ f.value.forEach(function(v) {
+ fArr.push(f.key + ":" + v);
+ });
+ } else {
+ fArr.push(f.key + ":" + f.value);
+ }
+ } else {
+ fArr.push(f);
+ }
});
var obj = {
f: fArr,
@@ -182,6 +195,36 @@
return "/task?id=" + taskId;
},
+ // Create a link to a task list with the preloaded filters and columns.
+ // filters - Array<Object> or Array<String>. If Array<Object>, Object
+ // should be {key:String, value:String} or
+ // {key:String, value:Array<String>}. If Array<String>, the Strings
+ // should be valid filters (e.g. "foo:bar").
+ // columns - Array<String> , the the column names that should be shown.
+ _taskListLink: function(filters, columns) {
+ filters = filters || [];
+ columns = columns || [];
+ var fArr = [];
+ filters.forEach(function(f){
+ if (f.key && f.value) {
+ if (Array.isArray(f.value)) {
+ f.value.forEach(function(v) {
+ fArr.push(f.key + ":" + v);
+ });
+ } else {
+ fArr.push(f.key + ":" + f.value);
+ }
+ } else {
+ fArr.push(f);
+ }
+ });
+ var obj = {
+ f: fArr,
+ c: columns,
+ }
+ return "/tasklist?" + sk.query.fromParamSet(obj);
+ },
+
// _timeDiffApprox returns the approximate difference between now and
// the specified date.
_timeDiffApprox: function(date){

Powered by Google App Engine
This is Rietveld 408576698