diff --git a/package-lock.json b/package-lock.json index d66bf175..98cebbb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13408,7 +13408,7 @@ "fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", "dev": true }, "fast-uri": { @@ -15754,7 +15754,7 @@ "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", - "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, "json-stringify-safe": { @@ -16690,7 +16690,7 @@ "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", - "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", "dev": true }, "negotiator": { @@ -22866,7 +22866,7 @@ "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", "dev": true }, "through2": { diff --git a/src/components/common/CascadeSelector.jsx b/src/components/common/CascadeSelector.jsx index d907c4ae..4b9664a1 100644 --- a/src/components/common/CascadeSelector.jsx +++ b/src/components/common/CascadeSelector.jsx @@ -1,4 +1,5 @@ import React from 'react' +import { useTranslation } from 'react-i18next' import Box from '@mui/material/Box' import TextField from '@mui/material/TextField' import Collapse from '@mui/material/Collapse' @@ -17,22 +18,22 @@ import CodeIcon from '@mui/icons-material/CodeOutlined' const PRESETS = [ { id: 'none', - label: 'None', + labelKey: 'common.none', params: {}, }, { id: 'sourcemappings', - label: 'Source Mappings', + labelKey: 'reference.source_mappings', params: { method: 'sourcemappings' }, }, { id: 'sourcetoconcepts', - label: 'OpenMRS', + labelKey: 'reference.all_source_concepts_and_mappings', params: { method: 'sourcetoconcepts', mapTypes: 'Q-AND-A,CONCEPT-SET', cascadeLevels: '*', returnMapTypes: '*' }, }, { id: 'custom', - label: 'Custom', + labelKey: 'common.custom', params: null, }, ] @@ -58,10 +59,12 @@ const buildQueryString = (params, transform) => { } const CascadeSelector = ({ onChange, conceptUrl, collectionUrl, showPreviewDefault = false }) => { + const { t } = useTranslation() const [selectedPresetId, setSelectedPresetId] = React.useState('none') const [transform, setTransform] = React.useState(false) const [customParams, setCustomParams] = React.useState(DEFAULT_CUSTOM_PARAMS) const [showPreview, setShowPreview] = React.useState(showPreviewDefault) + const [showAdvanced, setShowAdvanced] = React.useState(false) const selectedPreset = PRESETS.find(p => p.id === selectedPresetId) const baseParams = selectedPresetId === 'custom' ? customParams : (selectedPreset.params || {}) @@ -85,9 +88,8 @@ const CascadeSelector = ({ onChange, conceptUrl, collectionUrl, showPreviewDefau return ( - {/* Cascade dropdown + Transform checkbox on same row */} - + Cascade - - - setTransform(e.target.checked)} - /> - } - label="Transform" - sx={{ mr: 0, '& .MuiFormControlLabel-label': { fontSize: '0.875rem' } }} - /> - - - - - - {/* Custom params form */} @@ -191,6 +170,45 @@ const CascadeSelector = ({ onChange, conceptUrl, collectionUrl, showPreviewDefau + {/* Advanced options */} + + setShowAdvanced(v => !v)} + sx={{ fontSize: '0.7rem' }} + /> + + + + + + setTransform(e.target.checked)} + /> + } + label="Transform" + sx={{ mr: 0, '& .MuiFormControlLabel-label': { fontSize: '0.875rem' } }} + /> + + + + + + + + + {/* API call preview */}