+ {i18n.t('Select data exchange ids')} +
+) + +const AggregatedDataExchangeField = ({ label, name }) => { + const { loading, error, data } = useDataQuery(query) + const { input, meta } = useField(name, { + beforeSubmit: () => !loading || !error, + validate, + }) + const handleChange = useCallback( + ({ selected }) => { + input?.onChange(selected) + }, + [input] + ) + + if (loading) { + return{error.details?.message}
} ++ {i18n.t('Select checks to run.')} +
+) + +const { string } = PropTypes + +DataIntegrityChecksField.propTypes = { + label: string.isRequired, + name: string.isRequired, +} + +export default DataIntegrityChecksField diff --git a/src/components/FormFields/Custom/DataIntegrityReportTypeField.jsx b/src/components/FormFields/Custom/DataIntegrityReportTypeField.jsx new file mode 100644 index 000000000..351376661 --- /dev/null +++ b/src/components/FormFields/Custom/DataIntegrityReportTypeField.jsx @@ -0,0 +1,40 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { SingleSelectFieldFF, ReactFinalForm } from '@dhis2/ui' +import i18n from '@dhis2/d2-i18n' +import { getReportTypeLabel } from '../../../services/server-translations/dataIntegrityChecks' + +const { Field } = ReactFinalForm + +const DEFAULT_VALUE = 'SUMMARY' + +const DataIntegrityReportTypeField = ({ name, constants }) => { + if (!constants) { + // shouldn't really happen, but backend defaults to "report" if no value + return null + } + + const labeledOptions = constants.map((type) => ({ + value: type, + label: getReportTypeLabel(type), + })) + + return ( +