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] Move Personal Dashboard link to header #87244

Merged
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -19,11 +19,23 @@ describe('WorkplaceSearchHeaderActions', () => {
expect(wrapper.isEmptyRender()).toBe(true);
});

it('renders a link to the personal dashboard', () => {
externalUrl.enterpriseSearchUrl = 'http://localhost:3002';

const wrapper = shallow(<WorkplaceSearchHeaderActions />);

expect(wrapper.find(EuiButtonEmpty).first().prop('href')).toEqual(
'http://localhost:3002/ws/sources'
);
});

it('renders a link to the search application', () => {
externalUrl.enterpriseSearchUrl = 'http://localhost:3002';

const wrapper = shallow(<WorkplaceSearchHeaderActions />);

expect(wrapper.find(EuiButtonEmpty).prop('href')).toEqual('http://localhost:3002/ws/search');
expect(wrapper.find(EuiButtonEmpty).last().prop('href')).toEqual(
'http://localhost:3002/ws/search'
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,33 @@
*/

import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiButtonEmpty, EuiText } from '@elastic/eui';

import { externalUrl, getWorkplaceSearchUrl } from '../../../shared/enterprise_search_url';

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

export const WorkplaceSearchHeaderActions: React.FC = () => {
if (!externalUrl.enterpriseSearchUrl) return null;

return (
<EuiButtonEmpty
href={getWorkplaceSearchUrl('/search')}
target="_blank"
iconType="search"
style={{ marginRight: 5 }}
>
<EuiText size="s">
{i18n.translate('xpack.enterpriseSearch.workplaceSearch.headerActions.searchApplication', {
defaultMessage: 'Go to search application',
})}
</EuiText>
</EuiButtonEmpty>
<>
<EuiButtonEmpty
href={getWorkplaceSearchUrl('/sources')}
target="_blank"
iconType="user"
style={{ marginRight: 5 }}
>
<EuiText size="s">{NAV.PERSONAL_DASHBOARD}</EuiText>
</EuiButtonEmpty>
<EuiButtonEmpty
href={getWorkplaceSearchUrl('/search')}
target="_blank"
iconType="search"
style={{ marginRight: 5 }}
>
<EuiText size="s">{NAV.SEARCH}</EuiText>
</EuiButtonEmpty>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ describe('WorkplaceSearchNav', () => {

expect(wrapper.find(SideNav)).toHaveLength(1);
expect(wrapper.find(SideNavLink).first().prop('to')).toEqual('/');
expect(wrapper.find(SideNavLink)).toHaveLength(7);
expect(wrapper.find(SideNavLink)).toHaveLength(6);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,26 @@ interface Props {
groupsSubNav?: React.ReactNode;
}

export const WorkplaceSearchNav: React.FC<Props> = ({ sourcesSubNav, groupsSubNav }) => {
// TODO: icons
return (
<SideNav product={WORKPLACE_SEARCH_PLUGIN}>
<SideNavLink to="/" isRoot>
{NAV.OVERVIEW}
</SideNavLink>
<SideNavLink to={SOURCES_PATH} subNav={sourcesSubNav}>
{NAV.SOURCES}
</SideNavLink>
<SideNavLink to={GROUPS_PATH} subNav={groupsSubNav}>
{NAV.GROUPS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${ROLE_MAPPINGS_PATH}`)}>
{NAV.ROLE_MAPPINGS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SECURITY_PATH}`)}>
{NAV.SECURITY}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(ORG_SETTINGS_PATH)}>
{NAV.SETTINGS}
</SideNavLink>
<EuiSpacer />
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SOURCES_PATH}`)}>
{NAV.PERSONAL_DASHBOARD}
</SideNavLink>
</SideNav>
);
};
export const WorkplaceSearchNav: React.FC<Props> = ({ sourcesSubNav, groupsSubNav }) => (
<SideNav product={WORKPLACE_SEARCH_PLUGIN}>
<SideNavLink to="/" isRoot>
{NAV.OVERVIEW}
</SideNavLink>
<SideNavLink to={SOURCES_PATH} subNav={sourcesSubNav}>
{NAV.SOURCES}
</SideNavLink>
<SideNavLink to={GROUPS_PATH} subNav={groupsSubNav}>
{NAV.GROUPS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${ROLE_MAPPINGS_PATH}`)}>
{NAV.ROLE_MAPPINGS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SECURITY_PATH}`)}>
{NAV.SECURITY}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(ORG_SETTINGS_PATH)}>
{NAV.SETTINGS}
</SideNavLink>
<EuiSpacer />
</SideNav>
);
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export const NAV = {
defaultMessage: 'View my personal dashboard',
}
),
SEARCH: i18n.translate('xpack.enterpriseSearch.workplaceSearch.nav.searchApplication', {
defaultMessage: 'Go to search application',
}),
};

export const MAX_TABLE_ROW_ICONS = 3;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -6964,13 +6964,13 @@
"xpack.enterpriseSearch.workplaceSearch.groups.sourcesModalTitle": "{groupName}と共有するコンテンツソースを選択",
"xpack.enterpriseSearch.workplaceSearch.groups.userListCount": "{maxVisibleUsers}/{numUsers}ユーザーを表示しています。",
"xpack.enterpriseSearch.workplaceSearch.groups.usersModalLabel": "ユーザー",
"xpack.enterpriseSearch.workplaceSearch.headerActions.searchApplication": "検索アプリケーションに移動",
"xpack.enterpriseSearch.workplaceSearch.nav.groups": "グループ",
"xpack.enterpriseSearch.workplaceSearch.nav.groups.groupOverview": "概要",
"xpack.enterpriseSearch.workplaceSearch.nav.groups.sourcePrioritization": "ソースの優先度",
"xpack.enterpriseSearch.workplaceSearch.nav.overview": "概要",
"xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard": "個人のダッシュボードを表示",
"xpack.enterpriseSearch.workplaceSearch.nav.roleMappings": "ロールマッピング",
"xpack.enterpriseSearch.workplaceSearch.nav.searchApplication": "検索アプリケーションに移動",
"xpack.enterpriseSearch.workplaceSearch.nav.security": "セキュリティ",
"xpack.enterpriseSearch.workplaceSearch.nav.settings": "設定",
"xpack.enterpriseSearch.workplaceSearch.nav.sources": "ソース",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -6970,13 +6970,13 @@
"xpack.enterpriseSearch.workplaceSearch.groups.sourcesModalTitle": "选择要与 {groupName} 共享的内容源",
"xpack.enterpriseSearch.workplaceSearch.groups.userListCount": "正在显示 {numUsers} 个用户中的 {maxVisibleUsers} 个。",
"xpack.enterpriseSearch.workplaceSearch.groups.usersModalLabel": "用户",
"xpack.enterpriseSearch.workplaceSearch.headerActions.searchApplication": "前往搜索应用程序",
"xpack.enterpriseSearch.workplaceSearch.nav.groups": "组",
"xpack.enterpriseSearch.workplaceSearch.nav.groups.groupOverview": "概览",
"xpack.enterpriseSearch.workplaceSearch.nav.groups.sourcePrioritization": "源的优先级排序",
"xpack.enterpriseSearch.workplaceSearch.nav.overview": "概览",
"xpack.enterpriseSearch.workplaceSearch.nav.personalDashboard": "查看我的个人仪表板",
"xpack.enterpriseSearch.workplaceSearch.nav.roleMappings": "角色映射",
"xpack.enterpriseSearch.workplaceSearch.nav.searchApplication": "前往搜索应用程序",
"xpack.enterpriseSearch.workplaceSearch.nav.security": "安全",
"xpack.enterpriseSearch.workplaceSearch.nav.settings": "设置",
"xpack.enterpriseSearch.workplaceSearch.nav.sources": "源",
Expand Down