mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-04-23 22:30:37 +00:00
ACS-10083 Fixes filters behavior with queryParams (#11426)
* [ACS-10083]: aadds populateFilters value safe check * [ACS-10083]: introduces property to postpone document-list data load * [ACS-10083]: migrates to using category id as a key instead of column key * [ACS-10083]: excludes excessive Search API calls * [ACS-10083]: updates user query setting * [ACS-10083]: sonar qube fix * [ACS-10083]: tests refactor * [ACS-10083]: fixes tests * [ACS-10083]: restores isFilterServiceActive prop initializer
This commit is contained in:
@@ -1276,9 +1276,11 @@ describe('DocumentList', () => {
|
|||||||
documentList.onNodeDblClick(node);
|
documentList.onNodeDblClick(node);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should load folder by ID on init', async () => {
|
it('should load folder by ID on init if isDataProvidedExternally is false', async () => {
|
||||||
spyOn(documentList, 'loadFolder').and.stub();
|
spyOn(documentList, 'loadFolder').and.stub();
|
||||||
|
|
||||||
|
documentList.isDataProvidedExternally = false;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
|
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
|
||||||
@@ -1288,6 +1290,20 @@ describe('DocumentList', () => {
|
|||||||
expect(documentList.loadFolder).toHaveBeenCalled();
|
expect(documentList.loadFolder).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should NOT load folder by ID on init if isDataProvidedExternally is true', async () => {
|
||||||
|
spyOn(documentList, 'loadFolder').and.stub();
|
||||||
|
|
||||||
|
documentList.isDataProvidedExternally = true;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
documentList.ngOnChanges({ currentFolderId: new SimpleChange(undefined, '1d26e465-dea3-42f3-b415-faa8364b9692', true) });
|
||||||
|
|
||||||
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
expect(documentList.loadFolder).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it('should emit error when getFolderNode fails', (done) => {
|
it('should emit error when getFolderNode fails', (done) => {
|
||||||
const error = { message: '{ "error": { "statusCode": 501 } }' };
|
const error = { message: '{ "error": { "statusCode": 501 } }' };
|
||||||
spyFolder.and.returnValue(throwError(error));
|
spyFolder.and.returnValue(throwError(error));
|
||||||
|
|||||||
@@ -373,6 +373,13 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
@Input()
|
@Input()
|
||||||
displayDragAndDropHint = true;
|
displayDragAndDropHint = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the data is provided externally.
|
||||||
|
* If true the component won't fetch data itself
|
||||||
|
*/
|
||||||
|
@Input()
|
||||||
|
isDataProvidedExternally = false;
|
||||||
|
|
||||||
/** Emitted when the user clicks a list node */
|
/** Emitted when the user clicks a list node */
|
||||||
@Output()
|
@Output()
|
||||||
nodeClick = new EventEmitter<NodeEntityEvent>();
|
nodeClick = new EventEmitter<NodeEntityEvent>();
|
||||||
@@ -598,7 +605,7 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.currentFolderId && changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
|
if (this.currentFolderId && changes['currentFolderId']?.currentValue !== changes['currentFolderId']?.previousValue) {
|
||||||
this.loadFolder();
|
!this.isDataProvidedExternally && this.loadFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.data) {
|
if (this.data) {
|
||||||
@@ -1024,6 +1031,7 @@ export class DocumentListComponent extends DataTableSchema implements OnInit, On
|
|||||||
private onDataReady(nodePaging: NodePaging) {
|
private onDataReady(nodePaging: NodePaging) {
|
||||||
this.ready.emit(nodePaging);
|
this.ready.emit(nodePaging);
|
||||||
this.pagination.next(nodePaging.list.pagination);
|
this.pagination.next(nodePaging.list.pagination);
|
||||||
|
this.setLoadingState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePagination(requestPaginationModel: RequestPaginationModel) {
|
updatePagination(requestPaginationModel: RequestPaginationModel) {
|
||||||
|
|||||||
@@ -97,7 +97,35 @@ describe('FilterHeaderComponent', () => {
|
|||||||
expect(setCurrentRootFolderIdSpy).toHaveBeenCalled();
|
expect(setCurrentRootFolderIdSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set active filters when an initial value is set', async () => {
|
it('should set filters if initial value is provided', async () => {
|
||||||
|
spyOn(queryBuilder, 'setCurrentRootFolderId');
|
||||||
|
spyOn(queryBuilder, 'isCustomSourceNode').and.returnValue(false);
|
||||||
|
spyOn(queryBuilder, 'setActiveFilter');
|
||||||
|
|
||||||
|
component.value = { name: 'pinocchio' };
|
||||||
|
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
|
||||||
|
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
expect(queryBuilder.setActiveFilter).toHaveBeenCalledWith('name', 'pinocchio');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should NOT set filters if initial value is not provided', async () => {
|
||||||
|
spyOn(queryBuilder, 'setCurrentRootFolderId');
|
||||||
|
spyOn(queryBuilder, 'isCustomSourceNode').and.returnValue(false);
|
||||||
|
spyOn(queryBuilder, 'setActiveFilter');
|
||||||
|
|
||||||
|
component.value = undefined;
|
||||||
|
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
|
||||||
|
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
expect(queryBuilder.setActiveFilter).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set active filters correctly', async () => {
|
||||||
spyOn(queryBuilder, 'setCurrentRootFolderId');
|
spyOn(queryBuilder, 'setCurrentRootFolderId');
|
||||||
spyOn(queryBuilder, 'isCustomSourceNode').and.returnValue(false);
|
spyOn(queryBuilder, 'isCustomSourceNode').and.returnValue(false);
|
||||||
|
|
||||||
@@ -105,8 +133,7 @@ describe('FilterHeaderComponent', () => {
|
|||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
expect(queryBuilder.getActiveFilters().length).toBe(0);
|
expect(queryBuilder.getActiveFilters().length).toBe(0);
|
||||||
|
|
||||||
const initialFilterValue = { name: 'pinocchio' };
|
component.value = { name: 'pinocchio' };
|
||||||
component.value = initialFilterValue;
|
|
||||||
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
|
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
|
||||||
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });
|
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -117,6 +144,25 @@ describe('FilterHeaderComponent', () => {
|
|||||||
expect(queryBuilder.getActiveFilters()[0].value).toBe('pinocchio');
|
expect(queryBuilder.getActiveFilters()[0].value).toBe('pinocchio');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should update queryParams if initial value is provided', async () => {
|
||||||
|
spyOn(queryBuilder, 'setCurrentRootFolderId');
|
||||||
|
spyOn(queryBuilder, 'isCustomSourceNode').and.returnValue(false);
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
expect(Object.keys(queryBuilder.filterRawParams).length).toBe(0);
|
||||||
|
|
||||||
|
component.value = { name: 'pinocchio' };
|
||||||
|
const currentFolderNodeIdChange = new SimpleChange('current-node-id', 'next-node-id', true);
|
||||||
|
component.ngOnChanges({ currentFolderId: currentFolderNodeIdChange });
|
||||||
|
fixture.detectChanges();
|
||||||
|
await fixture.whenStable();
|
||||||
|
|
||||||
|
expect(Object.keys(queryBuilder.filterRawParams).length).toBe(1);
|
||||||
|
expect(queryBuilder.filterRawParams['name']).toBe('pinocchio');
|
||||||
|
expect(queryBuilder.queryFragments['name']).toBe('pinocchio');
|
||||||
|
});
|
||||||
|
|
||||||
it('should emit filterSelection when a filter is changed', (done) => {
|
it('should emit filterSelection when a filter is changed', (done) => {
|
||||||
spyOn(queryBuilder, 'getActiveFilters').and.returnValue([{ key: 'name', value: 'pinocchio' }]);
|
spyOn(queryBuilder, 'getActiveFilters').and.returnValue([{ key: 'name', value: 'pinocchio' }]);
|
||||||
|
|
||||||
@@ -156,4 +202,14 @@ describe('FilterHeaderComponent', () => {
|
|||||||
|
|
||||||
queryBuilder.executed.next(mockNodePaging);
|
queryBuilder.executed.next(mockNodePaging);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set isFilterServiceActive on initialization', () => {
|
||||||
|
spyOn(queryBuilder, 'isFilterServiceActive').and.returnValue(true);
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(FilterHeaderComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(component.isFilterServiceActive).toBeTrue();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -57,11 +57,11 @@ export class FilterHeaderComponent implements OnInit, OnChanges {
|
|||||||
@Output()
|
@Output()
|
||||||
filtersCleared: EventEmitter<void> = new EventEmitter();
|
filtersCleared: EventEmitter<void> = new EventEmitter();
|
||||||
|
|
||||||
isFilterServiceActive: boolean;
|
|
||||||
|
|
||||||
private readonly searchFilterQueryBuilder = inject(SearchHeaderQueryBuilderService);
|
private readonly searchFilterQueryBuilder = inject(SearchHeaderQueryBuilderService);
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
|
readonly isFilterServiceActive = this.searchFilterQueryBuilder.isFilterServiceActive();
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.searchFilterQueryBuilder.executed.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((resultSetPaging) => {
|
this.searchFilterQueryBuilder.executed.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((resultSetPaging) => {
|
||||||
// ResultSetPaging is structurally compatible with NodePaging for the document list
|
// ResultSetPaging is structurally compatible with NodePaging for the document list
|
||||||
@@ -109,11 +109,17 @@ export class FilterHeaderComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private initSearchHeader(currentFolderId: string) {
|
private initSearchHeader(currentFolderId: string) {
|
||||||
this.searchFilterQueryBuilder.setCurrentRootFolderId(currentFolderId);
|
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
Object.keys(this.value).forEach((columnKey) => {
|
Object.keys(this.value).forEach((key) => {
|
||||||
this.searchFilterQueryBuilder.setActiveFilter(columnKey, this.value[columnKey]);
|
this.searchFilterQueryBuilder.setActiveFilter(key, this.value[key]);
|
||||||
|
|
||||||
|
const operator = this.searchFilterQueryBuilder.getOperatorForFilterId(key) || 'OR';
|
||||||
|
this.searchFilterQueryBuilder.filterRawParams[key] = this.value[key];
|
||||||
|
this.searchFilterQueryBuilder.queryFragments[key] = Array.isArray(this.value[key])
|
||||||
|
? this.value[key].join(` ${operator} `)
|
||||||
|
: this.value[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
this.searchFilterQueryBuilder.setCurrentRootFolderId(currentFolderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,18 +203,17 @@ describe('SearchCheckListComponent', () => {
|
|||||||
expect(checkedElements.length).toBe(0);
|
expect(checkedElements.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update query with startValue on init, if provided', () => {
|
it('should check the checkbox with startValue on init, if provided', () => {
|
||||||
component.id = 'checkList';
|
component.id = 'checkList';
|
||||||
component.options = new SearchFilterList<SearchListOption>([
|
component.options = new SearchFilterList<SearchListOption>([
|
||||||
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
{ name: 'Folder', value: `TYPE:'cm:folder'`, checked: false },
|
||||||
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
{ name: 'Document', value: `TYPE:'cm:content'`, checked: false }
|
||||||
]);
|
]);
|
||||||
component.startValue = `TYPE:'cm:folder'`;
|
component.startValue = [`TYPE:'cm:folder'`];
|
||||||
component.context.queryFragments[component.id] = 'query';
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
expect(component.options.items[0].checked).toBeTrue();
|
||||||
expect(component.context.queryFragments[component.id]).toBe(`TYPE:'cm:folder'`);
|
expect(component.options.items[1].checked).toBeFalse();
|
||||||
expect(component.context.update).toHaveBeenCalled();
|
expect(component.isActive).toBeTrue();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set query context as blank and not call query update, if no start value was provided', () => {
|
it('should set query context as blank and not call query update, if no start value was provided', () => {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
|
|||||||
context?: SearchQueryBuilderService;
|
context?: SearchQueryBuilderService;
|
||||||
options: SearchFilterList<SearchListOption>;
|
options: SearchFilterList<SearchListOption>;
|
||||||
operator: string = 'OR';
|
operator: string = 'OR';
|
||||||
startValue: string;
|
startValue: string | string[];
|
||||||
pageSize = 5;
|
pageSize = 5;
|
||||||
isActive = false;
|
isActive = false;
|
||||||
enableChangeUpdate = true;
|
enableChangeUpdate = true;
|
||||||
@@ -81,9 +81,8 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
@@ -160,8 +159,8 @@ export class SearchCheckListComponent implements SearchWidget, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setValue(value: any) {
|
setValue(value: any) {
|
||||||
this.options.items.filter((item) => value.includes(item.value)).forEach((item) => (item.checked = true));
|
this.options.items.forEach((item) => (item.checked = value.includes(item.value)));
|
||||||
this.submitValues();
|
this.isActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCheckedValues() {
|
private getCheckedValues() {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export class SearchDateRangeTabbedComponent implements SearchWidget, OnInit {
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
|
|||||||
@@ -79,28 +79,31 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit {
|
|||||||
|
|
||||||
private readonly destroyRef = inject(DestroyRef);
|
private readonly destroyRef = inject(DestroyRef);
|
||||||
|
|
||||||
constructor(private dateAdapter: DateAdapter<Date>, private dateTimeAdapter: DatetimeAdapter<Date>) {}
|
constructor(
|
||||||
|
private readonly dateAdapter: DateAdapter<Date>,
|
||||||
|
private readonly dateTimeAdapter: DatetimeAdapter<Date>
|
||||||
|
) {}
|
||||||
|
|
||||||
getFromValidationMessage(): string {
|
getFromValidationMessage(): string {
|
||||||
return this.from.hasError('invalidOnChange') || this.hasParseError(this.from)
|
return this.from.hasError('invalidOnChange') || this.hasParseError(this.from)
|
||||||
? 'SEARCH.FILTER.VALIDATION.INVALID-DATETIME'
|
? 'SEARCH.FILTER.VALIDATION.INVALID-DATETIME'
|
||||||
: this.from.hasError('matDatepickerMax')
|
: this.from.hasError('matDatepickerMax')
|
||||||
? 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATETIME'
|
? 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATETIME'
|
||||||
: this.from.hasError('required')
|
: this.from.hasError('required')
|
||||||
? 'SEARCH.FILTER.VALIDATION.REQUIRED-VALUE'
|
? 'SEARCH.FILTER.VALIDATION.REQUIRED-VALUE'
|
||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
getToValidationMessage(): string {
|
getToValidationMessage(): string {
|
||||||
return this.to.hasError('invalidOnChange') || this.hasParseError(this.to)
|
return this.to.hasError('invalidOnChange') || this.hasParseError(this.to)
|
||||||
? 'SEARCH.FILTER.VALIDATION.INVALID-DATETIME'
|
? 'SEARCH.FILTER.VALIDATION.INVALID-DATETIME'
|
||||||
: this.to.hasError('matDatepickerMin')
|
: this.to.hasError('matDatepickerMin')
|
||||||
? 'SEARCH.FILTER.VALIDATION.NO-DAYS'
|
? 'SEARCH.FILTER.VALIDATION.NO-DAYS'
|
||||||
: this.to.hasError('matDatepickerMax')
|
: this.to.hasError('matDatepickerMax')
|
||||||
? 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATETIME'
|
? 'SEARCH.FILTER.VALIDATION.BEYOND-MAX-DATETIME'
|
||||||
: this.to.hasError('required')
|
: this.to.hasError('required')
|
||||||
? 'SEARCH.FILTER.VALIDATION.REQUIRED-VALUE'
|
? 'SEARCH.FILTER.VALIDATION.REQUIRED-VALUE'
|
||||||
: '';
|
: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -139,7 +142,7 @@ export class SearchDatetimeRangeComponent implements SearchWidget, OnInit {
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ describe('SearchFilterContainerComponent', () => {
|
|||||||
await applyButton.click();
|
await applyButton.click();
|
||||||
|
|
||||||
expect(queryBuilder.getActiveFilters().length).toBe(1);
|
expect(queryBuilder.getActiveFilters().length).toBe(1);
|
||||||
expect(queryBuilder.getActiveFilters()[0].key).toBe('name');
|
expect(queryBuilder.getActiveFilters()[0].key).toBe('queryName');
|
||||||
expect(queryBuilder.getActiveFilters()[0].value).toBe('searchText');
|
expect(queryBuilder.getActiveFilters()[0].value).toBe('searchText');
|
||||||
|
|
||||||
await menu.open();
|
await menu.open();
|
||||||
@@ -103,12 +103,12 @@ describe('SearchFilterContainerComponent', () => {
|
|||||||
|
|
||||||
await applyButton.click();
|
await applyButton.click();
|
||||||
expect(queryBuilder.getActiveFilters().length).toBe(1);
|
expect(queryBuilder.getActiveFilters().length).toBe(1);
|
||||||
expect(queryBuilder.getActiveFilters()[0].key).toBe('name');
|
expect(queryBuilder.getActiveFilters()[0].key).toBe('queryName');
|
||||||
expect(queryBuilder.getActiveFilters()[0].value).toBe('updated text');
|
expect(queryBuilder.getActiveFilters()[0].value).toBe('updated text');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove active filter after the Clear button is clicked', async () => {
|
it('should remove active filter after the Clear button is clicked', async () => {
|
||||||
queryBuilder.setActiveFilter('name', 'searchText');
|
queryBuilder.setActiveFilter('queryName', 'searchText');
|
||||||
|
|
||||||
const menu = await loader.getHarness(MatMenuHarness);
|
const menu = await loader.getHarness(MatMenuHarness);
|
||||||
await menu.open();
|
await menu.open();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export class SearchFilterContainerComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.category = this.searchFilterQueryBuilder.getCategoryForColumn(this.col.key);
|
this.category = this.searchFilterQueryBuilder.getCategoryForColumn(this.col.key);
|
||||||
this.initialValue = this.value?.[this.col.key] ? this.value[this.col.key] : undefined;
|
this.initialValue = this.value?.[this.category?.id];
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyPressed(event: KeyboardEvent, menuTrigger: MatMenuTrigger) {
|
onKeyPressed(event: KeyboardEvent, menuTrigger: MatMenuTrigger) {
|
||||||
@@ -88,7 +88,7 @@ export class SearchFilterContainerComponent implements OnInit {
|
|||||||
|
|
||||||
onApply() {
|
onApply() {
|
||||||
if (this.widgetContainer.hasValueSelected()) {
|
if (this.widgetContainer.hasValueSelected()) {
|
||||||
this.searchFilterQueryBuilder.setActiveFilter(this.category.columnKey, this.widgetContainer.getCurrentValue());
|
this.searchFilterQueryBuilder.setActiveFilter(this.category.id, this.widgetContainer.getCurrentValue());
|
||||||
this.filterChange.emit();
|
this.filterChange.emit();
|
||||||
this.widgetContainer.applyInnerWidget();
|
this.widgetContainer.applyInnerWidget();
|
||||||
} else {
|
} else {
|
||||||
@@ -103,7 +103,7 @@ export class SearchFilterContainerComponent implements OnInit {
|
|||||||
|
|
||||||
resetSearchFilter() {
|
resetSearchFilter() {
|
||||||
this.widgetContainer.resetInnerWidget();
|
this.widgetContainer.resetInnerWidget();
|
||||||
this.searchFilterQueryBuilder.removeActiveFilter(this.category.columnKey);
|
this.searchFilterQueryBuilder.removeActiveFilter(this.category.id);
|
||||||
this.filterChange.emit();
|
this.filterChange.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ export class SearchFilterContainerComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isActive(): boolean {
|
isActive(): boolean {
|
||||||
return this.searchFilterQueryBuilder.getActiveFilters().findIndex((f: FilterSearch) => f.key === this.category.columnKey) > -1;
|
return this.searchFilterQueryBuilder.getActiveFilters().findIndex((f: FilterSearch) => f.key === this.category.id) > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMenuOpen() {
|
onMenuOpen() {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export class SearchLogicalFilterComponent implements SearchWidget, OnInit {
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export class SearchNumberRangeComponent implements SearchWidget, OnInit {
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
first()
|
first()
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ export class SearchPropertiesComponent implements OnInit, AfterViewChecked, Sear
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export class SearchRadioComponent implements SearchWidget, OnInit {
|
|||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(first())
|
.pipe(first())
|
||||||
.subscribe((filtersQueries) => {
|
.subscribe((filtersQueries) => {
|
||||||
if (filtersQueries[this.id]) {
|
if (filtersQueries?.[this.id]) {
|
||||||
this.value = filtersQueries[this.id];
|
this.value = filtersQueries[this.id];
|
||||||
this.submitValues(false);
|
this.submitValues(false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export class SearchSliderComponent implements SearchWidget, OnInit {
|
|||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(takeUntilDestroyed(this.destroyRef))
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
||||||
.subscribe((filtersQueries) => {
|
.subscribe((filtersQueries) => {
|
||||||
if (filtersQueries[this.id]) {
|
if (filtersQueries?.[this.id]) {
|
||||||
this.value = filtersQueries[this.id];
|
this.value = filtersQueries[this.id];
|
||||||
this.updateQuery(this.value, false);
|
this.updateQuery(this.value, false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ describe('SearchTextComponent', () => {
|
|||||||
|
|
||||||
expect(component.value).toBe('');
|
expect(component.value).toBe('');
|
||||||
expect(component.context.queryFragments[component.id]).toBe('');
|
expect(component.context.queryFragments[component.id]).toBe('');
|
||||||
expect(component.context.filterRawParams[component.id]).toBeNull();
|
expect(component.context.filterRawParams[component.id]).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update query with startValue on init, if provided', () => {
|
it('should update query with startValue on init, if provided', () => {
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export class SearchTextComponent implements SearchWidget, OnInit {
|
|||||||
this.context.populateFilters
|
this.context.populateFilters
|
||||||
.asObservable()
|
.asObservable()
|
||||||
.pipe(
|
.pipe(
|
||||||
map((filtersQueries) => filtersQueries[this.id]),
|
map((filtersQueries) => filtersQueries?.[this.id]),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
)
|
)
|
||||||
.subscribe((filterQuery) => {
|
.subscribe((filterQuery) => {
|
||||||
@@ -99,6 +99,8 @@ export class SearchTextComponent implements SearchWidget, OnInit {
|
|||||||
|
|
||||||
reset(updateContext = true) {
|
reset(updateContext = true) {
|
||||||
this.value = '';
|
this.value = '';
|
||||||
|
this.context.filterRawParams[this.id] = undefined;
|
||||||
|
this.context.queryFragments[this.id] = '';
|
||||||
this.updateQuery(null, updateContext);
|
this.updateQuery(null, updateContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,7 +113,10 @@ export class SearchTextComponent implements SearchWidget, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateQuery(value: string, updateContext = true) {
|
private updateQuery(value: string, updateContext = true) {
|
||||||
this.context.filterRawParams[this.id] = value;
|
if (value !== null) {
|
||||||
|
this.context.filterRawParams[this.id] = value;
|
||||||
|
}
|
||||||
|
|
||||||
this.displayValue$.next(value);
|
this.displayValue$.next(value);
|
||||||
if (this.context && this.settings && this.settings.field) {
|
if (this.context && this.settings && this.settings.field) {
|
||||||
this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${this.getSearchPrefix()}${value}${this.getSearchSuffix()}'` : '';
|
this.context.queryFragments[this.id] = value ? `${this.settings.field}:'${this.getSearchPrefix()}${value}${this.getSearchSuffix()}'` : '';
|
||||||
|
|||||||
@@ -22,10 +22,12 @@ import { TestBed } from '@angular/core/testing';
|
|||||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { SearchCategory } from '../models';
|
||||||
|
|
||||||
describe('SearchHeaderQueryBuilderService', () => {
|
describe('SearchHeaderQueryBuilderService', () => {
|
||||||
let activatedRoute: ActivatedRoute;
|
let activatedRoute: ActivatedRoute;
|
||||||
let router: Router;
|
let router: Router;
|
||||||
|
let builderService: SearchHeaderQueryBuilderService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -33,6 +35,7 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
});
|
});
|
||||||
router = TestBed.inject(Router);
|
router = TestBed.inject(Router);
|
||||||
activatedRoute = TestBed.inject(ActivatedRoute);
|
activatedRoute = TestBed.inject(ActivatedRoute);
|
||||||
|
builderService = TestBed.inject(SearchHeaderQueryBuilderService);
|
||||||
});
|
});
|
||||||
|
|
||||||
const buildConfig = (searchSettings): AppConfigService => {
|
const buildConfig = (searchSettings): AppConfigService => {
|
||||||
@@ -43,10 +46,13 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
|
|
||||||
it('should load the configuration from app config', () => {
|
it('should load the configuration from app config', () => {
|
||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const config: SearchConfiguration = {
|
const config = {
|
||||||
categories: [{ id: 'cat1', enabled: true } as any, { id: 'cat2', enabled: true } as any],
|
categories: [
|
||||||
|
{ id: 'cat1', enabled: true },
|
||||||
|
{ id: 'cat2', enabled: true }
|
||||||
|
],
|
||||||
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
||||||
};
|
} as SearchConfiguration;
|
||||||
|
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
const builder = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
const builder = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
@@ -66,13 +72,13 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
|
|
||||||
it('should return the category assigned to a column key', () => {
|
it('should return the category assigned to a column key', () => {
|
||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const config: SearchConfiguration = {
|
const config = {
|
||||||
categories: [
|
categories: [
|
||||||
{ id: 'cat1', columnKey: 'fake-key-1', enabled: true } as any,
|
{ id: 'cat1', columnKey: 'fake-key-1', enabled: true },
|
||||||
{ id: 'cat2', columnKey: 'fake-key-2', enabled: true } as any
|
{ id: 'cat2', columnKey: 'fake-key-2', enabled: true }
|
||||||
],
|
],
|
||||||
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
||||||
};
|
} as SearchConfiguration;
|
||||||
|
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
const service = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
const service = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
@@ -84,6 +90,25 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return operator for a category by id', () => {
|
||||||
|
TestBed.runInInjectionContext(() => {
|
||||||
|
const config: SearchConfiguration = {
|
||||||
|
categories: [
|
||||||
|
{ id: 'cat1', columnKey: 'fake-key-1', enabled: true, component: { settings: { operator: 'operator' } } },
|
||||||
|
{ id: 'cat2', columnKey: 'fake-key-2', enabled: true }
|
||||||
|
] as SearchCategory[]
|
||||||
|
};
|
||||||
|
|
||||||
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
|
const service = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
|
|
||||||
|
const operator = service.getOperatorForFilterId('cat1');
|
||||||
|
expect(operator).toBe('operator');
|
||||||
|
const operator1 = service.getOperatorForFilterId('cat2');
|
||||||
|
expect(operator1).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should have empty user query by default', () => {
|
it('should have empty user query by default', () => {
|
||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
@@ -94,10 +119,13 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
|
|
||||||
it('should add the extra filter for the parent node', () => {
|
it('should add the extra filter for the parent node', () => {
|
||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const config: SearchConfiguration = {
|
const config = {
|
||||||
categories: [{ id: 'cat1', enabled: true } as any, { id: 'cat2', enabled: true } as any],
|
categories: [
|
||||||
|
{ id: 'cat1', enabled: true },
|
||||||
|
{ id: 'cat2', enabled: true }
|
||||||
|
],
|
||||||
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
filterQueries: [{ query: 'query1' }, { query: 'query2' }]
|
||||||
};
|
} as SearchConfiguration;
|
||||||
|
|
||||||
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
||||||
|
|
||||||
@@ -114,10 +142,13 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
const expectedResult = [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id"' }];
|
||||||
|
|
||||||
const config: SearchConfiguration = {
|
const config = {
|
||||||
categories: [{ id: 'cat1', enabled: true } as any, { id: 'cat2', enabled: true } as any],
|
categories: [
|
||||||
|
{ id: 'cat1', enabled: true },
|
||||||
|
{ id: 'cat2', enabled: true }
|
||||||
|
],
|
||||||
filterQueries: expectedResult
|
filterQueries: expectedResult
|
||||||
};
|
} as SearchConfiguration;
|
||||||
|
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
@@ -132,10 +163,10 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
TestBed.runInInjectionContext(() => {
|
TestBed.runInInjectionContext(() => {
|
||||||
const activeFilter = 'FakeColumn';
|
const activeFilter = 'FakeColumn';
|
||||||
|
|
||||||
const config: SearchConfiguration = {
|
const config = {
|
||||||
categories: [{ id: 'cat1', enabled: true } as any],
|
categories: [{ id: 'cat1', enabled: true }],
|
||||||
filterQueries: [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id' }]
|
filterQueries: [{ query: 'PARENT:"workspace://SpacesStore/fake-node-id' }]
|
||||||
};
|
} as SearchConfiguration;
|
||||||
|
|
||||||
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
const alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||||
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
const searchHeaderService = new SearchHeaderQueryBuilderService(buildConfig(config), alfrescoApiService, null);
|
||||||
@@ -153,10 +184,11 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
it('should use properly encoded query containing non-latin character when calls router.navigate', () => {
|
it('should use properly encoded query containing non-latin character when calls router.navigate', () => {
|
||||||
spyOn(router, 'navigate');
|
spyOn(router, 'navigate');
|
||||||
spyOn(console, 'error');
|
spyOn(console, 'error');
|
||||||
const service = TestBed.inject(SearchHeaderQueryBuilderService);
|
builderService.filterRawParams = {
|
||||||
service.filterRawParams = { userQuery: '((cm:name:"wąż*" OR cm:title:"wąż*" OR cm:description:"wąż*" OR TEXT:"wąż*" OR TAG:"wąż*"))' };
|
userQuery: '((cm:name:"wąż*" OR cm:title:"wąż*" OR cm:description:"wąż*" OR TEXT:"wąż*" OR TAG:"wąż*"))'
|
||||||
|
};
|
||||||
|
|
||||||
service.updateSearchQueryParams();
|
builderService.updateSearchQueryParams();
|
||||||
expect(console.error).not.toHaveBeenCalled();
|
expect(console.error).not.toHaveBeenCalled();
|
||||||
expect(router.navigate).toHaveBeenCalledWith([], {
|
expect(router.navigate).toHaveBeenCalledWith([], {
|
||||||
relativeTo: activatedRoute,
|
relativeTo: activatedRoute,
|
||||||
@@ -173,11 +205,12 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
spyOn(router, 'navigate');
|
spyOn(router, 'navigate');
|
||||||
spyOn(console, 'error');
|
spyOn(console, 'error');
|
||||||
const searchUrl = 'search';
|
const searchUrl = 'search';
|
||||||
const service = TestBed.inject(SearchHeaderQueryBuilderService);
|
builderService.filterRawParams = {
|
||||||
service.filterRawParams = { userQuery: '((cm:name:"wąż*" OR cm:title:"wąż*" OR cm:description:"wąż*" OR TEXT:"wąż*" OR TAG:"wąż*"))' };
|
userQuery: '((cm:name:"wąż*" OR cm:title:"wąż*" OR cm:description:"wąż*" OR TEXT:"wąż*" OR TAG:"wąż*"))'
|
||||||
service.encodeQuery();
|
};
|
||||||
|
builderService.encodeQuery();
|
||||||
|
|
||||||
await service.navigateToSearch('', searchUrl);
|
await builderService.navigateToSearch('', searchUrl);
|
||||||
expect(console.error).not.toHaveBeenCalled();
|
expect(console.error).not.toHaveBeenCalled();
|
||||||
expect(router.navigate).toHaveBeenCalledWith([searchUrl], {
|
expect(router.navigate).toHaveBeenCalledWith([searchUrl], {
|
||||||
queryParams: {
|
queryParams: {
|
||||||
@@ -187,4 +220,36 @@ describe('SearchHeaderQueryBuilderService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should trigger execute() in setCurrentRootFolderId() once there are active filters', () => {
|
||||||
|
spyOn(builderService, 'execute').and.stub();
|
||||||
|
builderService.activeFilters = [{ key: 'key', value: 'value' }];
|
||||||
|
builderService.setCurrentRootFolderId('node-id');
|
||||||
|
|
||||||
|
expect(builderService.execute).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should NOT trigger execute() in setCurrentRootFolderId() once there are NO active filters', () => {
|
||||||
|
spyOn(builderService, 'execute').and.stub();
|
||||||
|
builderService.activeFilters = [];
|
||||||
|
builderService.setCurrentRootFolderId('node-id');
|
||||||
|
|
||||||
|
expect(builderService.execute).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should trigger execute() in setSorting() once there are active filters', () => {
|
||||||
|
spyOn(builderService, 'execute').and.stub();
|
||||||
|
builderService.activeFilters = [{ key: 'key', value: 'value' }];
|
||||||
|
builderService.setSorting([]);
|
||||||
|
|
||||||
|
expect(builderService.execute).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should NOT trigger execute() in setSorting() once there are NO active filters', () => {
|
||||||
|
spyOn(builderService, 'execute').and.stub();
|
||||||
|
builderService.activeFilters = [];
|
||||||
|
builderService.setSorting([]);
|
||||||
|
|
||||||
|
expect(builderService.execute).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -36,7 +36,11 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
|
|||||||
|
|
||||||
activeFilters: FilterSearch[] = [];
|
activeFilters: FilterSearch[] = [];
|
||||||
|
|
||||||
constructor(appConfig: AppConfigService, alfrescoApiService: AlfrescoApiService, private nodeApiService: NodesApiService) {
|
constructor(
|
||||||
|
appConfig: AppConfigService,
|
||||||
|
alfrescoApiService: AlfrescoApiService,
|
||||||
|
private readonly nodeApiService: NodesApiService
|
||||||
|
) {
|
||||||
super(appConfig, alfrescoApiService);
|
super(appConfig, alfrescoApiService);
|
||||||
|
|
||||||
this.updated.pipe(filter((query) => !!query)).subscribe(() => {
|
this.updated.pipe(filter((query) => !!query)).subscribe(() => {
|
||||||
@@ -108,7 +112,9 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.execute();
|
if (!this.isNoFilterActive()) {
|
||||||
|
this.execute(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSortingFieldFromColumnName(columnName: string) {
|
private getSortingFieldFromColumnName(columnName: string) {
|
||||||
@@ -127,6 +133,12 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
|
|||||||
return foundCategory;
|
return foundCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getOperatorForFilterId(id: string): string | undefined {
|
||||||
|
const foundCategory = this.categories?.find((category) => category.id === id);
|
||||||
|
|
||||||
|
return foundCategory?.component?.settings?.operator;
|
||||||
|
}
|
||||||
|
|
||||||
setCurrentRootFolderId(currentFolderId: string) {
|
setCurrentRootFolderId(currentFolderId: string) {
|
||||||
const alreadyAddedFilter = this.filterQueries.find((filterQueries) => filterQueries.query.includes(currentFolderId));
|
const alreadyAddedFilter = this.filterQueries.find((filterQueries) => filterQueries.query.includes(currentFolderId));
|
||||||
|
|
||||||
@@ -140,7 +152,9 @@ export class SearchHeaderQueryBuilderService extends BaseQueryBuilderService {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
this.execute();
|
if (!this.isNoFilterActive()) {
|
||||||
|
this.execute(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isCustomSourceNode(currentNodeId: string): boolean {
|
isCustomSourceNode(currentNodeId: string): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user