Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Chore: move advanced search to the bottom in the filter editor (#14130)

shamoona419f1ffacbf
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts
index 207013037..9bf88ae69 100644
--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts
+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.spec.ts
@@ -1423,11 +1423,16 @@ describe('FilterEditorComponent', () => {
])
})
+ const clickTextFilterTarget = (name: string) => {
+ const item = fixture.debugElement
+ .queryAll(By.directive(NgbDropdownItem))
+ .find((el) => el.nativeElement.textContent.trim() === name)
+ expect(item).not.toBeUndefined()
+ item.triggerEventHandler('click')
+ }
+
it('should convert duplicate target input to the correct filter rule', () => {
- const textFieldTargetDropdown = fixture.debugElement.queryAll(
- By.directive(NgbDropdownItem)
- )[5]
- textFieldTargetDropdown.triggerEventHandler('click')
+ clickTextFilterTarget('Duplicates')
fixture.detectChanges()
expect(component.textFilterTarget).toEqual('duplicates')
@@ -1453,10 +1458,7 @@ describe('FilterEditorComponent', () => {
it('should convert user input to correct filter rules on full text query', () => {
component.textFilterInput.nativeElement.value = 'foo'
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
- const textFieldTargetDropdown = fixture.debugElement.queryAll(
- By.directive(NgbDropdownItem)
- )[4]
- textFieldTargetDropdown.triggerEventHandler('click') // TEXT_FILTER_TARGET_FULLTEXT_QUERY
+ clickTextFilterTarget('Advanced search')
fixture.detectChanges()
tick(400)
expect(component.textFilterTarget).toEqual('fulltext-query')
@@ -1925,10 +1927,7 @@ describe('FilterEditorComponent', () => {
it('should leave relative dates not in quick list intact', () => {
component.textFilterInput.nativeElement.value = 'created:[-2 week to now]'
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
- const textFieldTargetDropdown = fixture.debugElement.queryAll(
- By.directive(NgbDropdownItem)
- )[4]
- textFieldTargetDropdown.triggerEventHandler('click')
+ clickTextFilterTarget('Advanced search')
fixture.detectChanges()
tick(400)
expect(component.filterRules).toEqual([
diff --git a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
index ed08cee1d..7da3f6373 100644
--- a/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
+++ b/src-ui/src/app/components/document-list/filter-editor/filter-editor.component.ts
@@ -205,11 +205,11 @@ const DEFAULT_TEXT_FILTER_TARGET_OPTIONS = [
},
{ id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN` },
{ id: TEXT_FILTER_TARGET_MIME_TYPE, name: $localize`File type` },
+ { id: TEXT_FILTER_TARGET_DUPLICATES, name: $localize`Duplicates` },
{
id: TEXT_FILTER_TARGET_FULLTEXT_QUERY,
name: $localize`Advanced search`,
},
- { id: TEXT_FILTER_TARGET_DUPLICATES, name: $localize`Duplicates` },
]
const DEPRECATED_CUSTOM_FIELDS_TEXT_FILTER_TARGET_OPTION = {