From fab30aae796be9c0f57ff64fe47ceda6fbd2f231 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Mon, 9 Sep 2024 14:29:53 -0700 Subject: [PATCH] Propagate values to input modal; tune wording Signed-off-by: Tyler Ohlsen --- .../processor_inputs/input_transform_modal.tsx | 12 +++++++----- .../processor_inputs/ml_processor_inputs.tsx | 7 +++++++ .../processor_inputs/output_transform_modal.tsx | 8 ++++---- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/public/pages/workflow_detail/workflow_inputs/processor_inputs/input_transform_modal.tsx b/public/pages/workflow_detail/workflow_inputs/processor_inputs/input_transform_modal.tsx index 7e4033af..2aac3a98 100644 --- a/public/pages/workflow_detail/workflow_inputs/processor_inputs/input_transform_modal.tsx +++ b/public/pages/workflow_detail/workflow_inputs/processor_inputs/input_transform_modal.tsx @@ -68,6 +68,7 @@ interface InputTransformModalProps { inputMapField: IConfigField; inputMapFieldPath: string; modelInterface: ModelInterface | undefined; + valueOptions: { label: string }[]; onClose: () => void; } @@ -163,7 +164,7 @@ export function InputTransformModal(props: InputTransformModalProps) { Fetch some sample input data and see how it is transformed. - Expected input + Source input { @@ -266,7 +267,7 @@ export function InputTransformModal(props: InputTransformModalProps) { }) .catch((error: any) => { getCore().notifications.toasts.addDanger( - `Failed to fetch input data` + `Failed to fetch source input data` ); }); break; @@ -307,12 +308,13 @@ export function InputTransformModal(props: InputTransformModalProps) { root object selector "${JSONPATH_ROOT_SELECTOR}"`} helpLink={ML_INFERENCE_DOCS_LINK} keyPlaceholder="Model input field" + keyOptions={parseModelInputs(props.modelInterface)} valuePlaceholder={ props.context === PROCESSOR_CONTEXT.SEARCH_REQUEST ? 'Query field' : 'Document field' } - keyOptions={parseModelInputs(props.modelInterface)} + valueOptions={props.valueOptions} // If the map we are adding is the first one, populate the selected option to index 0 onMapAdd={(curArray) => { if (isEmpty(curArray)) { @@ -356,10 +358,10 @@ export function InputTransformModal(props: InputTransformModalProps) { )} {outputOptions.length === 1 ? ( - Expected output + Transformed input ) : ( Expected output for} + prepend={Transformed input for} options={outputOptions} value={selectedOutputOption} onChange={(e) => { diff --git a/public/pages/workflow_detail/workflow_inputs/processor_inputs/ml_processor_inputs.tsx b/public/pages/workflow_detail/workflow_inputs/processor_inputs/ml_processor_inputs.tsx index 53038bbf..bc6fa033 100644 --- a/public/pages/workflow_detail/workflow_inputs/processor_inputs/ml_processor_inputs.tsx +++ b/public/pages/workflow_detail/workflow_inputs/processor_inputs/ml_processor_inputs.tsx @@ -213,6 +213,13 @@ export function MLProcessorInputs(props: MLProcessorInputsProps) { inputMapField={inputMapField} inputMapFieldPath={inputMapFieldPath} modelInterface={modelInterface} + valueOptions={ + props.context === PROCESSOR_CONTEXT.INGEST + ? docFields + : props.context === PROCESSOR_CONTEXT.SEARCH_REQUEST + ? queryFields + : indexMappingFields + } onClose={() => setIsInputTransformModalOpen(false)} /> )} diff --git a/public/pages/workflow_detail/workflow_inputs/processor_inputs/output_transform_modal.tsx b/public/pages/workflow_detail/workflow_inputs/processor_inputs/output_transform_modal.tsx index 393459c1..56a7408e 100644 --- a/public/pages/workflow_detail/workflow_inputs/processor_inputs/output_transform_modal.tsx +++ b/public/pages/workflow_detail/workflow_inputs/processor_inputs/output_transform_modal.tsx @@ -126,7 +126,7 @@ export function OutputTransformModal(props: OutputTransformModalProps) { Fetch some sample output data and see how it is transformed. - Expected input + Source output { @@ -219,7 +219,7 @@ export function OutputTransformModal(props: OutputTransformModalProps) { }) .catch((error: any) => { getCore().notifications.toasts.addDanger( - `Failed to fetch input data` + `Failed to fetch source output data` ); }); break; @@ -282,10 +282,10 @@ export function OutputTransformModal(props: OutputTransformModalProps) { <> {outputOptions.length === 1 ? ( - Expected output + Transformed output ) : ( Expected output for} + prepend={Transformed output for} options={outputOptions} value={selectedOutputOption} onChange={(e) => {