-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enterprise Search] Add Workplace Search side navigation (#74894)
* Add routes * Add version for use in doc link * Set up basic router layout + WorkplaceSearchNav * Update views to account for Layout * Move version to common folder * Fix version path * Remove product button No longer needed since we have all top-level app links in Kibana as a part of this PR * You know, for search * Remove comment * Remove unused i18n properties from JSON Tests were failing after removing component: https://kibana-ci.elastic.co/job/elastic+kibana+pipeline-pull-request/67797/execution/node/382/log/ * Revert button and i18n copy removal This reverts commit ba05351. * Move Overview out of layout to hide nav For now, the route for groups was added to avoid having comment out the code. Will add the groups component in a future PR * Revert layout changes to Overview Since there is no nav, the padding was missing and the view looked off. Reverting to the 7.9, centered column view * Remove extra Overview component Was causing tests to fail * Revert error state to use EuiPage Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
- Loading branch information
1 parent
1626490
commit ac04e05
Showing
9 changed files
with
254 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { SemVer } from 'semver'; | ||
import pkg from '../../../../package.json'; | ||
|
||
export const CURRENT_VERSION = new SemVer(pkg.version as string); | ||
export const CURRENT_MAJOR_VERSION = CURRENT_VERSION.major; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...plugins/enterprise_search/public/applications/workplace_search/components/layout/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { WorkplaceSearchNav } from './nav'; |
22 changes: 22 additions & 0 deletions
22
...ins/enterprise_search/public/applications/workplace_search/components/layout/nav.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import '../../../__mocks__/shallow_usecontext.mock'; | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import { SideNav, SideNavLink } from '../../../shared/layout'; | ||
import { WorkplaceSearchNav } from './'; | ||
|
||
describe('WorkplaceSearchNav', () => { | ||
it('renders', () => { | ||
const wrapper = shallow(<WorkplaceSearchNav />); | ||
|
||
expect(wrapper.find(SideNav)).toHaveLength(1); | ||
expect(wrapper.find(SideNavLink).first().prop('to')).toEqual('/'); | ||
expect(wrapper.find(SideNavLink).last().prop('to')).toEqual('http://localhost:3002/ws/search'); | ||
}); | ||
}); |
74 changes: 74 additions & 0 deletions
74
.../plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import React, { useContext } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
|
||
import { EuiSpacer } from '@elastic/eui'; | ||
|
||
import { WORKPLACE_SEARCH_PLUGIN } from '../../../../../common/constants'; | ||
import { KibanaContext, IKibanaContext } from '../../../index'; | ||
import { SideNav, SideNavLink } from '../../../shared/layout'; | ||
|
||
import { | ||
ORG_SOURCES_PATH, | ||
SOURCES_PATH, | ||
SECURITY_PATH, | ||
ROLE_MAPPINGS_PATH, | ||
GROUPS_PATH, | ||
ORG_SETTINGS_PATH, | ||
} from '../../routes'; | ||
|
||
export const WorkplaceSearchNav: React.FC = () => { | ||
const { enterpriseSearchUrl } = useContext(KibanaContext) as IKibanaContext; | ||
const legacyUrl = (path: string) => `${enterpriseSearchUrl}/ws#${path}`; | ||
|
||
// TODO: icons | ||
return ( | ||
<SideNav product={WORKPLACE_SEARCH_PLUGIN}> | ||
<SideNavLink to="/" isRoot> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.overview', { | ||
defaultMessage: 'Overview', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={legacyUrl(ORG_SOURCES_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.sources', { | ||
defaultMessage: 'Sources', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={legacyUrl(GROUPS_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.groups', { | ||
defaultMessage: 'Groups', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={legacyUrl(ROLE_MAPPINGS_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.roleMappings', { | ||
defaultMessage: 'Role Mappings', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={legacyUrl(SECURITY_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.security', { | ||
defaultMessage: 'Security', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={legacyUrl(ORG_SETTINGS_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.settings', { | ||
defaultMessage: 'Settings', | ||
})} | ||
</SideNavLink> | ||
<EuiSpacer /> | ||
<SideNavLink isExternal to={legacyUrl(SOURCES_PATH)}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard', { | ||
defaultMessage: 'View my personal dashboard', | ||
})} | ||
</SideNavLink> | ||
<SideNavLink isExternal to={`${enterpriseSearchUrl}/ws/search`}> | ||
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.search', { | ||
defaultMessage: 'Go to search application', | ||
})} | ||
</SideNavLink> | ||
</SideNav> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters