Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dhis2 18281/indicator list #436

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 9 additions & 42 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ msgstr "Data set"
msgid "Search by name, code or ID"
msgstr "Search by name, code or ID"

msgid "Indicator Type"
msgstr "Indicator Type"

msgid "Public access"
msgstr "Public access"

Expand Down Expand Up @@ -961,48 +964,6 @@ msgstr "Filter selected categories"
msgid "At least one category is required"
msgstr "At least one category is required"

msgid "Set up the basic information for this category option group set."
msgstr "Set up the basic information for this category option group set."

msgid "Explain the purpose of this category option group set."
msgstr "Explain the purpose of this category option group set."

msgid ""
"Choose how this category option group set will be used to capture and "
"analyze"
msgstr ""
"Choose how this category option group set will be used to capture and "
"analyze"

msgid ""
"Category option group set will be available to the analytics as another "
"dimension"
msgstr ""
"Category option group set will be available to the analytics as another "
"dimension"

msgid "Category option Groups"
msgstr "Category option Groups"

msgid ""
"Choose the category option groups to include in this category option group "
"set."
msgstr ""
"Choose the category option groups to include in this category option group "
"set."

msgid "Available category option groups"
msgstr "Available category option groups"

msgid "Selected category option groups"
msgstr "Selected category option groups"

msgid "Filter available category option groups"
msgstr "Filter available category option groups"

msgid "Filter selected category option groups"
msgstr "Filter selected category option groups"

msgid "Set up the basic information for this category option group."
msgstr "Set up the basic information for this category option group."

Expand Down Expand Up @@ -1239,6 +1200,12 @@ msgstr "Set up the organisation unit location."
msgid "Reference assignment"
msgstr "Reference assignment"

msgid "Longitude"
msgstr "Longitude"

msgid "Reference assignment"
msgstr "Reference assignment"

msgid "Assign the organisation unit to related objects."
msgstr "Assign the organisation unit to related objects."

Expand Down
3 changes: 3 additions & 0 deletions src/components/sectionList/filters/DynamicFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CategoryOptionGroupFilter,
DataDimensionTypeFilter,
DataSetFilter,
IndicatorFilter,
DomainTypeSelectionFilter,
IgnoreApprovalFilter,
PublicAccessFilter,
Expand All @@ -19,6 +20,7 @@ type FilterKeyToComponentMap = Partial<Record<ConfigurableFilterKey, React.FC>>

const filterKeyToComponentMap: FilterKeyToComponentMap = {
category: Categoryfilter,
indicatorType: IndicatorFilter,
categoryOption: CategoryOptionFilter,
categoryCombo: CategoryComboFilter,
categoryOptionGroup: CategoryOptionGroupFilter,
Expand All @@ -33,6 +35,7 @@ const filterKeyToComponentMap: FilterKeyToComponentMap = {

export const DynamicFilters = () => {
const filterKeys = useFilterKeys()

return (
<>
{filterKeys.map((filterKey) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import i18n from '@dhis2/d2-i18n'
import React from 'react'
import { useSectionListFilter } from '../../../../lib'
import { createFilterDataQuery } from './createFilterDataQuery'
import { ModelFilterSelect } from './ModelFilter'

const query = createFilterDataQuery('indicatorTypes')

export const IndicatorFilter = () => {
const [filter, setFilter] = useSectionListFilter('indicatorType')

const selected = filter?.[0]

return (
<ModelFilterSelect
placeholder={i18n.t('Indicator Type')}
query={query}
selected={selected}
onChange={({ selected }) =>
setFilter(selected ? [selected] : undefined)
}
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * from './CategoryFilter'
export * from './CategoryOptionGroupFilter'
export * from './BooleanFilters'
export * from './CategoryOptionFilter'
export * from './IndicatorFilter'
2 changes: 2 additions & 0 deletions src/lib/sectionList/filters/filterConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const filterParamsSchema = z
valueType: z.array(z.nativeEnum(DataElement.valueType)),
dataDimensionType: z.nativeEnum(Category.dataDimensionType),
ignoreApproval: z.boolean(),
indicatorType: zodArrayIds,
})
.partial()

Expand All @@ -43,6 +44,7 @@ export const filterQueryParamType = {
publicAccess: CustomDelimitedArrayParam,
dataDimensionType: StringParam,
ignoreApproval: BooleanParam,
indicatorType: CustomDelimitedArrayParam,
} as const satisfies QueryParamsConfigMap

export const validFilterKeys = Object.keys(filterQueryParamType)
Expand Down
1 change: 1 addition & 0 deletions src/lib/sectionList/filters/parseFiltersToQueryParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const filterToQueryParamMap: FilterToQueryParamsMap = {
identifiable: (value) => `identifiable:token:${value}`,
category: (value) => inFilter('categories.id', value),
categoryOption: (value) => inFilter('categoryOptions.id', value),
indicatorType: (value) => inFilter('indicatorType.id', value),
categoryCombo: (value, section) => {
if (section.name === 'category') {
return inFilter('categoryCombos.id', value)
Expand Down
8 changes: 8 additions & 0 deletions src/lib/sectionList/listViews/sectionListViewsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export const modelListViewsConfig = {
default: ['dataDimensionType', 'categoryCombo'],
},
},
indicator: {
columns: {
default: ['name', DESCRIPTORS.publicAccess, 'lastUpdated'],
},
filters: {
default: ['indicatorType'],
},
},
categoryOptionGroupSet: {
columns: {
default: [
Expand Down
4 changes: 4 additions & 0 deletions src/pages/indicators/List.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react'
import { DefaultSectionList } from '../DefaultSectionList'

export const Component = () => <DefaultSectionList />
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
StandardFormSection,
StandardFormSectionDescription,
StandardFormSectionTitle,
} from '../../../components'
import {
DefaultIdentifiableFields,
DescriptionField,
} from '../../../components'
Expand Down
Loading