From 2af26b3a432ab90a86538542f7810a9613b3e88a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 13 Apr 2021 19:10:51 -0400 Subject: [PATCH] [Workplace Search] Hide Kibana chrome on 3rd party connector redirects (#97028) (#97045) Co-authored-by: Scotty Bollinger --- .../views/content_sources/components/source_added.test.tsx | 5 ++++- .../views/content_sources/components/source_added.tsx | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx index ddf89159b26755..9eecc41aa17780 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.test.tsx @@ -7,7 +7,7 @@ import '../../../../__mocks__/shallow_useeffect.mock'; -import { setMockActions } from '../../../../__mocks__'; +import { setMockActions, setMockValues } from '../../../../__mocks__'; import React from 'react'; import { useLocation } from 'react-router-dom'; @@ -20,9 +20,11 @@ import { SourceAdded } from './source_added'; describe('SourceAdded', () => { const saveSourceParams = jest.fn(); + const setChromeIsVisible = jest.fn(); beforeEach(() => { setMockActions({ saveSourceParams }); + setMockValues({ setChromeIsVisible }); }); it('renders', () => { @@ -32,5 +34,6 @@ describe('SourceAdded', () => { expect(wrapper.find(Loading)).toHaveLength(1); expect(saveSourceParams).toHaveBeenCalled(); + expect(setChromeIsVisible).toHaveBeenCalled(); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.tsx index 7c4e81d8e0755c..5b93b7a426936e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/content_sources/components/source_added.tsx @@ -9,10 +9,11 @@ import React, { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; import { Location } from 'history'; -import { useActions } from 'kea'; +import { useActions, useValues } from 'kea'; import { EuiPage, EuiPageBody } from '@elastic/eui'; +import { KibanaLogic } from '../../../../shared/kibana'; import { Loading } from '../../../../shared/loading'; import { AddSourceLogic } from './add_source/add_source_logic'; @@ -24,8 +25,12 @@ import { AddSourceLogic } from './add_source/add_source_logic'; */ export const SourceAdded: React.FC = () => { const { search } = useLocation() as Location; + const { setChromeIsVisible } = useValues(KibanaLogic); const { saveSourceParams } = useActions(AddSourceLogic); + // We don't want the personal dashboard to flash the Kibana chrome, so we hide it. + setChromeIsVisible(false); + useEffect(() => { saveSourceParams(search); }, []);