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: allow opening interpretations for AOs without a time dimension (DHIS2-15781) #428

Closed
wants to merge 13 commits into from
Closed
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
11 changes: 9 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: 2023-06-27T14:37:02.617Z\n"
"PO-Revision-Date: 2023-06-27T14:37:02.617Z\n"
"POT-Creation-Date: 2023-09-27T14:21:34.503Z\n"
"PO-Revision-Date: 2023-09-27T14:21:34.503Z\n"

msgid "Add to {{axisName}}"
msgstr "Add to {{axisName}}"
Expand Down Expand Up @@ -379,6 +379,13 @@ msgstr "Your most viewed line lists"
msgid "Not available offline"
msgstr "Not available offline"

msgid ""
"This line list may show data that was not available when the interpretation "
"was written."
msgstr ""
"This line list may show data that was not available when the interpretation "
"was written."

msgid "Sort by {{column}}"
msgstr "Sort by {{column}}"

Expand Down
8 changes: 7 additions & 1 deletion src/components/DetailsPanel/DetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
} from '@dhis2/analytics'
import PropTypes from 'prop-types'
import { stringify } from 'query-string'
import React from 'react'
import React, { useMemo } from 'react'
import { connect } from 'react-redux'
import history from '../../modules/history.js'
import { isAoWithTimeDimension } from '../../modules/timeDimensions.js'
import { sGetCurrent } from '../../reducers/current.js'
import { sGetLoadError } from '../../reducers/loader.js'
import classes from './styles/DetailsPanel.module.css'
Expand All @@ -29,6 +30,10 @@ const DetailsPanel = ({
disabled,
}) => {
const { currentUser } = useCachedDataQuery()
const hasTimeDimension = useMemo(
() => isAoWithTimeDimension(visualization),
[visualization]
)

return (
<div className={classes.panel} data-test="details-panel">
Expand All @@ -39,6 +44,7 @@ const DetailsPanel = ({
/>
<InterpretationsUnit
type="eventVisualization"
visualizationHasTimeDimension={hasTimeDimension}
id={visualization.id}
currentUser={currentUser}
onInterpretationClick={(interpretationId) =>
Expand Down
3 changes: 2 additions & 1 deletion src/components/DownloadMenu/useDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useConfig, useDataEngine } from '@dhis2/app-runtime'
import { useCallback } from 'react'
import { useSelector } from 'react-redux'
import { validateLineListLayout } from '../../modules/layoutValidation.js'
import { isAoWithTimeDimension } from '../../modules/timeDimensions.js'
import { OUTPUT_TYPE_ENROLLMENT } from '../../modules/visualization.js'
import { sGetCurrent } from '../../reducers/current.js'
import {
Expand Down Expand Up @@ -123,7 +124,7 @@ const useDownload = (relativePeriodDate) => {
req = req.withStage(current.programStage?.id)
}

if (relativePeriodDate) {
if (relativePeriodDate && isAoWithTimeDimension(current)) {
req = req.withRelativePeriodDate(relativePeriodDate)
}

Expand Down
Loading
Loading