Skip to content
Draft
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
1 change: 1 addition & 0 deletions cypress/integration/layers/trackedentitylayer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Tracked Entity Layers', () => {
Layer.selectTab('Period')
.typeStartDate('2018-00-00')
.selectTab('Org Units')
.unselectOu('Sierra Leone')
.openOu('Bo')
.openOu('Badjia')
.selectOu('Njandama MCHP')
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/requests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('API requests check for all layer types', () => {
// -- apiFetch - src/util/api.js
// -- @dhis2/d2 - src/api/Api.js
'getTrackedEntities40_TrackedEntities1',
// -- teiRelationshipsParser - src/util/teiRelationshipsParser.js
// -- trackedEntityRelationships - src/util/trackedEntityRelationships.js
// -- apiFetch - src/util/api.js
// -- @dhis2/d2 - src/api/Api.js
// TODO: Should this be only TEIs within the same timeframe?
Expand All @@ -213,7 +213,7 @@ describe('API requests check for all layer types', () => {
// -- apiFetch - src/util/api.js
// -- @dhis2/d2 - src/api/Api.js
'getTrackedEntities41_TrackedEntities1',
// -- teiRelationshipsParser - src/util/teiRelationshipsParser.js
// -- trackedEntityRelationships - src/util/trackedEntityRelationships.js
// -- apiFetch - src/util/api.js
// -- @dhis2/d2 - src/api/Api.js
// TODO: Should this be only TEIs within the same timeframe?
Expand Down
7 changes: 5 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +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: 2026-09-01T12:42:29.454Z\n"
"PO-Revision-Date: 2026-09-01T12:42:29.454Z\n"
"POT-Creation-Date: 2026-10-05T12:46:47.530Z\n"
"PO-Revision-Date: 2026-10-05T12:46:47.531Z\n"

msgid "2020"
msgstr "2020"
Expand Down Expand Up @@ -1885,6 +1885,9 @@ msgstr "related"
msgid "Tracked entity"
msgstr "Tracked entity"

msgid "Displaying first {{pageSize}} tracked entities"
msgstr "Displaying first {{pageSize}} tracked entities"

msgid "not one of"
msgstr "not one of"

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@turf/centroid": "^7.4.0",
"abortcontroller-polyfill": "^1.7.8",
"array-move": "^4.0.0",
"betterknown": "^1.2.0",
"classnames": "^2.5.1",
"d3-array": "^3.2.4",
"d3-axis": "^3.0.0",
Expand Down
19 changes: 15 additions & 4 deletions src/components/orgunits/OrgUnitSelectMode.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import { useConfig } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import React, { useMemo } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { setOrgUnitMode } from '../../actions/layerEdit.js'
import {
ORG_UNIT_MODE_CHILDREN,
ORG_UNIT_MODE_DESCENDANTS,
ORG_UNIT_MODE_SELECTED,
} from '../../constants/orgUnits.js'
import { getTrackedEntityDefaultOrgUnitMode } from '../../util/trackedEntity.js'
import { SelectField } from '../core/index.js'
import styles from './styles/OrgUnitSelectMode.module.css'

const OrgUnitSelectMode = () => {
const organisationUnitSelectionMode = useSelector(
(state) => state.layerEdit.organisationUnitSelectionMode
)
const { serverVersion } = useConfig()
const dispatch = useDispatch()

const items = useMemo(
() => [
{
id: 'SELECTED',
id: ORG_UNIT_MODE_SELECTED,
name: i18n.t('Selected only'),
},
{
id: 'CHILDREN',
id: ORG_UNIT_MODE_CHILDREN,
name: i18n.t('Selected and below'),
},
{
id: 'DESCENDANTS',
id: ORG_UNIT_MODE_DESCENDANTS,
name: i18n.t('Selected and all below'),
},
],
Expand All @@ -34,7 +42,10 @@ const OrgUnitSelectMode = () => {
<SelectField
prefix={i18n.t('Selection mode')}
items={items}
value={organisationUnitSelectionMode || 'SELECTED'}
value={
organisationUnitSelectionMode ||
getTrackedEntityDefaultOrgUnitMode(serverVersion)
}
onChange={(mode) => dispatch(setOrgUnitMode(mode.id))}
className={styles.selectField}
/>
Expand Down
12 changes: 10 additions & 2 deletions src/components/plugin/LayerLoader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const LayerLoader = ({ config, onLoad }) => {
const engine = useDataEngine()
const [analyticsEngine] = useState(() => Analytics.getAnalytics(engine))
const {
systemSettings: { keyAnalysisDigitGroupSeparator },
systemSettings: {
keyAnalysisDigitGroupSeparator,
KeyTrackedEntityInstanceMaxLimit,
KeyTrackedEntityMaxLimit,
},
currentUser,
} = useCachedData()
const {
Expand Down Expand Up @@ -62,9 +66,11 @@ const LayerLoader = ({ config, onLoad }) => {
userId,
userOrgUnitIdsByKeyword, // Event loader
baseUrl,
analyticsEngine, // Thematic and Event loader
analyticsEngine, // Thematic, Event and Tracked entity loader
periodTypeData, // Thematic and Event loader
serverVersion, // Tracked entity loader
KeyTrackedEntityInstanceMaxLimit, // Tracked entity loader (2.40)
KeyTrackedEntityMaxLimit, // Tracked entity loader
}).then((result) => {
onLoad(result)
})
Expand All @@ -80,6 +86,8 @@ const LayerLoader = ({ config, onLoad }) => {
keyAnalysisDisplayProperty,
keyAnalysisDigitGroupSeparator,
serverVersion,
KeyTrackedEntityInstanceMaxLimit,
KeyTrackedEntityMaxLimit,
])

return null
Expand Down
1 change: 1 addition & 0 deletions src/constants/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export const TEI_BUFFER = 100
export const TEI_RELATED_COLOR = '#000000'
export const TEI_RELATED_RADIUS = 3
export const TEI_RELATIONSHIP_LINE_COLOR = '#0000BB'
export const TEI_CLIENT_PAGE_SIZE = 50000

/* FACILITY LAYER */
export const FACILITY_BUFFER = 5000
Expand Down
4 changes: 4 additions & 0 deletions src/constants/orgUnits.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Org unit selection modes (ouMode / orgUnitMode API params)
export const ORG_UNIT_MODE_SELECTED = 'SELECTED'
export const ORG_UNIT_MODE_CHILDREN = 'CHILDREN'
export const ORG_UNIT_MODE_DESCENDANTS = 'DESCENDANTS'
3 changes: 3 additions & 0 deletions src/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export const SYSTEM_SETTINGS = [
'keyHideMonthlyPeriods',
'keyHideBiMonthlyPeriods',
'keyDefaultBaseMap',
// Tracker API limit, 2.40 and 2.41+ names: see getTrackerMaxLimit
'KeyTrackedEntityInstanceMaxLimit',
'KeyTrackedEntityMaxLimit',
...Object.keys(MAP_SERVICE_KEY_TESTS),
]

Expand Down
12 changes: 10 additions & 2 deletions src/hooks/useLayersLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export const useLayersLoader = () => {
const engine = useDataEngine()
const [analyticsEngine] = useState(() => Analytics.getAnalytics(engine))
const {
systemSettings: { keyAnalysisDigitGroupSeparator },
systemSettings: {
keyAnalysisDigitGroupSeparator,
KeyTrackedEntityInstanceMaxLimit,
KeyTrackedEntityMaxLimit,
},
currentUser,
} = useCachedData()
const { showAlerts } = useLoaderAlerts()
Expand Down Expand Up @@ -61,9 +65,11 @@ export const useLayersLoader = () => {
userId,
userOrgUnitIdsByKeyword, // Event loader
baseUrl,
analyticsEngine, // Thematic and Event loader
analyticsEngine, // Thematic, Event and Tracked entity loader
periodTypeData, // Thematic and Event loader
serverVersion, // Tracked entity loader
KeyTrackedEntityInstanceMaxLimit, // Tracked entity loader (2.40)
KeyTrackedEntityMaxLimit, // Tracked entity loader
loadExtended: !!dataTable, // Event loader
})
if (result.alerts) {
Expand Down Expand Up @@ -128,5 +134,7 @@ export const useLayersLoader = () => {
baseUrl,
dataTable,
serverVersion,
KeyTrackedEntityInstanceMaxLimit,
KeyTrackedEntityMaxLimit,
])
}
Loading
Loading