Skip to content

Commit

Permalink
Propagate values to input modal; tune wording
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Ohlsen <[email protected]>
  • Loading branch information
ohltyler committed Sep 9, 2024
1 parent 5a1b700 commit fab30aa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ interface InputTransformModalProps {
inputMapField: IConfigField;
inputMapFieldPath: string;
modelInterface: ModelInterface | undefined;
valueOptions: { label: string }[];
onClose: () => void;
}

Expand Down Expand Up @@ -163,7 +164,7 @@ export function InputTransformModal(props: InputTransformModalProps) {
Fetch some sample input data and see how it is transformed.
</EuiText>
<EuiSpacer size="s" />
<EuiText>Expected input</EuiText>
<EuiText>Source input</EuiText>
<EuiSmallButton
style={{ width: '100px' }}
onClick={async () => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -356,10 +358,10 @@ export function InputTransformModal(props: InputTransformModalProps) {
)}
<EuiFlexItem grow={true}>
{outputOptions.length === 1 ? (
<EuiText>Expected output</EuiText>
<EuiText>Transformed input</EuiText>
) : (
<EuiCompressedSelect
prepend={<EuiText>Expected output for</EuiText>}
prepend={<EuiText>Transformed input for</EuiText>}
options={outputOptions}
value={selectedOutputOption}
onChange={(e) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export function OutputTransformModal(props: OutputTransformModalProps) {
Fetch some sample output data and see how it is transformed.
</EuiText>
<EuiSpacer size="s" />
<EuiText>Expected input</EuiText>
<EuiText>Source output</EuiText>
<EuiSmallButton
style={{ width: '100px' }}
onClick={async () => {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -282,10 +282,10 @@ export function OutputTransformModal(props: OutputTransformModalProps) {
<EuiFlexItem>
<>
{outputOptions.length === 1 ? (
<EuiText>Expected output</EuiText>
<EuiText>Transformed output</EuiText>
) : (
<EuiCompressedSelect
prepend={<EuiText>Expected output for</EuiText>}
prepend={<EuiText>Transformed output for</EuiText>}
options={outputOptions}
value={selectedOutputOption}
onChange={(e) => {
Expand Down

0 comments on commit fab30aa

Please sign in to comment.