mirror of
https://github.com/nasa/openmct.git
synced 2025-02-21 01:42:31 +00:00
[Search] Moving responsibility
Moving the responsibility of polling for updates from the search controller to the search aggregator. In progress. Previously this prototype was what could be called semi-stable, but now it is no longer.
This commit is contained in:
parent
341218e8f6
commit
300280e03e
@ -39,7 +39,7 @@
|
||||
<!-- Results list -->
|
||||
<div class="results">
|
||||
<mct-representation key="'search-item'"
|
||||
ng-repeat="result in results"
|
||||
ng-repeat="result in searchService.latestResults"
|
||||
mct-object="result.object"
|
||||
ng-model="ngModel">
|
||||
</mct-representation>
|
||||
|
@ -42,7 +42,8 @@ define(
|
||||
*/
|
||||
function SearchAggregator(providers) {
|
||||
var latestMergedResults = [],
|
||||
lastMergeTimestamps = [];
|
||||
lastMergeTimestamps = [],
|
||||
returnObject;
|
||||
|
||||
// Remove duplicate objects that have the same ID
|
||||
function filterRepeats(results) {
|
||||
@ -122,6 +123,7 @@ define(
|
||||
// After all that is done, now replace latestMergedResults with this
|
||||
latestMergedResults = newerResults;
|
||||
lastMergeTimestamps = providerTimestamps;
|
||||
returnObject.latestResults = latestMergedResults;
|
||||
}
|
||||
|
||||
// For documentation, see sendQuery below.
|
||||
@ -141,7 +143,7 @@ define(
|
||||
updateResults();
|
||||
}
|
||||
|
||||
return {
|
||||
returnObject = {
|
||||
/**
|
||||
* Sends a query to each of the providers, then updates the global
|
||||
* latestMergedResults accordingly.
|
||||
@ -177,6 +179,14 @@ define(
|
||||
return latestMergedResults.slice(start, stop);
|
||||
},
|
||||
|
||||
/**
|
||||
* The latest search results that have been calculated. The
|
||||
* format of the returned objects are searchResult objects,
|
||||
* which have the members id, object, and score. This array
|
||||
* is updated constantly.
|
||||
*/
|
||||
latestResults: latestMergedResults,
|
||||
|
||||
/**
|
||||
* Get the timestamps for each of the provider's last controbutions
|
||||
* to the latestMergedResults.
|
||||
@ -193,6 +203,7 @@ define(
|
||||
return latestMergedResults.length;
|
||||
}
|
||||
};
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
return SearchAggregator;
|
||||
|
@ -35,6 +35,15 @@ define(function () {
|
||||
var numResults = INITIAL_LOAD_NUMBER,
|
||||
loading = false;
|
||||
|
||||
//$scope.results = searchService.latestResults;
|
||||
|
||||
// This allows us to directly access the search aggregator's members.
|
||||
// Most important is latestResults, which is continuously updated. This
|
||||
// means that this controller does not have to poll for results any more.
|
||||
$scope.searchService = searchService;
|
||||
// TODO: Modify search aggregator to have a search result array which
|
||||
// is of a size that can be chosen and modified by this controller.
|
||||
|
||||
function update(timestamp) {
|
||||
// We are loading results
|
||||
loading = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user