diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js index 5dec6a51c8..0ea9a70912 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.component.js @@ -26,8 +26,8 @@ export const ChangelogComponent = ({ pager, columnToSortBy, setColumnToSortBy, - fieldToFilterBy, - setfieldToFilterBy, + attributeToFilterBy, + setAttributeToFilterBy, filterValue, setFilterValue, setPage, @@ -45,8 +45,8 @@ export const ChangelogComponent = ({ {i18n.t('Changelog')} ); diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.types.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.types.js index 69f6b212d7..d8807db663 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.types.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/Changelog/Changelog.types.js @@ -71,8 +71,8 @@ export type ChangelogProps = { setColumnToSortBy: (string) => void, sortDirection: SortDirection, setSortDirection: SetSortDirection, - fieldToFilterBy?: string | null, - setfieldToFilterBy: (string | null) => void, + attributeToFilterBy?: string | null, + setAttributeToFilterBy: (string | null) => void, filterValue: any, setFilterValue: (any) => void, dataItemDefinitions: ItemDefinitions, diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilter.types.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilter.types.js index 825254201d..a3c3d48fe2 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilter.types.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilter.types.js @@ -17,7 +17,7 @@ export type ChangelogFilterProps = { classes: { container: string }, filterValue: FilterValueType, setFilterValue: (value: FilterValueType) => void, - fieldToFilterBy: string | null, - setfieldToFilterBy: (value: string | null) => void, + attributeToFilterBy: string | null, + setAttributeToFilterBy: (value: string | null) => void, dataItemDefinitions: DataItemDefinitions, }; diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilterBar.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilterBar.js index 53f52a3994..e206ea135d 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilterBar.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/ChangelogFilterBar/ChangelogFilterBar.js @@ -21,8 +21,8 @@ const ChangelogFilterBarPlain = ({ classes, filterValue, setFilterValue, - fieldToFilterBy, - setfieldToFilterBy, + attributeToFilterBy, + setAttributeToFilterBy, dataItemDefinitions, }: ChangelogFilterProps) => { const [openMenu, setOpenMenu] = useState(null); @@ -36,14 +36,14 @@ const ChangelogFilterBarPlain = ({ setOpenMenu(null); if (value === 'SHOW_ALL') { setFilterValue('SHOW_ALL'); - setfieldToFilterBy(null); + setAttributeToFilterBy(null); } else { const column = getFilterColumn(value.id); setFilterValue(value); - setfieldToFilterBy(column); + setAttributeToFilterBy(column); } }, - [setFilterValue, setfieldToFilterBy], + [setFilterValue, setAttributeToFilterBy], ); const dataItems = useMemo( @@ -55,7 +55,7 @@ const ChangelogFilterBarPlain = ({ [dataItemDefinitions], ); - const selectedFilterValue = fieldToFilterBy ? filterValue : 'SHOW_ALL'; + const selectedFilterValue = attributeToFilterBy ? filterValue : 'SHOW_ALL'; return (
diff --git a/src/core_modules/capture-core/components/WidgetsChangelog/common/hooks/useChangelogData.js b/src/core_modules/capture-core/components/WidgetsChangelog/common/hooks/useChangelogData.js index 24806b4308..7fb2ae8da7 100644 --- a/src/core_modules/capture-core/components/WidgetsChangelog/common/hooks/useChangelogData.js +++ b/src/core_modules/capture-core/components/WidgetsChangelog/common/hooks/useChangelogData.js @@ -18,9 +18,11 @@ type Props = { export const useChangelogData = ({ entityId, entityType, programId }: Props) => { const [columnToSortBy, setColumnToSortBy] = useState(COLUMN_TO_SORT_BY.DATE); + console.log('columnToSortBy', columnToSortBy); const [sortDirection, setSortDirection] = useState(SORT_DIRECTION.DEFAULT); - const [fieldToFilterBy, setfieldToFilterBy] = useState(null); + const [attributeToFilterBy, setAttributeToFilterBy] = useState(null); + console.log('attributeToFilterBy', attributeToFilterBy); const [filterValue, setFilterValue] = useState('Show all'); const [page, setPage] = useState(1); @@ -32,8 +34,8 @@ export const useChangelogData = ({ entityId, entityType, programId }: Props) => }; const filterParam = - filterValue !== 'Show all' && fieldToFilterBy - ? `${fieldToFilterBy}:eq:${filterValue.id}` + filterValue !== 'Show all' && attributeToFilterBy + ? `${attributeToFilterBy}:eq:${filterValue.id}` : undefined; const orderParam = @@ -71,8 +73,8 @@ export const useChangelogData = ({ entityId, entityType, programId }: Props) => setSortDirection, columnToSortBy, setColumnToSortBy, - fieldToFilterBy, - setfieldToFilterBy, + attributeToFilterBy, + setAttributeToFilterBy, filterValue, setFilterValue, page,