Add back custom field text search field
This commit is contained in:
parent
36f33e59de
commit
047754ea63
@ -316,15 +316,15 @@ describe('FilterEditorComponent', () => {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
it('should ingest text filter rules for custom fields', fakeAsync(() => {
|
it('should ingest text filter rules for custom fields', fakeAsync(() => {
|
||||||
// expect(component.textFilter).toEqual(null)
|
expect(component.textFilter).toEqual(null)
|
||||||
// component.filterRules = [
|
component.filterRules = [
|
||||||
// {
|
{
|
||||||
// rule_type: FILTER_CUSTOM_FIELDS_TEXT,
|
rule_type: FILTER_CUSTOM_FIELDS_TEXT,
|
||||||
// value: 'foo',
|
value: 'foo',
|
||||||
// },
|
},
|
||||||
// ]
|
]
|
||||||
// expect(component.textFilter).toEqual('foo')
|
expect(component.textFilter).toEqual('foo')
|
||||||
// expect(component.textFilterTarget).toEqual('custom-fields') // TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
expect(component.textFilterTarget).toEqual('custom-fields') // TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
||||||
}))
|
}))
|
||||||
|
|
||||||
it('should ingest text filter rules for doc asn is null', fakeAsync(() => {
|
it('should ingest text filter rules for doc asn is null', fakeAsync(() => {
|
||||||
@ -1170,21 +1170,21 @@ describe('FilterEditorComponent', () => {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
it('should convert user input to correct filter rules on custom fields query', fakeAsync(() => {
|
it('should convert user input to correct filter rules on custom fields query', fakeAsync(() => {
|
||||||
// component.textFilterInput.nativeElement.value = 'foo'
|
component.textFilterInput.nativeElement.value = 'foo'
|
||||||
// component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
||||||
// const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
||||||
// By.directive(NgbDropdownItem)
|
By.directive(NgbDropdownItem)
|
||||||
// )[3]
|
)[3]
|
||||||
// textFieldTargetDropdown.triggerEventHandler('click') // TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
textFieldTargetDropdown.triggerEventHandler('click') // TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
||||||
// fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
// tick(400)
|
tick(400)
|
||||||
// expect(component.textFilterTarget).toEqual('custom-fields')
|
expect(component.textFilterTarget).toEqual('custom-fields')
|
||||||
// expect(component.filterRules).toEqual([
|
expect(component.filterRules).toEqual([
|
||||||
// {
|
{
|
||||||
// rule_type: FILTER_CUSTOM_FIELDS_TEXT,
|
rule_type: FILTER_CUSTOM_FIELDS_TEXT,
|
||||||
// value: 'foo',
|
value: 'foo',
|
||||||
// },
|
},
|
||||||
// ])
|
])
|
||||||
}))
|
}))
|
||||||
|
|
||||||
it('should convert user input to correct filter rules on full text query', fakeAsync(() => {
|
it('should convert user input to correct filter rules on full text query', fakeAsync(() => {
|
||||||
@ -1192,7 +1192,7 @@ describe('FilterEditorComponent', () => {
|
|||||||
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
||||||
const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
||||||
By.directive(NgbDropdownItem)
|
By.directive(NgbDropdownItem)
|
||||||
)[3]
|
)[4]
|
||||||
textFieldTargetDropdown.triggerEventHandler('click') // TEXT_FILTER_TARGET_ASN
|
textFieldTargetDropdown.triggerEventHandler('click') // TEXT_FILTER_TARGET_ASN
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
tick(400)
|
tick(400)
|
||||||
@ -1596,7 +1596,7 @@ describe('FilterEditorComponent', () => {
|
|||||||
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
component.textFilterInput.nativeElement.dispatchEvent(new Event('input'))
|
||||||
const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
const textFieldTargetDropdown = fixture.debugElement.queryAll(
|
||||||
By.directive(NgbDropdownItem)
|
By.directive(NgbDropdownItem)
|
||||||
)[3]
|
)[4]
|
||||||
textFieldTargetDropdown.triggerEventHandler('click')
|
textFieldTargetDropdown.triggerEventHandler('click')
|
||||||
fixture.detectChanges()
|
fixture.detectChanges()
|
||||||
tick(400)
|
tick(400)
|
||||||
|
@ -97,6 +97,7 @@ import {
|
|||||||
CustomFieldQueriesModel,
|
CustomFieldQueriesModel,
|
||||||
CustomFieldQueryAtom,
|
CustomFieldQueryAtom,
|
||||||
CustomFieldQueryExpression,
|
CustomFieldQueryExpression,
|
||||||
|
CustomFieldQueryLogicalOperator,
|
||||||
} from '../../common/custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
} from '../../common/custom-fields-query-dropdown/custom-fields-query-dropdown.component'
|
||||||
|
|
||||||
const TEXT_FILTER_TARGET_TITLE = 'title'
|
const TEXT_FILTER_TARGET_TITLE = 'title'
|
||||||
@ -104,6 +105,7 @@ const TEXT_FILTER_TARGET_TITLE_CONTENT = 'title-content'
|
|||||||
const TEXT_FILTER_TARGET_ASN = 'asn'
|
const TEXT_FILTER_TARGET_ASN = 'asn'
|
||||||
const TEXT_FILTER_TARGET_FULLTEXT_QUERY = 'fulltext-query'
|
const TEXT_FILTER_TARGET_FULLTEXT_QUERY = 'fulltext-query'
|
||||||
const TEXT_FILTER_TARGET_FULLTEXT_MORELIKE = 'fulltext-morelike'
|
const TEXT_FILTER_TARGET_FULLTEXT_MORELIKE = 'fulltext-morelike'
|
||||||
|
const TEXT_FILTER_TARGET_CUSTOM_FIELDS = 'custom-fields'
|
||||||
|
|
||||||
const TEXT_FILTER_MODIFIER_EQUALS = 'equals'
|
const TEXT_FILTER_MODIFIER_EQUALS = 'equals'
|
||||||
const TEXT_FILTER_MODIFIER_NULL = 'is null'
|
const TEXT_FILTER_MODIFIER_NULL = 'is null'
|
||||||
@ -139,6 +141,10 @@ const DEFAULT_TEXT_FILTER_TARGET_OPTIONS = [
|
|||||||
name: $localize`Title & content`,
|
name: $localize`Title & content`,
|
||||||
},
|
},
|
||||||
{ id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN` },
|
{ id: TEXT_FILTER_TARGET_ASN, name: $localize`ASN` },
|
||||||
|
{
|
||||||
|
id: TEXT_FILTER_TARGET_CUSTOM_FIELDS,
|
||||||
|
name: $localize`Custom fields`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
id: TEXT_FILTER_TARGET_FULLTEXT_QUERY,
|
id: TEXT_FILTER_TARGET_FULLTEXT_QUERY,
|
||||||
name: $localize`Advanced search`,
|
name: $localize`Advanced search`,
|
||||||
@ -384,7 +390,8 @@ export class FilterEditorComponent
|
|||||||
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||||
break
|
break
|
||||||
case FILTER_CUSTOM_FIELDS_TEXT:
|
case FILTER_CUSTOM_FIELDS_TEXT:
|
||||||
console.log('FILTER_CUSTOM_FIELDS_TEXT', rule.value)
|
this._textFilter = rule.value
|
||||||
|
this.textFilterTarget = TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
||||||
break
|
break
|
||||||
case FILTER_FULLTEXT_QUERY:
|
case FILTER_FULLTEXT_QUERY:
|
||||||
let allQueryArgs = rule.value.split(',')
|
let allQueryArgs = rule.value.split(',')
|
||||||
@ -543,22 +550,6 @@ export class FilterEditorComponent
|
|||||||
// TODO: handle error?
|
// TODO: handle error?
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case FILTER_HAS_CUSTOM_FIELDS_ALL:
|
|
||||||
console.log('FILTER_HAS_CUSTOM_FIELDS_ALL', rule.value)
|
|
||||||
// TODO: fully implement
|
|
||||||
break
|
|
||||||
case FILTER_HAS_CUSTOM_FIELDS_ANY:
|
|
||||||
console.log('FILTER_HAS_CUSTOM_FIELDS_ANY', rule.value)
|
|
||||||
// TODO: fully implement
|
|
||||||
break
|
|
||||||
case FILTER_HAS_ANY_CUSTOM_FIELDS:
|
|
||||||
console.log('FILTER_HAS_ANY_CUSTOM_FIELDS', rule.value)
|
|
||||||
// TODO: fully implement
|
|
||||||
break
|
|
||||||
case FILTER_DOES_NOT_HAVE_CUSTOM_FIELDS:
|
|
||||||
console.log('FILTER_DOES_NOT_HAVE_CUSTOM_FIELDS', rule.value)
|
|
||||||
// TODO: fully implement
|
|
||||||
break
|
|
||||||
case FILTER_ASN_ISNULL:
|
case FILTER_ASN_ISNULL:
|
||||||
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
this.textFilterTarget = TEXT_FILTER_TARGET_ASN
|
||||||
this.textFilterModifier =
|
this.textFilterModifier =
|
||||||
@ -661,6 +652,15 @@ export class FilterEditorComponent
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
this._textFilter &&
|
||||||
|
this.textFilterTarget == TEXT_FILTER_TARGET_CUSTOM_FIELDS
|
||||||
|
) {
|
||||||
|
filterRules.push({
|
||||||
|
rule_type: FILTER_CUSTOM_FIELDS_TEXT,
|
||||||
|
value: this._textFilter,
|
||||||
|
})
|
||||||
|
}
|
||||||
if (
|
if (
|
||||||
this._textFilter &&
|
this._textFilter &&
|
||||||
this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_QUERY
|
this.textFilterTarget == TEXT_FILTER_TARGET_FULLTEXT_QUERY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user