From 71ecf79cf70e67d3f4d71baf9e67fcf9ec5eb1a8 Mon Sep 17 00:00:00 2001 From: Raghav Sethi Date: Fri, 7 Oct 2016 10:58:27 -0700 Subject: [PATCH] Add null checks for user and source to UI search --- .../main/resources/webapp/assets/query-list.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/presto-main/src/main/resources/webapp/assets/query-list.js b/presto-main/src/main/resources/webapp/assets/query-list.js index b2d614c66df7..7eb8f82e70d0 100644 --- a/presto-main/src/main/resources/webapp/assets/query-list.js +++ b/presto-main/src/main/resources/webapp/assets/query-list.js @@ -249,11 +249,20 @@ var QueryList = React.createClass({ else { return stateFilteredQueries.filter(function(query) { var term = searchString.toLowerCase(); - return (query.queryId.toLowerCase().indexOf(term) != -1 || - query.session.user.toLowerCase().indexOf(term) != -1 || - query.session.source.toLowerCase().indexOf(term) != -1 || + if (query.queryId.toLowerCase().indexOf(term) != -1 || query.humanReadableState.toLowerCase().indexOf(term) != -1 || - query.query.toLowerCase().indexOf(term) != -1 ); + query.query.toLowerCase().indexOf(term) != -1) { + return true; + } + + if (query.session.user && query.session.user.toLowerCase().indexOf(term) != -1) { + return true; + } + + if (query.session.source && query.session.source.toLowerCase().indexOf(term) != -1) { + return true; + } + }, this); } },