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

fix: enable ou tree and levels/groups with user orgunits and display decent title (DHIS2-18066) #1702

Merged
merged 9 commits into from
Nov 22, 2024
16 changes: 2 additions & 14 deletions src/components/OrgUnitDimension/OrgUnitDimension.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ const OrgUnitDimension = ({
let result = [...selected]

if (checked && DYNAMIC_ORG_UNITS.includes(id)) {
result = [
...result.filter((item) => DYNAMIC_ORG_UNITS.includes(item.id)),
{ id, displayName },
]
result = [...result, { id, displayName }]
} else if (checked) {
result.push({ id, path, name: displayName })
} else {
Expand Down Expand Up @@ -236,13 +233,7 @@ const OrgUnitDimension = ({
/>
</div>
)}
<div
className={cx('orgUnitTreeWrapper', {
disabled: selected.some((item) =>
DYNAMIC_ORG_UNITS.includes(item.id)
),
})}
>
<div className="orgUnitTreeWrapper">
<OrganisationUnitTree
roots={roots}
initiallyExpanded={[
Expand Down Expand Up @@ -276,9 +267,6 @@ const OrgUnitDimension = ({
</div>
<div
className={cx('selectsWrapper', {
disabled: selected.some((item) =>
DYNAMIC_ORG_UNITS.includes(item.id)
),
hidden: hideLevelSelect && hideGroupSelect,
})}
>
Expand Down
1 change: 1 addition & 0 deletions src/components/PivotTable/PivotTableTitleRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { PivotTableTitleRow } from './PivotTableTitleRow.js'

export const PivotTableTitleRows = ({ clippingResult, width }) => {
const engine = usePivotTableEngine()

return (
<>
{engine.options.title ? (
Expand Down
4 changes: 3 additions & 1 deletion src/modules/getOuLevelAndGroupText.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export const getOuLevelAndGroupText = (filter, metaData) => {

const getLevelAndGroupText = (items, metaData, isLevel) => {
const getNameFromMetadata = (id) =>
metaData.items[id] ? metaData.items[id].name : id
metaData.items[id]
janhenrikoverland marked this conversation as resolved.
Show resolved Hide resolved
? metaData.items[id].name
: items.find((item) => item.id === id)?.name || id

const dynamicOuItems = items.filter((item) =>
isLevel
Expand Down
Loading