[ADF-4193] search error notifications and empty results (#4567)

* search error notifications and empty results

* update docs
This commit is contained in:
Denys Vuika
2019-04-08 14:25:47 +01:00
committed by Eugenio Romano
parent 2c9fdf0d4d
commit f89bf507f5
3 changed files with 62 additions and 6 deletions
@@ -42,8 +42,9 @@ export class SearchQueryBuilderService {
private _userQuery = '';
updated: Subject<QueryBody> = new Subject();
executed: Subject<ResultSetPaging> = new Subject();
updated = new Subject<QueryBody>();
executed = new Subject<ResultSetPaging>();
error = new Subject();
categories: Array<SearchCategory> = [];
queryFragments: { [id: string]: string } = {};
@@ -196,10 +197,23 @@ export class SearchQueryBuilderService {
* @returns Nothing
*/
async execute() {
const query = this.buildQuery();
if (query) {
const resultSetPaging: ResultSetPaging = await this.alfrescoApiService.searchApi.search(query);
this.executed.next(resultSetPaging);
try {
const query = this.buildQuery();
if (query) {
const resultSetPaging: ResultSetPaging = await this.alfrescoApiService.searchApi.search(query);
this.executed.next(resultSetPaging);
}
} catch (error) {
this.error.next(error);
this.executed.next({
list: {
pagination: {
totalItems: 0
},
entries: []
}
});
}
}