-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './search.state'; | ||
export * from './search-results-tool'; | ||
export * from './search.module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Injectable } from '@angular/core'; | ||
|
||
import { EntityStore } from '@igo2/common'; | ||
import { SearchResult, SearchSourceService, SearchSource } from '@igo2/geo'; | ||
|
||
/** | ||
* Service that holds the state of the search module | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class SearchState { | ||
/** | ||
* Store that holds the search results | ||
*/ | ||
public store: EntityStore<SearchResult> = new EntityStore<SearchResult>([]); | ||
|
||
/** | ||
* Search types currently enabled in the search source service | ||
*/ | ||
get searchTypes(): string[] { | ||
return this.searchSourceService | ||
.getEnabledSources() | ||
.map((source: SearchSource) => (source.constructor as any).type); | ||
} | ||
|
||
constructor(private searchSourceService: SearchSourceService) {} | ||
} |