Skip to content

Commit deaba83

Browse files
fix: [DHIS2-20305] change TEA unique filter text to 'Exact matches only' (#4400)
1 parent 8c36692 commit deaba83

File tree

9 files changed

+20
-8
lines changed

9 files changed

+20
-8
lines changed

i18n/en.pot

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ msgstr ""
55
"Content-Type: text/plain; charset=utf-8\n"
66
"Content-Transfer-Encoding: 8bit\n"
77
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
8-
"POT-Creation-Date: 2025-10-23T11:41:11.943Z\n"
9-
"PO-Revision-Date: 2025-10-23T11:41:11.943Z\n"
8+
"POT-Creation-Date: 2025-11-11T14:11:11.392Z\n"
9+
"PO-Revision-Date: 2025-11-11T14:11:11.392Z\n"
1010

1111
msgid "Choose one or more dates..."
1212
msgstr "Choose one or more dates..."
@@ -495,6 +495,9 @@ msgstr "Max"
495495
msgid "Min"
496496
msgstr "Min"
497497

498+
msgid "Exact matches only"
499+
msgstr "Exact matches only"
500+
498501
msgid "Contains text"
499502
msgstr "Contains text"
500503

@@ -2138,7 +2141,7 @@ msgid ""
21382141
"The following attribute type is not supported for searching and has been "
21392142
"hidden"
21402143
msgid_plural ""
2141-
"The following attribute types is not supported for searching and has been "
2144+
"The following attribute type is not supported for searching and has been "
21422145
"hidden"
21432146
msgstr[0] ""
21442147
"The following attribute type is not supported for searching and has been "

src/core_modules/capture-core/components/FiltersForTypes/Text/Input.component.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type Props = {
77
onEnterKey: (value: string | undefined) => void;
88
value: string | undefined;
99
onBlur: (value: string) => void;
10+
unique: boolean;
1011
};
1112

1213
class InputPlain extends React.Component<Props> {
@@ -19,11 +20,11 @@ class InputPlain extends React.Component<Props> {
1920
};
2021

2122
render() {
22-
const { onEnterKey, ...passOnProps } = this.props;
23+
const { onEnterKey, unique, ...passOnProps } = this.props;
2324
return (
2425
<D2TextField
2526
onKeyDown={this.handleKeyDown}
26-
placeholder={i18n.t('Contains text')}
27+
placeholder={unique ? i18n.t('Exact matches only') : i18n.t('Contains text')}
2728
{...passOnProps}
2829
/>
2930
);

src/core_modules/capture-core/components/FiltersForTypes/Text/Text.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export type TextFilterProps = {
44
onCommitValue: (value: Value) => void;
55
onUpdate: (updatedValue: Value) => void;
66
value: Value;
7+
unique: boolean;
78
};
89

src/core_modules/capture-core/components/FiltersForTypes/Text/TextFilter.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class TextFilter extends Component<TextFilterProps> implements UpdatableF
3636
handleNotEmptyValueCheckboxChange = makeCheckboxHandler(NOT_EMPTY_VALUE_FILTER)(this.props.onCommitValue);
3737

3838
render() {
39-
const { value } = this.props;
39+
const { value, unique } = this.props;
4040

4141
return (
4242
<>
@@ -51,6 +51,7 @@ export class TextFilter extends Component<TextFilterProps> implements UpdatableF
5151
onBlur={this.handleBlur}
5252
onEnterKey={this.handleEnterKey}
5353
value={!isEmptyValueFilter(value) ? value : ''}
54+
unique={unique}
5455
/>
5556
</>
5657
);

src/core_modules/capture-core/components/FiltersForTypes/Text/TextFilterManager.component.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ type Props = {
99
filterTypeRef: (instance: any) => void;
1010
handleCommitValue: () => void;
1111
onUpdate: (updatedValue: Value) => void;
12+
unique: boolean;
1213
};
1314

1415
type State = {

src/core_modules/capture-core/components/ListView/Filters/Contents/filterSelectorContents.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ type PassOnProps = Readonly<{
77
onUpdate: (value: any) => void;
88
onRemove: () => void;
99
isRemovable?: boolean;
10+
unique: boolean;
1011
}>;
1112

1213
export type Props = Readonly<{

src/core_modules/capture-core/components/ListView/Filters/FilterButton/FilterButtonMain.component.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type Props = {
2929
type: string;
3030
options?: Options | null;
3131
multiValueFilter?: boolean;
32+
unique: boolean;
3233
title: string;
3334
onUpdateFilter: UpdateFilter;
3435
onClearFilter: ClearFilter;
@@ -105,13 +106,14 @@ class FilterButtonMainPlain extends React.Component<Props & WithStyles<typeof ge
105106
}
106107

107108
renderSelectorContents() {
108-
const { itemId: id, type, options, multiValueFilter, filterValue, isRemovable } = this.props;
109+
const { itemId: id, type, options, multiValueFilter, filterValue, isRemovable, unique } = this.props;
109110

110111
return (
111112
<FilterSelectorContents
112113
type={type}
113114
options={options}
114115
multiValueFilter={multiValueFilter}
116+
unique={unique}
115117
id={id}
116118
onUpdate={this.handleFilterUpdate}
117119
onClose={this.onClose}

src/core_modules/capture-core/components/ListView/Filters/FilterButton/filterButton.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type Props = {
99
title: string;
1010
options?: Options | null;
1111
multiValueFilter?: boolean;
12+
unique: boolean;
1213
disabled?: boolean;
1314
tooltipContent?: string;
1415
onSetVisibleSelector: (itemId?: string | null) => void;

src/core_modules/capture-core/components/ListView/Filters/Filters.component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const renderIndividualFilterButtons = ({
220220
onRemoveFilter: RemoveFilter;
221221
classes: any;
222222
}) => [...(filtersOnly || []), ...individualElementsArray]
223-
.map(({ id, type, header, options, multiValueFilter, disabled, tooltipContent, mainButton }: any) => (
223+
.map(({ id, type, header, options, multiValueFilter, disabled, tooltipContent, mainButton, unique }: any) => (
224224
<div
225225
key={id}
226226
data-test={`filter-button-container-${id}`}
@@ -235,6 +235,7 @@ const renderIndividualFilterButtons = ({
235235
disabled={disabled}
236236
tooltipContent={tooltipContent}
237237
multiValueFilter={multiValueFilter}
238+
unique={unique}
238239
onSetVisibleSelector={onSetVisibleSelector}
239240
selectorVisible={id === visibleSelectorId}
240241
onUpdateFilter={onUpdateFilter}

0 commit comments

Comments
 (0)