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] Add remaining i18n support for the Content Sources tree #89910

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 @@ -311,3 +311,157 @@ export const SOURCE_NAME_LABEL = i18n.translate(
defaultMessage: 'Source name',
}
);

export const ORG_SOURCES_LINK = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.org.link',
{
defaultMessage: 'Add an organization content source',
}
);

export const ORG_SOURCES_HEADER_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.org.title',
{
defaultMessage: 'Organization sources',
}
);

export const ORG_SOURCES_HEADER_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.org.description',
{
defaultMessage:
'Organization sources are available to the entire organization and can be assigned to specific user groups.',
}
);

export const PRIVATE_LINK_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.link',
{
defaultMessage: 'Add a private content source',
}
);

export const PRIVATE_CAN_CREATE_PAGE_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.canCreate.title',
{
defaultMessage: 'Manage private content sources',
}
);

export const PRIVATE_VIEW_ONLY_PAGE_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.vewOnly.title',
{
defaultMessage: 'Review Group Sources',
}
);

export const PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.vewOnly.description',
{
defaultMessage: 'Review the status of all sources shared with your Group.',
}
);

export const PRIVATE_CAN_CREATE_PAGE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.canCreate.description',
{
defaultMessage:
'Review the status of all connected private sources, and manage private sources for your account.',
}
);

export const PRIVATE_HEADER_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.header.title',
{
defaultMessage: 'My private content sources',
}
);

export const PRIVATE_HEADER_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.header.description',
{
defaultMessage: 'Private content sources are available only to you.',
}
);

export const PRIVATE_SHARED_SOURCES_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.privateShared.header.title',
{
defaultMessage: 'Shared content sources',
}
);

export const PRIVATE_EMPTY_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.empty.title',
{
defaultMessage: 'You have no private sources',
}
);
export const SHARED_EMPTY_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.shared.empty.title',
{
defaultMessage: 'No content source available',
}
);

export const SHARED_EMPTY_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.shared.empty.description',
{
defaultMessage:
'Once content sources are shared with you, they will be displayed here, and available via the search experience.',
}
);

export const AND = i18n.translate('xpack.enterpriseSearch.workplaceSearch.and', {
defaultMessage: 'and',
});

export const LICENSE_CALLOUT_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.licenseCallout.title',
{
defaultMessage: 'Private Sources are no longer available',
}
);

export const LICENSE_CALLOUT_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.licenseCallout.description',
{
defaultMessage: 'Contact your search experience administrator for more information.',
}
);

export const SOURCE_DISABLED_CALLOUT_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.sourceDisabled.title',
{
defaultMessage: 'Content source is disabled',
}
);

export const SOURCE_DISABLED_CALLOUT_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.sourceDisabled.description',
{
defaultMessage:
'Your organization’s license level has changed. Your data is safe, but document-level permissions are no longer supported and searching of this source has been disabled. Upgrade to a Platinum license to re-enable this source.',
}
);

export const SOURCE_DISABLED_CALLOUT_BUTTON = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.sourceDisabled.button',
{
defaultMessage: 'Explore Platinum license',
}
);

export const DOCUMENT_PERMISSIONS_LINK = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.documentPermissionsLink',
{
defaultMessage: 'Learn more about document-level permission configuration',
}
);

export const UNDERSTAND_BUTTON = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.understandButton',
{
defaultMessage: 'I understand',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import { Link, Redirect } from 'react-router-dom';
import { EuiButton } from '@elastic/eui';
import { ADD_SOURCE_PATH, getSourcesPath } from '../../routes';

import {
ORG_SOURCES_LINK,
ORG_SOURCES_HEADER_TITLE,
ORG_SOURCES_HEADER_DESCRIPTION,
} from './constants';

import { Loading } from '../../../shared/loading';
import { ContentSection } from '../../components/shared/content_section';
import { SourcesTable } from '../../components/shared/sources_table';
Expand All @@ -21,11 +27,6 @@ import { SourcesLogic } from './sources_logic';

import { SourcesView } from './sources_view';

const ORG_LINK_TITLE = 'Add an organization content source';
const ORG_HEADER_TITLE = 'Organization sources';
const ORG_HEADER_DESCRIPTION =
'Organization sources are available to the entire organization and can be assigned to specific user groups.';

export const OrganizationSources: React.FC = () => {
const { initializeSources, setSourceSearchability, resetSourcesState } = useActions(SourcesLogic);

Expand All @@ -40,28 +41,22 @@ export const OrganizationSources: React.FC = () => {

if (contentSources.length === 0) return <Redirect to={getSourcesPath(ADD_SOURCE_PATH, true)} />;

const linkTitle = ORG_LINK_TITLE;
const headerTitle = ORG_HEADER_TITLE;
const headerDescription = ORG_HEADER_DESCRIPTION;
const sectionTitle = '';
const sectionDescription = '';

return (
<SourcesView>
<ViewContentHeader
title={headerTitle}
title={ORG_SOURCES_HEADER_TITLE}
action={
<Link to={getSourcesPath(ADD_SOURCE_PATH, true)}>
<EuiButton fill color="primary" data-test-subj="AddSourceButton">
{linkTitle}
{ORG_SOURCES_LINK}
</EuiButton>
</Link>
}
description={headerDescription}
description={ORG_SOURCES_HEADER_DESCRIPTION}
alignItems="flexStart"
/>

<ContentSection title={sectionTitle} description={sectionDescription}>
<ContentSection>
<SourcesTable
showDetails
isOrganization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,31 @@ import React, { useEffect } from 'react';
import { useActions, useValues } from 'kea';

import { EuiCallOut, EuiEmptyPrompt, EuiSpacer, EuiPanel } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { LicensingLogic } from '../../../../applications/shared/licensing';

import { ADD_SOURCE_PATH, getSourcesPath } from '../../routes';

import noSharedSourcesIcon from '../../assets/share_circle.svg';

import {
AND,
PRIVATE_LINK_TITLE,
PRIVATE_CAN_CREATE_PAGE_TITLE,
PRIVATE_VIEW_ONLY_PAGE_TITLE,
PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION,
PRIVATE_CAN_CREATE_PAGE_DESCRIPTION,
PRIVATE_HEADER_TITLE,
PRIVATE_HEADER_DESCRIPTION,
PRIVATE_SHARED_SOURCES_TITLE,
PRIVATE_EMPTY_TITLE,
SHARED_EMPTY_TITLE,
SHARED_EMPTY_DESCRIPTION,
LICENSE_CALLOUT_TITLE,
LICENSE_CALLOUT_DESCRIPTION,
} from './constants';

import { Loading } from '../../../shared/loading';
import { EuiButtonTo } from '../../../shared/react_router_helpers';
import { ContentSection } from '../../components/shared/content_section';
Expand All @@ -37,17 +55,6 @@ interface SidebarLink {
onClick?(): void;
}

const PRIVATE_LINK_TITLE = 'Add a private content source';
const PRIVATE_CAN_CREATE_PAGE_TITLE = 'Manage private content sources';
const PRIVATE_VIEW_ONLY_PAGE_TITLE = 'Review Group Sources';
const PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION =
'Review the status of all sources shared with your Group.';
const PRIVATE_CAN_CREATE_PAGE_DESCRIPTION =
'Review the status of all connected private sources, and manage private sources for your account.';
const PRIVATE_HEADER_TITLE = 'My private content sources';
const PRIVATE_HEADER_DESCRIPTION = 'Private content sources are available only to you.';
const PRIVATE_SHARED_SOURCES_TITLE = 'Shared content sources';

export const PrivateSources: React.FC = () => {
const { hasPlatinumLicense } = useValues(LicensingLogic);
const { initializeSources, setSourceSearchability, resetSourcesState } = useActions(SourcesLogic);
Expand Down Expand Up @@ -112,7 +119,7 @@ export const PrivateSources: React.FC = () => {
<ContentSection className="zero-state__private-sources">
<EuiPanel className="euiPanel--inset">
<EuiSpacer size="xxl" />
<EuiEmptyPrompt iconType="lock" title={<h2>You have no private sources</h2>} />
<EuiEmptyPrompt iconType="lock" title={<h2>{PRIVATE_EMPTY_TITLE}</h2>} />
<EuiSpacer size="xxl" />
</EuiPanel>
</ContentSection>
Expand All @@ -124,13 +131,8 @@ export const PrivateSources: React.FC = () => {
<EuiSpacer size="xxl" />
<EuiEmptyPrompt
iconType={noSharedSourcesIcon}
title={<h2>No content source available</h2>}
body={
<p>
Once content sources are shared with you, they will be displayed here, and available
via the search experience.
</p>
}
title={<h2>{SHARED_EMPTY_TITLE}</h2>}
body={<p>{SHARED_EMPTY_DESCRIPTION}</p>}
/>
<EuiSpacer size="xxl" />
</EuiPanel>
Expand All @@ -140,25 +142,30 @@ export const PrivateSources: React.FC = () => {
const hasPrivateSources = privateContentSources?.length > 0;
const privateSources = hasPrivateSources ? privateSourcesTable : privateSourcesEmptyState;

const groupsSentence = `${groups.slice(0, groups.length - 1).join(', ')}, and ${groups.slice(
const groupsSentence = `${groups.slice(0, groups.length - 1).join(', ')}, ${AND} ${groups.slice(
-1
)}`;

const sharedSources = (
<ContentSection
title={PRIVATE_SHARED_SOURCES_TITLE}
description={`You have access to the following sources through the group${
groups.length === 1 ? '' : 's'
} ${groupsSentence}.`}
description={i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.private.privateShared.header.description',
{
defaultMessage:
'You have access to the following sources through the {groups, plural, one {group} other {groups}} {groupsSentence}.',
values: { groups: groups.length, groupsSentence },
}
)}
>
<SourcesTable showDetails={false} isOrganization={false} sources={contentSources} />
</ContentSection>
);

const licenseCallout = (
<>
<EuiCallOut title="Private Sources are no longer available" iconType="iInCircle">
<p>Contact your search experience administrator for more information.</p>
<EuiCallOut title={LICENSE_CALLOUT_TITLE} iconType="iInCircle">
<p>{LICENSE_CALLOUT_DESCRIPTION}</p>
</EuiCallOut>
<EuiSpacer />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/t

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

import {
SOURCE_DISABLED_CALLOUT_TITLE,
SOURCE_DISABLED_CALLOUT_DESCRIPTION,
SOURCE_DISABLED_CALLOUT_BUTTON,
} from './constants';

import {
ENT_SEARCH_LICENSE_MANAGEMENT,
REINDEX_JOB_PATH,
Expand Down Expand Up @@ -80,14 +86,10 @@ export const SourceRouter: React.FC = () => {

const callout = (
<>
<EuiCallOut title="Content source is disabled" color="warning" iconType="alert">
<p>
Your organization’s license level has changed. Your data is safe, but document-level
permissions are no longer supported and searching of this source has been disabled.
Upgrade to a Platinum license to re-enable this source.
</p>
<EuiCallOut title={SOURCE_DISABLED_CALLOUT_TITLE} color="warning" iconType="alert">
<p>{SOURCE_DISABLED_CALLOUT_DESCRIPTION}</p>
<EuiButton color="warning" href={ENT_SEARCH_LICENSE_MANAGEMENT}>
Explore Platinum license
{SOURCE_DISABLED_CALLOUT_BUTTON}
</EuiButton>
</EuiCallOut>
<EuiSpacer />
Expand Down
Loading