diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.tsx index a6f91b1783bc9..a7308514de182 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/components/custom_url_editor/editor.tsx @@ -223,6 +223,7 @@ export const CustomUrlEditor: FC = ({ compressed > void; + editMode: 'inline' | 'modal'; } interface CustomUrlsState { @@ -188,7 +195,7 @@ export class CustomUrls extends Component { this.setState({ editorOpen: false }); }; - render() { + renderEditor() { const { customUrls, editorOpen, @@ -198,69 +205,108 @@ export class CustomUrls extends Component { queryEntityFieldNames, } = this.state; + const editMode = this.props.editMode ?? 'inline'; + const editor = ( + + ); + const isValidEditorSettings = - editorOpen === true && editorSettings !== undefined + editorOpen && editorSettings !== undefined ? isValidCustomUrlSettings(editorSettings, customUrls) : true; + const addButton = ( + + + + ); + + const testButton = ( + + + + ); + + return editMode === 'inline' ? ( + + + + {editor} + + + + {addButton} + {testButton} + + + ) : ( + + + + + + + + + {editor} + + + {testButton} + {addButton} + + + + ); + } + + render() { + const { customUrls, editorOpen } = this.state; + const { editMode = 'inline' } = this.props; + return ( <> - {editorOpen === false ? ( + {(!editorOpen || editMode === 'modal') && ( - ) : ( - - - - - - - - - - - - - - - - - )} + {editorOpen && this.renderEditor()} { job={jobCreator.jobConfig} jobCustomUrls={jobCreator.customUrls ?? []} setCustomUrls={setCustomUrls} + editMode="modal" /> );