From 2c5da44e5e7b83958773ed660f756cd174ac8e7b Mon Sep 17 00:00:00 2001 From: slhale Date: Thu, 30 Jul 2015 12:38:03 -0700 Subject: [PATCH] [Search] Clean up Removed the timestamp as an optional parameter of the search aggregator's query(), and now it instead automattically generates one before querying the providers. Also attempted to fix loading, but did not complete (commented out). --- .../features/search/src/SearchAggregator.js | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/platform/features/search/src/SearchAggregator.js b/platform/features/search/src/SearchAggregator.js index 771b4288c8..24e811aa13 100644 --- a/platform/features/search/src/SearchAggregator.js +++ b/platform/features/search/src/SearchAggregator.js @@ -43,6 +43,8 @@ define( */ function SearchAggregator($q, providers) { var loading; + //var loadingQueue = {}; + // {key: value} are {timestamp: isLoading} // Takes an array of arrays and returns an array containing all // of the sub-arrays' contents @@ -120,17 +122,14 @@ define( } // For documentation, see sendQuery below. - function queryAll(inputText, timestamp) { + function queryAll(inputText) { var i, + timestamp = Date.now(), resultPromises = []; // We are loading loading = true; - - // If there's not a timestamp, make this time the timestamp - if (!timestamp) { - timestamp = Date.now(); - } + //loadingQueue[timestamp] = true; // Send the query to all the providers for (i = 0; i < providers.length; i += 1) { @@ -148,6 +147,7 @@ define( // We are done loading loading = false; + //loadingQueue[timestamp] = false; return results; }); @@ -159,10 +159,6 @@ define( * latestMergedResults accordingly. * * @param inputText The text input that is the query. - * @param timestamp (optional) The time at which this function - * was called. This timestamp will be associated with the - * latest results list, which allows us to see if it has been - * updated. If not provided, this aggregator will. */ query: queryAll, @@ -172,6 +168,14 @@ define( */ isLoading: function () { return loading; + /* + for (var timestamp in loadingQueue) { + if (loadingQueue[timestamp] === true) { + return true; + } + } + return false; + */ } }; }