-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support skipping ingest in
WorkflowInputs
(#194)
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
6 changed files
with
161 additions
and
48 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
public/pages/workflow_detail/workflow_inputs/input_fields/boolean_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { Field, FieldProps } from 'formik'; | ||
import { EuiRadioGroup, EuiRadioGroupOption } from '@elastic/eui'; | ||
|
||
interface BooleanFieldProps { | ||
fieldPath: string; // the full path in string-form to the field (e.g., 'ingest.enrich.processors.text_embedding_processor.inputField') | ||
onFormChange: () => void; | ||
enabledOption: EuiRadioGroupOption; | ||
disabledOption: EuiRadioGroupOption; | ||
} | ||
|
||
/** | ||
* An input field for a boolean value. Implemented as an EuiRadioGroup with 2 mutually exclusive options. | ||
*/ | ||
export function BooleanField(props: BooleanFieldProps) { | ||
return ( | ||
<Field name={props.fieldPath}> | ||
{({ field, form }: FieldProps) => { | ||
return ( | ||
<EuiRadioGroup | ||
options={[props.enabledOption, props.disabledOption]} | ||
idSelected={ | ||
field.value === undefined || field.value === true | ||
? props.enabledOption.id | ||
: props.disabledOption.id | ||
} | ||
onChange={(id) => { | ||
form.setFieldValue(field.name, !field.value); | ||
props.onFormChange(); | ||
}} | ||
/> | ||
); | ||
}} | ||
</Field> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters