mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3292] fix reset to defaults (#3566)
* fix reset to defaults * code fixes * restore providers * fix category filtering
This commit is contained in:
committed by
Eugenio Romano
parent
75e27ccb36
commit
6508b145d0
@@ -55,26 +55,18 @@ export class SearchQueryBuilderService {
|
||||
// TODO: to be supported in future iterations
|
||||
ranges: { [id: string]: SearchRange } = {};
|
||||
|
||||
constructor(appConfig: AppConfigService, private alfrescoApiService: AlfrescoApiService) {
|
||||
this.config = appConfig.get<SearchConfiguration>('search');
|
||||
constructor(private appConfig: AppConfigService, private alfrescoApiService: AlfrescoApiService) {
|
||||
this.resetToDefaults();
|
||||
}
|
||||
|
||||
resetToDefaults() {
|
||||
if (this.config) {
|
||||
this.categories =
|
||||
(this.config.categories || [])
|
||||
.filter(category => category.enabled)
|
||||
.map(category => { return { ...category }; });
|
||||
|
||||
this.filterQueries =
|
||||
(this.config.filterQueries || [])
|
||||
.map(query => { return {...query}; });
|
||||
|
||||
const template = this.appConfig.get<SearchConfiguration>('search');
|
||||
if (template) {
|
||||
this.config = JSON.parse(JSON.stringify(template));
|
||||
this.categories = (this.config.categories || []).filter(category => category.enabled);
|
||||
this.filterQueries = this.config.filterQueries || [];
|
||||
if (this.config.sorting) {
|
||||
this.sorting =
|
||||
(this.config.sorting.defaults || [])
|
||||
.map(sorting => { return { ...sorting }; });
|
||||
this.sorting = this.config.sorting.defaults || [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user