From 16d11f3bc5adb1d95db784cb8b4a9bb9dbadf1e1 Mon Sep 17 00:00:00 2001 From: Amardeepsingh Siglani Date: Fri, 15 Mar 2024 13:14:55 -0700 Subject: [PATCH] don't show index-pattern creation form once created (#927) Signed-off-by: Amardeepsingh Siglani --- .../components/CreateIndexPatternForm.tsx | 3 +-- .../components/FindingDetailsFlyout.tsx | 25 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/public/pages/Findings/components/CreateIndexPatternForm.tsx b/public/pages/Findings/components/CreateIndexPatternForm.tsx index e7bf2d1bf..b8569a4b9 100644 --- a/public/pages/Findings/components/CreateIndexPatternForm.tsx +++ b/public/pages/Findings/components/CreateIndexPatternForm.tsx @@ -115,7 +115,7 @@ export const CreateIndexPatternForm: React.FC = ({ return errors; }} - onSubmit={async (values, { setSubmitting }) => { + onSubmit={async (values) => { try { const newIndex = await indexPatternsService.createAndSave({ title: values.name, @@ -125,7 +125,6 @@ export const CreateIndexPatternForm: React.FC = ({ } catch (e) { console.warn(e); } - setSubmitting(false); }} > {(props) => ( diff --git a/public/pages/Findings/components/FindingDetailsFlyout.tsx b/public/pages/Findings/components/FindingDetailsFlyout.tsx index 7a46ba5c4..2871f87c9 100644 --- a/public/pages/Findings/components/FindingDetailsFlyout.tsx +++ b/public/pages/Findings/components/FindingDetailsFlyout.tsx @@ -422,12 +422,25 @@ export default class FindingDetailsFlyout extends Component< this.setState({ ...this.state, isCreateIndexPatternModalVisible: false }) } created={(indexPatternId) => { - this.setState({ - ...this.state, - indexPatternId, - isCreateIndexPatternModalVisible: false, - }); - window.open(`discover#/context/${indexPatternId}/${related_doc_ids[0]}`, '_blank'); + this.setState( + { + ...this.state, + indexPatternId, + isCreateIndexPatternModalVisible: false, + }, + () => { + this.setState({ + selectedTab: { + id: FindingFlyoutTabId.DETAILS, + content: this.getTabContent(FindingFlyoutTabId.DETAILS), + }, + }); + window.open( + `discover#/context/${indexPatternId}/${related_doc_ids[0]}`, + '_blank' + ); + } + ); }} >