diff --git a/src-ui/messages.xlf b/src-ui/messages.xlf index 590cff745..643b5f896 100644 --- a/src-ui/messages.xlf +++ b/src-ui/messages.xlf @@ -698,7 +698,7 @@ src/app/components/common/input/document-link/document-link.component.html - 50 + 51 src/app/components/common/permissions-dialog/permissions-dialog.component.html @@ -3308,11 +3308,11 @@ src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 72 + 73 src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 78 + 79 @@ -3323,25 +3323,25 @@ src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 73 + 74 src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 79 + 80 Search docs... src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 95 + 96 Any src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 124 + 126 src/app/components/common/filterable-dropdown/filterable-dropdown.component.html @@ -3352,7 +3352,7 @@ All src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 126 + 128 src/app/components/common/filterable-dropdown/filterable-dropdown.component.html @@ -3379,21 +3379,21 @@ Not src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 129 + 131 Add query src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 148 + 150 Add expression src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html - 151 + 153 @@ -4798,14 +4798,14 @@ Remove link src/app/components/common/input/document-link/document-link.component.html - 42 + 43 Open link src/app/components/common/input/document-link/document-link.component.html - 43 + 44 src/app/components/common/input/url/url.component.html diff --git a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html index 70141c01c..9da2886f4 100644 --- a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html +++ b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.html @@ -46,6 +46,7 @@ [items]="getSelectOptionsForField(atom.field)" [(ngModel)]="atom.value" [disabled]="disabled" + (mousedown)="$event.stopImmediatePropagation()" > } @else { @@ -101,6 +102,7 @@ [(ngModel)]="atom.value" [disabled]="disabled" [multiple]="true" + (mousedown)="$event.stopImmediatePropagation()" > } @case (CustomFieldQueryOperator.Exact) { diff --git a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.spec.ts b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.spec.ts index e5ceb8dec..e6199c696 100644 --- a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.spec.ts +++ b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.spec.ts @@ -230,6 +230,16 @@ describe('CustomFieldsQueryDropdownComponent', () => { expect(model.isValid()).toBeFalsy() }) + it('should validate an atom with in or contains operator', () => { + const atom = new CustomFieldQueryAtom([1, 'in', '[1,2,3]']) + expect(model['validateAtom'].apply(null, [atom])).toBeTruthy() + atom.operator = 'contains' + atom.value = [1, 2, 3] + expect(model['validateAtom'].apply(null, [atom])).toBeTruthy() + atom.value = null + expect(model['validateAtom'].apply(null, [atom])).toBeFalsy() + }) + it('should check if model is empty', () => { expect(model.isEmpty()).toBeTruthy() model.addExpression() diff --git a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.ts b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.ts index 633bc714f..923907158 100644 --- a/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.ts +++ b/src-ui/src/app/components/common/custom-fields-query-dropdown/custom-fields-query-dropdown.component.ts @@ -53,7 +53,17 @@ export class CustomFieldQueriesModel { } private validateAtom(atom: CustomFieldQueryAtom) { - return !!(atom.field && atom.operator && atom.value !== null) + let valid = !!(atom.field && atom.operator && atom.value !== null) + if ( + [ + CustomFieldQueryOperator.In.valueOf(), + CustomFieldQueryOperator.Contains.valueOf(), + ].includes(atom.operator) && + atom.value + ) { + valid = valid && atom.value.length > 0 + } + return valid } private validateExpression(expression: CustomFieldQueryExpression) { diff --git a/src-ui/src/app/components/common/input/document-link/document-link.component.html b/src-ui/src/app/components/common/input/document-link/document-link.component.html index 24dcfdca9..94f4f21b4 100644 --- a/src-ui/src/app/components/common/input/document-link/document-link.component.html +++ b/src-ui/src/app/components/common/input/document-link/document-link.component.html @@ -36,6 +36,7 @@ [minTermLength]="2" [loading]="loading" [typeahead]="documentsInput$" + (mousedown)="$event.stopImmediatePropagation()" (change)="onChange(selectedDocuments)">