From c5ddee59337a3b8b2b28b7a00e5ca5d4d3c70f03 Mon Sep 17 00:00:00 2001 From: sb-cecilialiu Date: Thu, 7 Nov 2024 06:53:23 -0600 Subject: [PATCH] MAT7698 edit parameter --- src/AceEditor/madie-ace-editor.tsx | 4 +++ src/CqlBuilderPanel/CqlBuilderPanel.tsx | 2 ++ .../Parameters/EditParameterDialog.tsx | 4 ++- .../Parameters/ParameterBuilder.tsx | 35 ++++--------------- .../CqlEditorWithTerminology.tsx | 2 ++ 5 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/AceEditor/madie-ace-editor.tsx b/src/AceEditor/madie-ace-editor.tsx index a81a9078..4b756e9d 100644 --- a/src/AceEditor/madie-ace-editor.tsx +++ b/src/AceEditor/madie-ace-editor.tsx @@ -31,6 +31,10 @@ export interface EditorPropsType { onChange?: (value: string) => void; handleApplyCode?: (code: string) => void; handleApplyParameter?: (parameter: Parameter) => void; + handleParameterEdit?: ( + parameter: Parameter, + parameterToApply: Parameter + ) => void; handleApplyValueSet?: (vs: ValueSetForSearch) => void; handleApplyDefinition?: (def: Definition) => void; handleDefinitionEdit?: (lib: SelectedLibrary, def: Definition) => void; diff --git a/src/CqlBuilderPanel/CqlBuilderPanel.tsx b/src/CqlBuilderPanel/CqlBuilderPanel.tsx index f6ea9c7a..63d864d9 100644 --- a/src/CqlBuilderPanel/CqlBuilderPanel.tsx +++ b/src/CqlBuilderPanel/CqlBuilderPanel.tsx @@ -28,6 +28,7 @@ export default function CqlBuilderPanel({ handleEditLibrary, handleApplyCode, handleApplyParameter, + handleParameterEdit, handleApplyValueSet, handleApplyDefinition, handleDefinitionEdit, @@ -211,6 +212,7 @@ export default function CqlBuilderPanel({ { const updatedParameter = { parameterName: parameter?.name, - expressionValue: parameter?.logic, + expression: + parameter?.logic?.slice(0, 1).toUpperCase() + + parameter?.logic?.slice(1, parameter?.logic?.length), } as Parameter; return ( diff --git a/src/CqlBuilderPanel/Parameters/ParameterBuilder.tsx b/src/CqlBuilderPanel/Parameters/ParameterBuilder.tsx index 749fe37a..0a28e228 100644 --- a/src/CqlBuilderPanel/Parameters/ParameterBuilder.tsx +++ b/src/CqlBuilderPanel/Parameters/ParameterBuilder.tsx @@ -9,7 +9,7 @@ import AceEditor from "react-ace"; export interface Parameter { parameterName?: string; - expressionValue?: string; + expression?: string; } export interface ParameterProps { @@ -27,16 +27,13 @@ export default function ParameterBuilder({ parameter, setOpenParameterDialog, }: ParameterProps) { - const [editorHeight, setEditorHeight] = useState("50px"); + const [editorHeight, setEditorHeight] = useState("180px"); const textAreaRef = useRef(null); - const [expressionEditorValue, setExpressionEditorValue] = useState( - parameter?.expressionValue || "" - ); const formik = useFormik({ initialValues: { parameterName: parameter?.parameterName || "", - expression: parameter?.expressionValue || "", + expression: parameter?.expression || "", }, validationSchema: ParameterSchemaValidator, enableReinitialize: true, @@ -44,13 +41,6 @@ export default function ParameterBuilder({ }); const { resetForm } = formik; - const isEditDialogFormDirty = () => { - if (parameter?.expressionValue !== expressionEditorValue || formik.dirty) { - return false; - } - return true; - }; - return (
@@ -103,12 +93,7 @@ export default function ParameterBuilder({