Skip to content

Commit

Permalink
Merge branch 'master' into refactor/use-platform-plugin-components
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen authored Nov 11, 2024
2 parents 97a8bdb + 81c9ec3 commit 0957a5a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [100.8.4](https://github.com/dhis2/data-visualizer-app/compare/v100.8.3...v100.8.4) (2024-11-07)


### Bug Fixes

* infinite spinner when opening the interpretations modal while viewing a visualization ([#3283](https://github.com/dhis2/data-visualizer-app/issues/3283)) ([403adbc](https://github.com/dhis2/data-visualizer-app/commit/403adbc45f3d0f7983317eae4a6ccd44f970c428))

## [100.8.3](https://github.com/dhis2/data-visualizer-app/compare/v100.8.2...v100.8.3) (2024-10-24)


Expand Down
41 changes: 41 additions & 0 deletions cypress/integration/interpretations.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { VIS_TYPE_BAR } from '@dhis2/analytics'
import {
expectAOTitleToBeValue,
expectVisualizationToBeVisible,
} from '../elements/chart.js'
import { openAOByName } from '../elements/fileMenu/index.js'
import { goToStartPage } from '../elements/startScreen.js'

describe('Interpretations', () => {
it('opens the interpretations modal on a saved AO', () => {
const ao = {
name: 'ANC: 1 and 3 coverage Yearly',
type: VIS_TYPE_BAR,
}

// Open the saved AO
goToStartPage()
openAOByName(ao.name)
expectAOTitleToBeValue(ao.name)
expectVisualizationToBeVisible(ao.type)

// Open the interpretations panel
cy.getBySel('dhis2-analytics-interpretationsanddetailstoggler').click()

cy.getBySel('interpretations-list')
.find('button')
.contains('See interpretation')
.click()

cy.getBySel('interpretation-modal').should('be.visible')

cy.get('.highcharts-container').should('be.visible')

cy.getBySel('interpretation-modal')
.find('button')
.contains('Hide interpretation')
.click()

cy.getBySel('interpretation-modal').should('not.exist')
})
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "data-visualizer-app",
"version": "100.8.3",
"version": "100.8.4",
"description": "DHIS2 Data Visualizer",
"license": "BSD-3-Clause",
"private": true,
Expand Down
13 changes: 9 additions & 4 deletions src/components/VisualizationPlugin/VisualizationPluginWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,28 @@ const VisualizationPluginWrapper = (props) => {

const onLoadingComplete = () => setIsLoading(false)

const onResponsesReceived = useCallback(
const { visualization, onResponsesReceived } = props
const handleResponsesReceived = useCallback(
(responses) => {
try {
ensureAnalyticsResponsesContainData(
responses,
props.visualization.type
visualization.type
)
} catch (error) {
setError(error)
}

typeof onResponsesReceived === 'function' &&
onResponsesReceived(responses)
},
[props.visualization.type]
[visualization.type, onResponsesReceived]
)

if (error) {
return <VisualizationErrorInfo error={error} />
}

return (
<>
{isLoading && (
Expand All @@ -97,7 +102,7 @@ const VisualizationPluginWrapper = (props) => {
{...pluginProps}
onDataSorted={onDataSorted}
onLoadingComplete={onLoadingComplete}
onResponsesReceived={onResponsesReceived}
onResponsesReceived={handleResponsesReceived}
/>
</>
)
Expand Down

0 comments on commit 0957a5a

Please sign in to comment.