Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Workplace Search] Refactor nav constants #82646

Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import { i18n } from '@kbn/i18n';

import { EuiSpacer } from '@elastic/eui';

Expand All @@ -13,7 +12,7 @@ import { getWorkplaceSearchUrl } from '../../../shared/enterprise_search_url';
import { SideNav, SideNavLink } from '../../../shared/layout';

import { GroupSubNav } from '../../views/groups/components/group_sub_nav';
import { NAV } from '../../views/groups/constants';
import { NAV } from '../../constants';

import {
ORG_SOURCES_PATH,
Expand All @@ -29,38 +28,26 @@ export const WorkplaceSearchNav: React.FC = () => {
return (
<SideNav product={WORKPLACE_SEARCH_PLUGIN}>
<SideNavLink to="/" isRoot>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.overview', {
defaultMessage: 'Overview',
})}
{NAV.OVERVIEW}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(ORG_SOURCES_PATH)}>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.sources', {
defaultMessage: 'Sources',
})}
{NAV.SOURCES}
</SideNavLink>
<SideNavLink to={GROUPS_PATH} subNav={<GroupSubNav />}>
{NAV.GROUPS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${ROLE_MAPPINGS_PATH}`)}>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.roleMappings', {
defaultMessage: 'Role Mappings',
})}
{NAV.ROLE_MAPPINGS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SECURITY_PATH}`)}>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.security', {
defaultMessage: 'Security',
})}
{NAV.SECURITY}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(ORG_SETTINGS_PATH)}>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.settings', {
defaultMessage: 'Settings',
})}
{NAV.SETTINGS}
</SideNavLink>
<EuiSpacer />
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SOURCES_PATH}`)}>
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard', {
defaultMessage: 'View my personal dashboard',
})}
{NAV.PERSONAL_DASHBOARD}
</SideNavLink>
</SideNav>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,44 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';

export const NAV = {
OVERVIEW: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.overview', {
defaultMessage: 'Overview',
}),
SOURCES: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.sources', {
defaultMessage: 'Sources',
}),
GROUPS: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.groups', {
defaultMessage: 'Groups',
}),
GROUP_OVERVIEW: i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.nav.groups.groupOverview',
{
defaultMessage: 'Overview',
}
),
SOURCE_PRIORITIZATION: i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.nav.groups.sourcePrioritization',
{ defaultMessage: 'Source Prioritization' }
),
ROLE_MAPPINGS: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.roleMappings', {
defaultMessage: 'Role Mappings',
}),
SECURITY: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.security', {
defaultMessage: 'Security',
}),
SETTINGS: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.settings', {
defaultMessage: 'Settings',
}),
PERSONAL_DASHBOARD: i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard',
{
defaultMessage: 'View my personal dashboard',
}
),
};

export const MAX_TABLE_ROW_ICONS = 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { AppLogic } from './app_logic';
import { Layout } from '../shared/layout';
import { WorkplaceSearchNav, WorkplaceSearchHeaderActions } from './components/layout';

import { SETUP_GUIDE_PATH } from './routes';
import { GROUPS_PATH, SETUP_GUIDE_PATH } from './routes';

import { SetupGuide } from './views/setup_guide';
import { ErrorState } from './views/error_state';
Expand Down Expand Up @@ -56,7 +56,7 @@ export const WorkplaceSearchConfigured: React.FC<IInitialAppData> = (props) => {
<ErrorState />
) : (
<Switch>
<Route path="/groups">
<Route path={GROUPS_PATH}>
<GroupsRouter />
</Route>
<Route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from 'react';
import { useValues } from 'kea';

import { GroupLogic } from '../group_logic';
import { NAV } from '../constants';
import { NAV } from '../../../constants';

import { SideNavLink } from '../../../../shared/layout';

Expand All @@ -23,7 +23,7 @@ export const GroupSubNav: React.FC = () => {

return (
<>
<SideNavLink to={getGroupPath(id)}>{NAV.OVERVIEW}</SideNavLink>
<SideNavLink to={getGroupPath(id)}>{NAV.GROUP_OVERVIEW}</SideNavLink>
<SideNavLink to={getGroupSourcePrioritizationPath(id)}>
{NAV.SOURCE_PRIORITIZATION}
</SideNavLink>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kiban
import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';

import { GROUP_SOURCE_PRIORITIZATION_PATH, GROUP_PATH } from '../../routes';
import { NAV } from './constants';
import { NAV } from '../../constants';
import { GroupLogic } from './group_logic';

import { ManageUsersModal } from './components/manage_users_modal';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SetWorkplaceSearchChrome as SetPageChrome } from '../../../shared/kiban
import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';

import { GROUP_PATH, GROUPS_PATH } from '../../routes';
import { NAV } from './constants';
import { NAV } from '../../constants';

import { GroupsLogic } from './groups_logic';

Expand Down