Skip to content

Commit

Permalink
fix: use correct endpoint for program indicator expression description
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Nov 19, 2024
1 parent 57f8597 commit 39c2354
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/api/expression.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
export const validateExpressionMutation = {
export const validateIndicatorExpressionMutation = {
type: 'create',
resource: 'indicators/expression/description',
data: ({ expression }) => expression,
}

export const validateProgramIndicatorExpressionMutation = {
type: 'create',
resource: 'programIndicators/expression/description',
data: ({ expression }) => expression,
}

export const createCalculationMutation = {
type: 'create',
resource: 'expressionDimensionItems',
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Calculation/CalculationModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
createCalculationMutation,
deleteCalculationMutation,
updateCalculationMutation,
validateExpressionMutation,
validateIndicatorExpressionMutation,
} from '../../../api/expression.js'
import i18n from '../../../locales/index.js'
import {
Expand Down Expand Up @@ -57,7 +57,7 @@ const CalculationModal = ({
const [deleteCalculation, { loading: isDeletingCalculation }] =
useDataMutation(deleteCalculationMutation, mutationParams)
const [doBackendValidation, { loading: isValidating }] = useDataMutation(
validateExpressionMutation,
validateIndicatorExpressionMutation,
{
onError: (error) => showError(error),
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Info/CalculationInfo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useConfig, useDataMutation, useDataEngine } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React, { useCallback, useEffect, useState } from 'react'
import { validateExpressionMutation } from '../../../api/expression.js'
import { validateIndicatorExpressionMutation } from '../../../api/expression.js'
import i18n from '../../../locales/index.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'
Expand All @@ -25,7 +25,7 @@ export const CalculationInfo = ({ id, displayNameProp }) => {

const engine = useDataEngine()
const [getHumanReadableExpression] = useDataMutation(
validateExpressionMutation,
validateIndicatorExpressionMutation,
{ onError: setError }
)

Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Info/IndicatorInfo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useDataMutation, useDataEngine } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React, { useCallback, useEffect, useState } from 'react'
import { validateExpressionMutation } from '../../../api/expression.js'
import { validateIndicatorExpressionMutation } from '../../../api/expression.js'
import i18n from '../../../locales/index.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'
Expand All @@ -25,7 +25,7 @@ export const IndicatorInfo = ({ id, displayNameProp }) => {

const engine = useDataEngine()
const [getHumanReadableExpression] = useDataMutation(
validateExpressionMutation,
validateIndicatorExpressionMutation,
{ onError: setError }
)

Expand Down
4 changes: 2 additions & 2 deletions src/components/DataDimension/Info/ProgramIndicatorInfo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useDataMutation, useDataEngine } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React, { useCallback, useEffect, useState } from 'react'
import { validateExpressionMutation } from '../../../api/expression.js'
import { validateProgramIndicatorExpressionMutation } from '../../../api/expression.js'
import i18n from '../../../locales/index.js'
import { getCommonFields, InfoTable } from './InfoTable.js'
import styles from './styles/InfoPopover.style.js'
Expand All @@ -25,7 +25,7 @@ export const ProgramIndicatorInfo = ({ id, displayNameProp }) => {

const engine = useDataEngine()
const [getHumanReadableExpression] = useDataMutation(
validateExpressionMutation,
validateProgramIndicatorExpressionMutation,
{
onError: setError,
}
Expand Down

0 comments on commit 39c2354

Please sign in to comment.