@@ -30,8 +30,9 @@ import { AppState } from '../../../../store';
30
30
interface ModelFieldProps {
31
31
field : IConfigField ;
32
32
fieldPath : string ; // the full path in string-form to the field (e.g., 'ingest.enrich.processors.text_embedding_processor.inputField')
33
- hasModelInterface : boolean ;
34
- onModelChange : ( modelId : string ) => void ;
33
+ hasModelInterface ?: boolean ;
34
+ onModelChange ?: ( modelId : string ) => void ;
35
+ showMissingInterfaceCallout ?: boolean ;
35
36
}
36
37
37
38
type ModelItem = ModelFormValue & {
@@ -47,7 +48,10 @@ export function ModelField(props: ModelFieldProps) {
47
48
// re-fetch here as it could overload client-side if user clicks back and forth /
48
49
// keeps re-rendering this component (and subsequently re-fetching data) as they're building flows
49
50
const models = useSelector ( ( state : AppState ) => state . ml . models ) ;
50
- //const models = {};
51
+
52
+ // Set defaults for optional props
53
+ const showMissingInterfaceCallout = props . showMissingInterfaceCallout ?? true ;
54
+ const hasModelInterface = props . hasModelInterface ?? false ;
51
55
52
56
const { errors, touched, values } = useFormikContext < WorkflowFormValues > ( ) ;
53
57
@@ -74,7 +78,8 @@ export function ModelField(props: ModelFieldProps) {
74
78
75
79
return (
76
80
< >
77
- { ! props . hasModelInterface &&
81
+ { showMissingInterfaceCallout &&
82
+ ! hasModelInterface &&
78
83
! isEmpty ( getIn ( values , props . fieldPath ) ?. id ) && (
79
84
< >
80
85
< EuiCallOut
@@ -156,7 +161,9 @@ export function ModelField(props: ModelFieldProps) {
156
161
form . setFieldValue ( props . fieldPath , {
157
162
id : option ,
158
163
} as ModelFormValue ) ;
159
- props . onModelChange ( option ) ;
164
+ if ( props . onModelChange ) {
165
+ props . onModelChange ( option ) ;
166
+ }
160
167
} }
161
168
isInvalid = {
162
169
getIn ( errors , field . name ) && getIn ( touched , field . name )
0 commit comments