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

Unified Diff: appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html

Issue 2359993002: Medium sized improvements to bot-list and task-list (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: condense loop 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 side-by-side diff with in-line comments
Download patch
Index: appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html
diff --git a/appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html b/appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html
index 17bd8754f010e8d75789f922ca4216cf5995a5af..c854b632e59b96403232a34d339d6f7d702baca1 100644
--- a/appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html
+++ b/appengine/swarming/elements/res/imp/common/query-column-filter-behavior.html
@@ -346,7 +346,7 @@
if (matchPartCaseInsensitive(s, query).idx !== -1) {
return true;
}
- var opts = primary_map[s];
+ var opts = primary_map[s] || [];
for (var i = 0; i < opts.length; i++) {
if (matchPartCaseInsensitive(opts[i], query).idx !== -1) {
return true;
@@ -378,9 +378,10 @@
if (!primarySelected) {
return [];
}
+ var arr = primary_map[primarySelected] || [];
if (matchPartCaseInsensitive(primarySelected, query).idx !== -1) {
// Sort the secondaries alphabetically, but prioritize query matches.
- return primary_map[primarySelected].sort(function(a, b){
+ return arr.sort(function(a, b){
var aMatch = matchPartCaseInsensitive(a, query).idx !== -1;
var bMatch = matchPartCaseInsensitive(b, query).idx !== -1;
if (aMatch === bMatch) {
@@ -391,7 +392,7 @@
});
}
// Otherwise, filter out those that do not match.
- return primary_map[primarySelected].filter(function(s) {
+ return arr.filter(function(s) {
return matchPartCaseInsensitive(s, query).idx !== -1;
});
},

Powered by Google App Engine
This is Rietveld 408576698