diff --git a/x-pack/plugins/painless_lab/public/application/components/output_pane/context_tab.tsx b/x-pack/plugins/painless_lab/public/application/components/output_pane/context_tab.tsx index 06325c5c2661e..619c966506ab7 100644 --- a/x-pack/plugins/painless_lab/public/application/components/output_pane/context_tab.tsx +++ b/x-pack/plugins/painless_lab/public/application/components/output_pane/context_tab.tsx @@ -29,121 +29,117 @@ interface Props { onContextChange: ContextChangeHandler; } -export function ContextTab({ context, contextSetup, onContextChange }: Props) { - return ( - <> - +export const ContextTab = ({ context, contextSetup, onContextChange }: Props) => ( + <> + + + + {' '} + + + + } + labelAppend={ + + + {i18n.translate('xpack.painlessLab.contextFieldDocLinkText', { + defaultMessage: 'Context docs', + })} + + + } + fullWidth + > + onContextChange({ context: value })} + itemLayoutAlign="top" + hasDividers + fullWidth + /> + + + {['filter', 'score'].indexOf(context) !== -1 && ( - {' '} + {' '} } - labelAppend={ - - - {i18n.translate('xpack.painlessLab.contextFieldDocLinkText', { - defaultMessage: 'Context docs', - })} - - - } fullWidth > - onContextChange({ context: value })} - itemLayoutAlign="top" - hasDividers + { + onContextChange({ + contextSetup: Object.assign({}, contextSetup, { index: e.target.value }), + }); + }} /> - - {['filter', 'score'].indexOf(context) !== -1 && ( - - - {' '} - - - - } - fullWidth - > - { - onContextChange({ - contextSetup: Object.assign({}, contextSetup, { index: e.target.value }), - }); + )} + {['filter', 'score'].indexOf(context) !== -1 && ( + + + {' '} + + + + } + fullWidth + > + + { + const newContextSetup = Object.assign({}, contextSetup, { document: value }); + onContextChange({ contextSetup: newContextSetup }); + }} + options={{ + fontSize: 12, + minimap: { + enabled: false, + }, + scrollBeyondLastLine: false, + wordWrap: 'on', + wrappingIndent: 'indent', + automaticLayout: true, }} /> - - )} - {['filter', 'score'].indexOf(context) !== -1 && ( - - - {' '} - - - - } - fullWidth - > - - { - onContextChange({ - contextSetup: Object.assign({}, contextSetup, { document: value }), - }); - }} - options={{ - fontSize: 12, - minimap: { - enabled: false, - }, - scrollBeyondLastLine: false, - wordWrap: 'on', - wrappingIndent: 'indent', - automaticLayout: true, - }} - /> - - - )} - - ); -} + + + )} + +); diff --git a/x-pack/plugins/painless_lab/public/application/components/output_pane/parameters_tab.tsx b/x-pack/plugins/painless_lab/public/application/components/output_pane/parameters_tab.tsx index b731ba0cbdaa7..3542c99b2584f 100644 --- a/x-pack/plugins/painless_lab/public/application/components/output_pane/parameters_tab.tsx +++ b/x-pack/plugins/painless_lab/public/application/components/output_pane/parameters_tab.tsx @@ -62,7 +62,7 @@ export function ParametersTab({ contextSetup, onContextChange }: Props) { > onContextChange({ contextSetup: { params: value } })}