From 30b4ba750bc87a5d64303c2d4b4b54390eedfb91 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Wed, 16 Jun 2021 22:31:09 -0700 Subject: [PATCH 1/6] Convert Groups page to new page template --- .../views/groups/groups.test.tsx | 34 ++++------- .../workplace_search/views/groups/groups.tsx | 59 +++++++++---------- 2 files changed, 39 insertions(+), 54 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx index 2929fa0ff1d618..4b66346c56b077 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx @@ -18,9 +18,8 @@ import { EuiFieldSearch, EuiLoadingSpinner } from '@elastic/eui'; import { DEFAULT_META } from '../../../shared/constants'; import { FlashMessages } from '../../../shared/flash_messages'; -import { Loading } from '../../../shared/loading'; import { EuiButtonTo } from '../../../shared/react_router_helpers'; -import { ViewContentHeader } from '../../components/shared/view_content_header'; +import { getPageHeaderActions } from '../../../test_helpers'; import { AddGroupModal } from './components/add_group_modal'; import { ClearFiltersLink } from './components/clear_filters_link'; @@ -68,18 +67,10 @@ describe('GroupOverview', () => { it('renders', () => { const wrapper = shallow(); - expect(wrapper.find(ViewContentHeader)).toHaveLength(1); expect(wrapper.find(GroupsTable)).toHaveLength(1); expect(wrapper.find(TableFilters)).toHaveLength(1); }); - it('returns loading when loading', () => { - setMockValues({ ...mockValues, groupsDataLoading: true }); - const wrapper = shallow(); - - expect(wrapper.find(Loading)).toHaveLength(1); - }); - it('gets search results when filters changed', () => { const wrapper = shallow(); @@ -96,8 +87,13 @@ describe('GroupOverview', () => { ...mockValues, newGroup: { name: 'group', id: '123' }, messages: [mockSuccessMessage], + // Needed for diving into page template + contentSource: {}, + group: {}, }); - const wrapper = shallow(); + const wrapper = shallow() + .dive() + .dive(); const flashMessages = wrapper.find(FlashMessages).dive().childAt(0).dive(); expect(flashMessages.find('[data-test-subj="NewGroupManageButton"]')).toHaveLength(1); @@ -122,13 +118,10 @@ describe('GroupOverview', () => { }); const wrapper = shallow(); + const actions = getPageHeaderActions(wrapper); - const Action: React.FC = () => - wrapper.find(ViewContentHeader).props().action as React.ReactElement | null; - const action = shallow(); - - expect(action.find('[data-test-subj="InviteUsersButton"]')).toHaveLength(1); - expect(action.find(EuiButtonTo)).toHaveLength(1); + expect(actions.find('[data-test-subj="InviteUsersButton"]')).toHaveLength(1); + expect(actions.find(EuiButtonTo)).toHaveLength(1); }); it('does not render inviteUsersButton when federated auth', () => { @@ -138,12 +131,9 @@ describe('GroupOverview', () => { }); const wrapper = shallow(); + const actions = getPageHeaderActions(wrapper); - const Action: React.FC = () => - wrapper.find(ViewContentHeader).props().action as React.ReactElement | null; - const action = shallow(); - - expect(action.find('[data-test-subj="InviteUsersButton"]')).toHaveLength(0); + expect(actions.find('[data-test-subj="InviteUsersButton"]')).toHaveLength(0); }); it('renders EuiLoadingSpinner when loading', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx index b82e141bc810ef..60806a53deb5f3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.tsx @@ -12,11 +12,11 @@ import { useActions, useValues } from 'kea'; import { EuiButton, EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FlashMessages, FlashMessagesLogic } from '../../../shared/flash_messages'; -import { Loading } from '../../../shared/loading'; +import { FlashMessagesLogic } from '../../../shared/flash_messages'; import { EuiButtonTo } from '../../../shared/react_router_helpers'; import { AppLogic } from '../../app_logic'; -import { ViewContentHeader } from '../../components/shared/view_content_header'; +import { WorkplaceSearchPageTemplate } from '../../components/layout'; +import { NAV } from '../../constants'; import { getGroupPath, USERS_PATH } from '../../routes'; import { AddGroupModal } from './components/add_group_modal'; @@ -52,10 +52,6 @@ export const Groups: React.FC = () => { return resetGroups; }, [filteredSources, filteredUsers, filterValue]); - if (groupsDataLoading) { - return ; - } - if (newGroup && hasMessages) { messages[0].description = ( { } const clearFilters = hasFiltersSet && ; - const inviteUsersButton = !isFederatedAuth ? ( + const inviteUsersButton = ( {i18n.translate('xpack.enterpriseSearch.workplaceSearch.groups.inviteUsers.action', { defaultMessage: 'Invite users', })} - ) : null; - - const headerAction = ( - - - - {i18n.translate('xpack.enterpriseSearch.workplaceSearch.groups.addGroupForm.action', { - defaultMessage: 'Create a group', - })} - - - {inviteUsersButton} - ); + const createGroupButton = ( + + {i18n.translate('xpack.enterpriseSearch.workplaceSearch.groups.addGroupForm.action', { + defaultMessage: 'Create a group', + })} + + ); + const headerActions = !isFederatedAuth + ? [inviteUsersButton, createGroupButton] + : [createGroupButton]; const noResults = ( @@ -115,23 +108,25 @@ export const Groups: React.FC = () => { ); return ( - <> - - - + }), + rightSideItems: headerActions, + }} + isLoading={groupsDataLoading} + > {numGroups > 0 && !groupListLoading ? : noResults} {newGroupModalOpen && } - + ); }; From f278925f5f9bbccf0839c8877332c096b60023f9 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Wed, 16 Jun 2021 22:40:57 -0700 Subject: [PATCH 2/6] Convert Groups > Group overview to new page template - Because dataLoading is no longer an early return, certain items need to be converted to conditional checks in order for the app to not crash --- .../groups/components/group_overview.test.tsx | 12 +++++----- .../groups/components/group_overview.tsx | 24 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx index 7f60b8d8584bad..47ee9d216fa6d8 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.test.tsx @@ -14,10 +14,8 @@ import { shallow } from 'enzyme'; import { EuiFieldText, EuiEmptyPrompt } from '@elastic/eui'; -import { Loading } from '../../../../shared/loading'; import { ContentSection } from '../../../components/shared/content_section'; import { SourcesTable } from '../../../components/shared/sources_table'; -import { ViewContentHeader } from '../../../components/shared/view_content_header'; import { GroupOverview } from './group_overview'; @@ -49,19 +47,21 @@ describe('GroupOverview', () => { }); setMockValues(mockValues); }); + it('renders', () => { const wrapper = shallow(); expect(wrapper.find(ContentSection)).toHaveLength(4); - expect(wrapper.find(ViewContentHeader)).toHaveLength(1); expect(wrapper.find(SourcesTable)).toHaveLength(1); }); - it('returns loading when loading', () => { - setMockValues({ ...mockValues, dataLoading: true }); + it('handles loading state fallbacks', () => { + setMockValues({ ...mockValues, group: {}, dataLoading: true }); const wrapper = shallow(); - expect(wrapper.find(Loading)).toHaveLength(1); + expect(wrapper.prop('isLoading')).toEqual(true); + expect(wrapper.prop('pageChrome')).toEqual(['Groups', '...']); + expect(wrapper.prop('pageHeader').pageTitle).toEqual(undefined); }); it('updates the input value', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.tsx index 364ca0ba472567..6914c5dcfcad1f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_overview.tsx @@ -23,14 +23,13 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Loading } from '../../../../shared/loading'; import { TruncatedContent } from '../../../../shared/truncate'; import { AppLogic } from '../../../app_logic'; import noSharedSourcesIcon from '../../../assets/share_circle.svg'; +import { WorkplaceSearchPageTemplate } from '../../../components/layout'; import { ContentSection } from '../../../components/shared/content_section'; import { SourcesTable } from '../../../components/shared/sources_table'; -import { ViewContentHeader } from '../../../components/shared/view_content_header'; -import { CANCEL_BUTTON } from '../../../constants'; +import { NAV, CANCEL_BUTTON } from '../../../constants'; import { GroupLogic, MAX_NAME_LENGTH } from '../group_logic'; import { GroupUsersTable } from './group_users_table'; @@ -127,9 +126,7 @@ export const GroupOverview: React.FC = () => { const { isFederatedAuth } = useValues(AppLogic); - if (dataLoading) return ; - - const truncatedName = ( + const truncatedName = name && ( ); @@ -162,8 +159,8 @@ export const GroupOverview: React.FC = () => { } ); - const hasContentSources = contentSources.length > 0; - const hasUsers = users.length > 0; + const hasContentSources = contentSources?.length > 0; + const hasUsers = users?.length > 0; const manageSourcesButton = ( @@ -272,13 +269,16 @@ export const GroupOverview: React.FC = () => { ); return ( - <> - - + {hasContentSources ? sourcesSection : sourcesEmptyState} {usersSection} {nameSection} {canDeleteGroup && deleteSection} - + ); }; From cb2c2be3d3911f35361fc5e7808bfee6fcc63af6 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Wed, 16 Jun 2021 22:47:27 -0700 Subject: [PATCH 3/6] Convert Groups > source prioritization to new page template --- .../group_source_prioritization.test.tsx | 10 +++---- .../group_source_prioritization.tsx | 26 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx index 0faeb1df5398c9..ba667c6d8152d4 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.test.tsx @@ -14,8 +14,6 @@ import { shallow } from 'enzyme'; import { EuiTable, EuiEmptyPrompt, EuiRange } from '@elastic/eui'; -import { Loading } from '../../../../shared/loading'; - import { GroupSourcePrioritization } from './group_source_prioritization'; const updatePriority = jest.fn(); @@ -43,17 +41,19 @@ describe('GroupSourcePrioritization', () => { setMockValues(mockValues); }); + it('renders', () => { const wrapper = shallow(); expect(wrapper.find(EuiTable)).toHaveLength(1); }); - it('returns loading when loading', () => { - setMockValues({ ...mockValues, dataLoading: true }); + it('handles loading state fallbacks', () => { + setMockValues({ ...mockValues, group: {}, dataLoading: true }); const wrapper = shallow(); - expect(wrapper.find(Loading)).toHaveLength(1); + expect(wrapper.prop('isLoading')).toEqual(true); + expect(wrapper.prop('pageChrome')).toEqual(['Groups', '...', 'Source Prioritization']); }); it('renders empty state', () => { diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.tsx index d7bc26e7d7be43..0fdaf2adde8699 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_source_prioritization.tsx @@ -27,9 +27,9 @@ import { import { i18n } from '@kbn/i18n'; import { SAVE_BUTTON_LABEL } from '../../../../shared/constants'; -import { Loading } from '../../../../shared/loading'; +import { WorkplaceSearchPageTemplate } from '../../../components/layout'; import { SourceIcon } from '../../../components/shared/source_icon'; -import { ViewContentHeader } from '../../../components/shared/view_content_header'; +import { NAV } from '../../../constants'; import { ContentSource } from '../../../types'; import { GroupLogic } from '../group_logic'; @@ -76,14 +76,12 @@ export const GroupSourcePrioritization: React.FC = () => { ); const { - group: { contentSources, name: groupName }, + group: { contentSources = [], name: groupName }, dataLoading, activeSourcePriorities, groupPrioritiesUnchanged, } = useValues(GroupLogic); - if (dataLoading) return ; - const headerAction = ( { ); return ( - <> - + {hasSources ? sourceTable : zeroState} - + ); }; From c49e0045db5c45422aa63dfbbfc7ca3d35fe4066 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Wed, 16 Jun 2021 22:54:23 -0700 Subject: [PATCH 4/6] Convert Group subnav to EuiSideNav format --- .../components/layout/nav.test.tsx | 3 ++ .../components/layout/nav.tsx | 3 +- .../groups/components/group_sub_nav.test.tsx | 37 +++++++++++-------- .../views/groups/components/group_sub_nav.tsx | 32 +++++++++------- 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.test.tsx index 90da5b3163ecfc..2e11a564ebe871 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.test.tsx @@ -9,6 +9,9 @@ jest.mock('../../../shared/layout', () => ({ ...jest.requireActual('../../../shared/layout'), generateNavLink: jest.fn(({ to }) => ({ href: to })), })); +jest.mock('../../views/groups/components/group_sub_nav', () => ({ + useGroupSubNav: () => [], +})); import React from 'react'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx index 8e7b13a6218214..90921e9308c1b9 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx @@ -19,6 +19,7 @@ import { GROUPS_PATH, ORG_SETTINGS_PATH, } from '../../routes'; +import { useGroupSubNav } from '../../views/groups/components/group_sub_nav'; export const useWorkplaceSearchNav = () => { const navItems: Array> = [ @@ -37,7 +38,7 @@ export const useWorkplaceSearchNav = () => { id: 'groups', name: NAV.GROUPS, ...generateNavLink({ to: GROUPS_PATH }), - items: [], // TODO: Group subnav + items: useGroupSubNav(), }, { id: 'usersRoles', diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx index 263ec5f1b27c0d..6e912e65a7b61c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.test.tsx @@ -7,26 +7,33 @@ import { setMockValues } from '../../../../__mocks__/kea_logic'; -import React from 'react'; +jest.mock('../../../../shared/layout', () => ({ + generateNavLink: jest.fn(({ to }) => ({ href: to })), +})); -import { shallow } from 'enzyme'; +import { useGroupSubNav } from './group_sub_nav'; -import { SideNavLink } from '../../../../shared/layout'; - -import { GroupSubNav } from './group_sub_nav'; - -describe('GroupSubNav', () => { - it('renders empty when no group id present', () => { - setMockValues({ group: {} }); - const wrapper = shallow(); +describe('useGroupSubNav', () => { + it('renders nav items', () => { + setMockValues({ group: { id: '1' } }); - expect(wrapper.find(SideNavLink)).toHaveLength(0); + expect(useGroupSubNav()).toEqual([ + { + id: 'groupOverview', + name: 'Overview', + href: '/groups/1', + }, + { + id: 'groupSourcePrioritization', + name: 'Source Prioritization', + href: '/groups/1/source_prioritization', + }, + ]); }); - it('renders nav items', () => { - setMockValues({ group: { id: '1' } }); - const wrapper = shallow(); + it('returns undefined when no group id is present', () => { + setMockValues({ group: {} }); - expect(wrapper.find(SideNavLink)).toHaveLength(2); + expect(useGroupSubNav()).toEqual(undefined); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.tsx index c5fc0717d11057..b27f38d75bcc06 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/components/group_sub_nav.tsx @@ -5,28 +5,34 @@ * 2.0. */ -import React from 'react'; - import { useValues } from 'kea'; -import { SideNavLink } from '../../../../shared/layout'; +import { EuiSideNavItemType } from '@elastic/eui'; + +import { generateNavLink } from '../../../../shared/layout'; import { NAV } from '../../../constants'; import { getGroupPath, getGroupSourcePrioritizationPath } from '../../../routes'; import { GroupLogic } from '../group_logic'; -export const GroupSubNav: React.FC = () => { +export const useGroupSubNav = () => { const { group: { id }, } = useValues(GroupLogic); - if (!id) return null; + if (!id) return undefined; + + const navItems: Array> = [ + { + id: 'groupOverview', + name: NAV.GROUP_OVERVIEW, + ...generateNavLink({ to: getGroupPath(id) }), + }, + { + id: 'groupSourcePrioritization', + name: NAV.SOURCE_PRIORITIZATION, + ...generateNavLink({ to: getGroupSourcePrioritizationPath(id) }), + }, + ]; - return ( - <> - {NAV.GROUP_OVERVIEW} - - {NAV.SOURCE_PRIORITIZATION} - - - ); + return navItems; }; From aebdca9ff0145fd159ead62b4b015e8cd5f5b243 Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Wed, 16 Jun 2021 22:56:52 -0700 Subject: [PATCH 5/6] Update routers --- .../applications/workplace_search/index.tsx | 10 +------- .../views/groups/group_router.test.tsx | 23 +------------------ .../views/groups/group_router.tsx | 14 +---------- .../views/groups/groups_router.tsx | 5 ---- 4 files changed, 3 insertions(+), 49 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx index dd263c3bd69f5d..81df0950fb231c 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/index.tsx @@ -41,7 +41,6 @@ import { SourceAdded } from './views/content_sources/components/source_added'; import { SourceSubNav } from './views/content_sources/components/source_sub_nav'; import { ErrorState } from './views/error_state'; import { GroupsRouter } from './views/groups'; -import { GroupSubNav } from './views/groups/components/group_sub_nav'; import { Overview } from './views/overview'; import { RoleMappings } from './views/role_mappings'; import { Security } from './views/security'; @@ -64,7 +63,6 @@ export const WorkplaceSearchConfigured: React.FC = (props) => { // We don't want so show the subnavs on the container root pages. const showSourcesSubnav = pathname !== SOURCES_PATH && pathname !== PERSONAL_SOURCES_PATH; - const showGroupsSubnav = pathname !== GROUPS_PATH; /** * Personal dashboard urls begin with /p/ @@ -132,13 +130,7 @@ export const WorkplaceSearchConfigured: React.FC = (props) => { - } />} - restrictWidth - readOnlyMode={readOnlyMode} - > - - + diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx index 4c13dbce3ef1e6..08140c525a84e1 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.test.tsx @@ -15,9 +15,6 @@ import { Route, Switch } from 'react-router-dom'; import { shallow } from 'enzyme'; -import { FlashMessages } from '../../../shared/flash_messages'; -import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome'; - import { GroupOverview } from './components/group_overview'; import { GroupSourcePrioritization } from './components/group_source_prioritization'; import { ManageUsersModal } from './components/manage_users_modal'; @@ -40,10 +37,10 @@ describe('GroupRouter', () => { resetGroup, }); }); + it('renders', () => { const wrapper = shallow(); - expect(wrapper.find(FlashMessages)).toHaveLength(1); expect(wrapper.find(Switch)).toHaveLength(1); expect(wrapper.find(Route)).toHaveLength(2); expect(wrapper.find(GroupOverview)).toHaveLength(1); @@ -62,22 +59,4 @@ describe('GroupRouter', () => { expect(wrapper.find(ManageUsersModal)).toHaveLength(1); expect(wrapper.find(SharedSourcesModal)).toHaveLength(1); }); - - it('handles breadcrumbs while loading', () => { - setMockValues({ - sharedSourcesModalVisible: false, - manageUsersModalVisible: false, - group: {}, - }); - - const loadingBreadcrumbs = ['Groups', '...']; - - const wrapper = shallow(); - - const firstBreadCrumb = wrapper.find(SetPageChrome).first(); - const lastBreadCrumb = wrapper.find(SetPageChrome).last(); - - expect(firstBreadCrumb.prop('trail')).toEqual([...loadingBreadcrumbs, 'Source Prioritization']); - expect(lastBreadCrumb.prop('trail')).toEqual(loadingBreadcrumbs); - }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.tsx index a5b8bd138d0c8b..950ebb79a21c18 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/group_router.tsx @@ -10,10 +10,6 @@ import { Route, Switch, useParams } from 'react-router-dom'; import { useActions, useValues } from 'kea'; -import { FlashMessages } from '../../../shared/flash_messages'; -import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome'; -import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry'; -import { NAV } from '../../constants'; import { GROUP_SOURCE_PRIORITIZATION_PATH, GROUP_PATH } from '../../routes'; import { GroupOverview } from './components/group_overview'; @@ -26,11 +22,7 @@ export const GroupRouter: React.FC = () => { const { groupId } = useParams() as { groupId: string }; const { initializeGroup, resetGroup } = useActions(GroupLogic); - const { - sharedSourcesModalVisible, - manageUsersModalVisible, - group: { name }, - } = useValues(GroupLogic); + const { sharedSourcesModalVisible, manageUsersModalVisible } = useValues(GroupLogic); useEffect(() => { initializeGroup(groupId); @@ -39,15 +31,11 @@ export const GroupRouter: React.FC = () => { return ( <> - - - - diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.tsx index d8c4f4801ba24b..06e0a18b933f2f 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups_router.tsx @@ -10,9 +10,6 @@ import { Route, Switch } from 'react-router-dom'; import { useActions } from 'kea'; -import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kibana_chrome'; -import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry'; -import { NAV } from '../../constants'; import { GROUP_PATH, GROUPS_PATH } from '../../routes'; import { GroupRouter } from './group_router'; @@ -31,8 +28,6 @@ export const GroupsRouter: React.FC = () => { return ( - - From 403a39ee308daa335c7d00df187547ab5049e29e Mon Sep 17 00:00:00 2001 From: Constance Chen Date: Thu, 17 Jun 2021 10:55:10 -0700 Subject: [PATCH 6/6] Fix failing unit test - Caused by merge w/ settings subnav - useRouteMatch needs to be mocked --- .../applications/workplace_search/views/groups/groups.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx index 4b66346c56b077..5be61da22fda9d 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/groups/groups.test.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import '../../../__mocks__/react_router'; import '../../../__mocks__/shallow_useeffect.mock'; import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic'; import { groups } from '../../__mocks__/groups.mock';