Skip to content

Commit

Permalink
Merge branch 'dev' into cypress-record
Browse files Browse the repository at this point in the history
  • Loading branch information
adeldhis2 authored May 14, 2024
2 parents 7b8a6ca + ddcaf7c commit 79bee08
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"typescript": "^4.8.4"
},
"dependencies": {
"@dhis2/analytics": "^26.6.8",
"@dhis2/analytics": "^26.6.9",
"@dhis2/app-runtime": "^3.7.0",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/app-service-datastore": "^1.0.0-beta.3",
Expand Down
8 changes: 6 additions & 2 deletions src/components/DimensionsPanel/Dialogs/DialogManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class DialogManager extends Component {

// The OU content is persisted as mounted in order
// to cache the org unit tree data
renderPersistedContent = (dimensionProps) => {
renderPersistedContent = (dimensionProps, displayNameProperty) => {
const { ouIds, metadata, parentGraphMap, dialogId } = this.props

if (this.state.ouMounted) {
Expand All @@ -253,6 +253,7 @@ export class DialogManager extends Component {
roots={this.props.rootOrgUnits.map(
(rootOrgUnit) => rootOrgUnit.id
)}
displayNameProp={displayNameProperty}
{...dimensionProps}
/>
</div>
Expand Down Expand Up @@ -455,7 +456,10 @@ export class DialogManager extends Component {

return (
<Fragment>
{this.renderPersistedContent(dimensionProps)}
{this.renderPersistedContent(
dimensionProps,
displayNameProperty
)}
{dialogId && dynamicContent()}
</Fragment>
)
Expand Down
31 changes: 15 additions & 16 deletions src/components/VisualizationPlugin/VisualizationPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const VisualizationPlugin = ({
onDrill,
}) => {
const engine = useDataEngine()
const [visualization, setVisualization] = useState(undefined)
const [visualization, setVisualization] = useState(null)
const [ouLevels, setOuLevels] = useState(undefined)
const [fetchResult, setFetchResult] = useState(null)
const [contextualMenuRef, setContextualMenuRef] = useState(undefined)
Expand Down Expand Up @@ -173,6 +173,7 @@ export const VisualizationPlugin = ({

useEffect(() => {
setFetchResult(null)
setVisualization(null)

// filter out disabled options
const disabledOptions = getDisabledOptions({
Expand All @@ -186,8 +187,6 @@ export const VisualizationPlugin = ({
(option) => delete filteredVisualization[option]
)

setVisualization(filteredVisualization)

const doFetchAll = async () => {
const { responses, extraOptions } = await doFetchData(
filteredVisualization,
Expand Down Expand Up @@ -254,6 +253,7 @@ export const VisualizationPlugin = ({
extraOptions,
})
setShowLegendKey(filteredVisualization.legend?.showKey)

onLoadingComplete()
}

Expand All @@ -264,7 +264,15 @@ export const VisualizationPlugin = ({
/* eslint-disable-next-line react-hooks/exhaustive-deps */
}, [originalVisualization, filters, forDashboard])

if (!fetchResult || !ouLevels) {
useEffect(() => {
if (fetchResult?.visualization && ouLevels) {
setVisualization(
convertOuLevelsToUids(ouLevels, fetchResult.visualization)
)
}
}, [fetchResult?.visualization, ouLevels])

if (!fetchResult || !visualization || !ouLevels) {
return null
}

Expand Down Expand Up @@ -406,10 +414,7 @@ export const VisualizationPlugin = ({
) {
return (
<PivotPlugin
visualization={convertOuLevelsToUids(
ouLevels,
fetchResult.visualization
)}
visualization={visualization}
responses={fetchResult.responses}
legendSets={legendSets}
onToggleContextualMenu={
Expand All @@ -422,10 +427,7 @@ export const VisualizationPlugin = ({
} else if (fetchResult.visualization.type === VIS_TYPE_OUTLIER_TABLE) {
return (
<OutlierTablePlugin
visualization={convertOuLevelsToUids(
ouLevels,
fetchResult.visualization
)}
visualization={visualization}
responses={fetchResult.responses}
filters={filters}
id={id}
Expand All @@ -436,10 +438,7 @@ export const VisualizationPlugin = ({
} else {
return (
<ChartPlugin
visualization={convertOuLevelsToUids(
ouLevels,
fetchResult.visualization
)}
visualization={visualization}
responses={fetchResult.responses}
extraOptions={fetchResult.extraOptions}
legendSets={legendSets}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2028,10 +2028,10 @@
classnames "^2.3.1"
prop-types "^15.7.2"

"@dhis2/analytics@^26.6.8":
version "26.6.8"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-26.6.8.tgz#859f8086198664a9ea14cea149ce7bdf449a19a2"
integrity sha512-9l8001MAx+q8K1Qklui8pfF0rrv3MSLA1dEtM93rBODSsQwRE9pbt5wN44i9+n7nAgc7iItBehAQ1hMJ8j7yHg==
"@dhis2/analytics@^26.6.9":
version "26.6.9"
resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-26.6.9.tgz#932847c4bee3dd720d5d0b872c6b11eeae8b260c"
integrity sha512-AcU5FKH1Rmi8GdgqdJ1aOPqTKhztLafhzKNvGBdb5rSNR8/KS2djyTxxPhL0fdusu+1Rc04RFSkOLajq3ChVrQ==
dependencies:
"@dhis2/d2-ui-rich-text" "^7.4.1"
"@dhis2/multi-calendar-dates" "1.0.0"
Expand Down

0 comments on commit 79bee08

Please sign in to comment.