Skip to content

Commit

Permalink
feat: data set list view (#435)
Browse files Browse the repository at this point in the history
* feat: data set list view

* chore: resolve filter query

* feat: update formtype filter to constnt select

* chore: replace dataset filter

* chore: replace dataset filter
  • Loading branch information
Chisomchima authored Nov 18, 2024
1 parent c33c962 commit cf6c751
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 14 deletions.
62 changes: 56 additions & 6 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-11-13T12:57:12.003Z\n"
"PO-Revision-Date: 2024-11-13T12:57:12.004Z\n"
"POT-Creation-Date: 2024-11-13T08:29:01.348Z\n"
"PO-Revision-Date: 2024-11-13T08:29:01.348Z\n"

Expand Down Expand Up @@ -846,6 +848,12 @@ msgstr "MultiPolygon"
msgid "GeometryCollection"
msgstr "GeometryCollection"

msgid "Section"
msgstr "Section"

msgid "Section Multi-org"
msgstr "Section Multi-org"

msgid "Aggregation type"
msgstr "Aggregation type"

Expand All @@ -858,6 +866,9 @@ msgstr "Form name"
msgid "Domain type"
msgstr "Domain type"

msgid "Form type"
msgstr "Form type"

msgid "Sharing"
msgstr "Sharing"

Expand Down Expand Up @@ -897,6 +908,9 @@ msgstr "Created successfully"
msgid "Required"
msgstr "Required"

msgid "Period type"
msgstr "Period type"

msgid "Basic information"
msgstr "Basic information"

Expand Down Expand Up @@ -961,6 +975,48 @@ 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 @@ -1179,12 +1235,6 @@ 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
2 changes: 1 addition & 1 deletion src/components/sectionList/filters/FilterWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18n from '@dhis2/d2-i18n'
import { Button } from '@dhis2/ui'
import React from 'react'
import { useSectionListFilters } from './../../../lib'
import { DynamicFilters } from './DynamicFilters'
import { DynamicFilters } from './filterSelectors/DynamicFilters'
import { IdentifiableFilter } from './filterSelectors/IdentifiableFilter'
import css from './FilterWrapper.module.css'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DOMAIN_TYPE,
getTranslatedProperty,
VALUE_TYPE,
FORM_TYPE,
} from '../../../../lib'
import { ConstantSelectionFilter } from './ConstantSelectionFilter'

Expand All @@ -17,6 +18,15 @@ export const DomainTypeSelectionFilter = () => {
/>
)
}
export const FormTypeFilter = () => {
return (
<ConstantSelectionFilter
label={getTranslatedProperty('formType')}
filterKey="formType"
constants={FORM_TYPE}
/>
)
}

export const ValueTypeSelectionFilter = () => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@
import React from 'react'
import { ConfigurableFilterKey } from './../../../lib'
import { ConfigurableFilterKey } from '../../../../lib'
import { useFilterKeys } from '../useFilterKeys'
import {
AggregationTypeFilter,
CategoryComboFilter,
Categoryfilter,
CategoryOptionFilter,
CategoryOptionGroupFilter,
DataDimensionTypeFilter,
DataSetFilter,
IndicatorFilter,
DomainTypeSelectionFilter,
IgnoreApprovalFilter,
PublicAccessFilter,
ValueTypeSelectionFilter,
} from './filterSelectors'
import { useFilterKeys } from './useFilterKeys'
FormTypeFilter,
DataSetFilter,
} from '.'

type FilterKeyToComponentMap = Partial<Record<ConfigurableFilterKey, React.FC>>

const filterKeyToComponentMap: FilterKeyToComponentMap = {
category: Categoryfilter,
formType: FormTypeFilter,
indicatorType: IndicatorFilter,
categoryOption: CategoryOptionFilter,
categoryCombo: CategoryComboFilter,
categoryOptionGroup: CategoryOptionGroupFilter,
dataSet: DataSetFilter,
domainType: DomainTypeSelectionFilter,
valueType: ValueTypeSelectionFilter,
aggregationType: AggregationTypeFilter,
publicAccess: PublicAccessFilter,
dataDimensionType: DataDimensionTypeFilter,
ignoreApproval: IgnoreApprovalFilter,
dataSet: DataSetFilter,
}

export const DynamicFilters = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './ConstantFilters'
export * from './DataSetFilter'
export * from './CategoryComboFilter'
export * from './IdentifiableFilter'
export * from './ConstantSelectionFilter'
Expand All @@ -9,3 +8,4 @@ export * from './CategoryOptionGroupFilter'
export * from './BooleanFilters'
export * from './CategoryOptionFilter'
export * from './IndicatorFilter'
export * from './DataSetFilter'
8 changes: 8 additions & 0 deletions src/lib/constants/translatedModelConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,20 @@ export const GEOMETRY_TYPE = {
GEOMETRYCOLLECTION: i18n.t('GeometryCollection'),
}

export const FORM_TYPE = {
CUSTOM: i18n.t('Custom'),
DEFAULT: i18n.t('Default'),
SECTION: i18n.t('Section'),
SECTION_MULTIORG: i18n.t('Section Multi-org'),
}

const allConstantTranslations: Record<string, string> = {
...AGGREGATION_TYPE,
...DOMAIN_TYPE,
...VALUE_TYPE,
...DATA_DIMENSION_TYPE,
...GEOMETRY_TYPE,
...FORM_TYPE,
}

export const getConstantTranslation = (constant: string): string => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/constants/translatedModelProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const TRANSLATED_PROPERTY: Record<string, string> = {
lastUpdatedBy: i18n.t('Last updated by'),
created: i18n.t('Created'),
domainType: i18n.t('Domain type'),
formType: i18n.t('Form type'),
dataSet: i18n.t('Data set'),
lastUpdated: i18n.t('Last updated'),
name: i18n.t('Name'),
Expand Down
4 changes: 3 additions & 1 deletion src/lib/sectionList/filters/filterConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BooleanParam, StringParam } from 'use-query-params'
import { z } from 'zod'
import { Category, DataElement } from '../../../types/generated'
import { Category, DataElement, DataSet } from '../../../types/generated'
import { KeysOfValue } from '../../../types/utility'
import { IDENTIFIABLE_FILTER_KEY } from '../../constants'
import { isValidUid, parseAccessString } from '../../models'
Expand All @@ -15,6 +15,7 @@ export const filterParamsSchema = z
aggregationType: z.array(z.nativeEnum(DataElement.aggregationType)),
categoryCombo: zodArrayIds,
category: zodArrayIds,
formType: z.array(z.nativeEnum(DataSet.formType)),
categoryOption: zodArrayIds,
categoryOptionGroup: zodArrayIds,
dataSet: zodArrayIds,
Expand All @@ -38,6 +39,7 @@ export const filterQueryParamType = {
valueType: CustomDelimitedArrayParam,
dataSet: CustomDelimitedArrayParam,
category: CustomDelimitedArrayParam,
formType: CustomDelimitedArrayParam,
categoryOption: CustomDelimitedArrayParam,
categoryCombo: CustomDelimitedArrayParam,
categoryOptionGroup: CustomDelimitedArrayParam,
Expand Down
14 changes: 14 additions & 0 deletions src/lib/sectionList/listViews/sectionListViewsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ export const modelListViewsConfig = {
default: ['domainType', 'valueType', 'dataSet', 'categoryCombo'],
},
},
dataSet: {
columns: {
default: [
'name',
{ label: i18n.t('Form type'), path: 'formType' },
{ label: i18n.t('Period type'), path: 'periodType' },
'lastUpdated',
DESCRIPTORS.publicAccess,
],
},
filters: {
default: ['formType'],
},
},
organisationUnit: {
columns: {
available: [],
Expand Down

0 comments on commit cf6c751

Please sign in to comment.