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] Use the correct naming: organizational source, personal dashboard, private source #112426

Merged
merged 11 commits into from
Sep 16, 2021
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const DEFAULT_INITIAL_APP_DATA = {
id: 'some-id-string',
groups: ['Default', 'Cats'],
isAdmin: true,
canCreatePersonalSources: true,
canCreatePrivateSources: true,
viewedOnboardingPage: true,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface Account {
id: string;
groups: string[];
isAdmin: boolean;
canCreatePersonalSources: boolean;
canCreatePrivateSources: boolean;
viewedOnboardingPage: boolean;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('AppLogic', () => {

const expectedLogicValues = {
account: {
canCreatePersonalSources: true,
canCreatePrivateSources: true,
groups: ['Default', 'Cats'],
id: 'some-id-string',
isAdmin: true,
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('AppLogic', () => {
mount(DEFAULT_INITIAL_APP_DATA);
AppLogic.actions.setSourceRestriction(true);

expect(AppLogic.values.account.canCreatePersonalSources).toEqual(true);
expect(AppLogic.values.account.canCreatePrivateSources).toEqual(true);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface AppActions {
initializeAppData(props: InitialAppData): InitialAppData;
setContext(isOrganization: boolean): boolean;
setOrgName(name: string): string;
setSourceRestriction(canCreatePersonalSources: boolean): boolean;
setSourceRestriction(canCreatePrivateSources: boolean): boolean;
}

const emptyOrg = {} as Organization;
Expand All @@ -40,7 +40,7 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
}),
setContext: (isOrganization) => isOrganization,
setOrgName: (name: string) => name,
setSourceRestriction: (canCreatePersonalSources: boolean) => canCreatePersonalSources,
setSourceRestriction: (canCreatePrivateSources: boolean) => canCreatePrivateSources,
},
reducers: {
hasInitialized: [
Expand Down Expand Up @@ -69,9 +69,9 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
emptyAccount,
{
initializeAppData: (_, { workplaceSearch }) => workplaceSearch?.account || emptyAccount,
setSourceRestriction: (state, canCreatePersonalSources) => ({
setSourceRestriction: (state, canCreatePrivateSources) => ({
...state,
canCreatePersonalSources,
canCreatePrivateSources,
}),
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getWorkplaceSearchUrl } from '../../../../shared/enterprise_search_url'
import { EuiButtonEmptyTo } from '../../../../shared/react_router_helpers';
import { AppLogic } from '../../../app_logic';
import { WORKPLACE_SEARCH_TITLE, ACCOUNT_NAV } from '../../../constants';
import { PERSONAL_SOURCES_PATH, LOGOUT_ROUTE, PERSONAL_SETTINGS_PATH } from '../../../routes';
import { PRIVATE_SOURCES_PATH, LOGOUT_ROUTE, PERSONAL_SETTINGS_PATH } from '../../../routes';

export const AccountHeader: React.FC = () => {
const [isPopoverOpen, setPopover] = useState(false);
Expand Down Expand Up @@ -74,7 +74,7 @@ export const AccountHeader: React.FC = () => {
</EuiHeaderSectionItem>
<EuiHeaderSectionItem border="none">
<EuiHeaderLinks>
<EuiButtonEmptyTo to={PERSONAL_SOURCES_PATH}>{ACCOUNT_NAV.SOURCES}</EuiButtonEmptyTo>
<EuiButtonEmptyTo to={PRIVATE_SOURCES_PATH}>{ACCOUNT_NAV.SOURCES}</EuiButtonEmptyTo>
</EuiHeaderLinks>
</EuiHeaderSectionItem>
</EuiHeaderSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiHeaderLinks } from '@elas
import { externalUrl, getWorkplaceSearchUrl } from '../../../shared/enterprise_search_url';
import { EuiButtonEmptyTo } from '../../../shared/react_router_helpers';
import { NAV } from '../../constants';
import { PERSONAL_SOURCES_PATH } from '../../routes';
import { PRIVATE_SOURCES_PATH } from '../../routes';

export const WorkplaceSearchHeaderActions: React.FC = () => {
if (!externalUrl.enterpriseSearchUrl) return null;
Expand All @@ -24,7 +24,7 @@ export const WorkplaceSearchHeaderActions: React.FC = () => {
<EuiButtonEmptyTo
data-test-subj="PersonalDashboardButton"
iconType="user"
to={PERSONAL_SOURCES_PATH}
to={PRIVATE_SOURCES_PATH}
size="s"
>
{NAV.PERSONAL_DASHBOARD}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { SetWorkplaceSearchChrome } from '../../../../shared/kibana_chrome';
import { BreadcrumbTrail } from '../../../../shared/kibana_chrome/generate_breadcrumbs';
import { Loading } from '../../../../shared/loading';

import { PERSONAL_SOURCES_PATH, PERSONAL_SETTINGS_PATH } from '../../../routes';
import { PRIVATE_DASHBOARD_READ_ONLY_MODE_WARNING } from '../../../views/content_sources/constants';
import { PRIVATE_SOURCES_PATH, PERSONAL_SETTINGS_PATH } from '../../../routes';
import { PERSONAL_DASHBOARD_READ_ONLY_MODE_WARNING } from '../../../views/content_sources/constants';
import { AccountHeader, AccountSettingsSidebar, PrivateSourcesSidebar } from '../index';

import './personal_dashboard_layout.scss';
Expand All @@ -49,7 +49,7 @@ export const PersonalDashboardLayout: React.FC<LayoutProps> = ({
<AccountHeader />
<EuiPage className="personalDashboardLayout" paddingSize="none">
<EuiPageSideBar role="navigation" className="personalDashboardLayout__sideBar" sticky>
{useRouteMatch(PERSONAL_SOURCES_PATH) && <PrivateSourcesSidebar />}
{useRouteMatch(PRIVATE_SOURCES_PATH) && <PrivateSourcesSidebar />}
{useRouteMatch(PERSONAL_SETTINGS_PATH) && <AccountSettingsSidebar />}
</EuiPageSideBar>
<EuiPageBody component="main" panelled role="main">
Expand All @@ -59,7 +59,7 @@ export const PersonalDashboardLayout: React.FC<LayoutProps> = ({
<EuiCallOut
color="warning"
iconType="lock"
title={PRIVATE_DASHBOARD_READ_ONLY_MODE_WARNING}
title={PERSONAL_DASHBOARD_READ_ONLY_MODE_WARNING}
/>
<EuiSpacer />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { PrivateSourcesSidebar } from './private_sources_sidebar';

describe('PrivateSourcesSidebar', () => {
const mockValues = {
account: { canCreatePersonalSources: true },
account: { canCreatePrivateSources: true },
contentSource: {},
};

Expand All @@ -55,7 +55,7 @@ describe('PrivateSourcesSidebar', () => {
});

it('uses correct title and description when private sources are disabled', () => {
setMockValues({ ...mockValues, account: { canCreatePersonalSources: false } });
setMockValues({ ...mockValues, account: { canCreatePrivateSources: false } });
const wrapper = shallow(<PrivateSourcesSidebar />);

expect(wrapper.find(ViewContentHeader).prop('title')).toEqual(PRIVATE_VIEW_ONLY_PAGE_TITLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import { ViewContentHeader } from '../../shared/view_content_header';

export const PrivateSourcesSidebar = () => {
const {
account: { canCreatePersonalSources },
account: { canCreatePrivateSources },
} = useValues(AppLogic);

const PAGE_TITLE = canCreatePersonalSources
const PAGE_TITLE = canCreatePrivateSources
? PRIVATE_CAN_CREATE_PAGE_TITLE
: PRIVATE_VIEW_ONLY_PAGE_TITLE;
const PAGE_DESCRIPTION = canCreatePersonalSources
const PAGE_DESCRIPTION = canCreatePrivateSources
? PRIVATE_CAN_CREATE_PAGE_DESCRIPTION
: PRIVATE_VIEW_ONLY_PAGE_DESCRIPTION;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
SOURCES_PATH,
SOURCE_ADDED_PATH,
OAUTH_AUTHORIZE_PATH,
PERSONAL_SOURCES_PATH,
PRIVATE_SOURCES_PATH,
ORG_SETTINGS_PATH,
USERS_AND_ROLES_PATH,
SECURITY_PATH,
Expand Down Expand Up @@ -94,8 +94,8 @@ export const WorkplaceSearchConfigured: React.FC<InitialAppData> = (props) => {
</Route>
<Route path={PERSONAL_PATH}>
<Switch>
<Redirect exact from={PERSONAL_PATH} to={PERSONAL_SOURCES_PATH} />
<Route path={PERSONAL_SOURCES_PATH}>
<Redirect exact from={PERSONAL_PATH} to={PRIVATE_SOURCES_PATH} />
<Route path={PRIVATE_SOURCES_PATH}>
<SourcesRouter />
</Route>
<Route path={PERSONAL_SETTINGS_PATH}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getSourcesPath,
GROUPS_PATH,
SOURCES_PATH,
PERSONAL_SOURCES_PATH,
PRIVATE_SOURCES_PATH,
SOURCE_DETAILS_PATH,
} from './routes';

Expand All @@ -40,7 +40,7 @@ describe('getContentSourcePath', () => {
const wrapper = shallow(<TestComponent id="123" />);
const path = wrapper.find(EuiLink).prop('href');

expect(path).toEqual(`${PERSONAL_SOURCES_PATH}/123`);
expect(path).toEqual(`${PRIVATE_SOURCES_PATH}/123`);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const GROUP_PATH = `${GROUPS_PATH}/:groupId`;
export const GROUP_SOURCE_PRIORITIZATION_PATH = `${GROUPS_PATH}/:groupId/source_prioritization`;

export const SOURCES_PATH = '/sources';
export const PERSONAL_SOURCES_PATH = `${PERSONAL_PATH}${SOURCES_PATH}`;
export const PRIVATE_SOURCES_PATH = `${PERSONAL_PATH}${SOURCES_PATH}`;

export const SOURCE_ADDED_PATH = `${SOURCES_PATH}/added`;
export const ADD_SOURCE_PATH = `${SOURCES_PATH}/add`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@elastic/eui';

import { AppLogic } from '../../../../app_logic';
import noSharedSourcesIcon from '../../../../assets/share_circle.svg';
import noOrgSourcesIcon from '../../../../assets/share_circle.svg';
import {
WorkplaceSearchPageTemplate,
PersonalDashboardLayout,
Expand Down Expand Up @@ -143,7 +143,7 @@ export const AddSourceList: React.FC = () => {
<EuiSpacer size="s" />
<EuiSpacer size="xxl" />
<EuiEmptyPrompt
iconType={noSharedSourcesIcon}
iconType={noOrgSourcesIcon}
title={<h2>{ADD_SOURCE_EMPTY_TITLE}</h2>}
body={<p>{ADD_SOURCE_EMPTY_BODY}</p>}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { AppLogic } from '../../../../app_logic';
import {
ADD_GITHUB_PATH,
SOURCES_PATH,
PERSONAL_SOURCES_PATH,
PRIVATE_SOURCES_PATH,
getSourcesPath,
} from '../../../../routes';
import { CustomSource } from '../../../../types';
Expand Down Expand Up @@ -321,7 +321,7 @@ describe('AddSourceLogic', () => {
expect(navigateToUrl).toHaveBeenCalledWith(getSourcesPath(SOURCES_PATH, true));
});

it('redirects to private dashboard when account context', async () => {
it('redirects to personal dashboard when account context', async () => {
const accountQueryString =
'?state=%7B%22action%22:%22create%22,%22context%22:%22account%22,%22service_type%22:%22gmail%22,%22csrf_token%22:%22token%3D%3D%22,%22index_permissions%22:false%7D&code=code';

Expand Down Expand Up @@ -379,7 +379,7 @@ describe('AddSourceLogic', () => {
const githubQueryString = getGithubQueryString('account');
AddSourceLogic.actions.saveSourceParams(githubQueryString, errorParams, false);

expect(navigateToUrl).toHaveBeenCalledWith(PERSONAL_SOURCES_PATH);
expect(navigateToUrl).toHaveBeenCalledWith(PRIVATE_SOURCES_PATH);
expect(setErrorMessage).toHaveBeenCalledWith(
PERSONAL_DASHBOARD_SOURCE_ERROR(GITHUB_ERROR)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { CUSTOM_SERVICE_TYPE, WORKPLACE_SEARCH_URL_PREFIX } from '../../../../co
import {
SOURCES_PATH,
ADD_GITHUB_PATH,
PERSONAL_SOURCES_PATH,
PRIVATE_SOURCES_PATH,
getSourcesPath,
} from '../../../../routes';
import { CustomSource } from '../../../../types';
Expand Down Expand Up @@ -521,7 +521,7 @@ export const AddSourceLogic = kea<MakeLogicType<AddSourceValues, AddSourceAction
app home page and display the error message, and not persist the other query params to the server.
*/
if (params.error_description) {
navigateToUrl(isOrganization ? '/' : PERSONAL_SOURCES_PATH);
navigateToUrl(isOrganization ? '/' : PRIVATE_SOURCES_PATH);
setErrorMessage(
isOrganization
? params.error_description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const ADD_SOURCE_ORG_SOURCE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSource.addSourceList.orgSourceDescription',
{
defaultMessage:
'Shared content sources are available to your entire organization or can be assigned to specific user groups.',
'Organizational content sources are available to your entire organization or can be assigned to specific user groups.',
}
);

Expand All @@ -41,7 +41,7 @@ export const ADD_SOURCE_NO_SOURCES_TITLE = i18n.translate(
export const ADD_SOURCE_ORG_SOURCES_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSource.addSourceList.orgSourcesTitle',
{
defaultMessage: 'Add a shared content source',
defaultMessage: 'Add an organizational content source',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,10 @@ export const PRIVATE_HEADER_DESCRIPTION = i18n.translate(
}
);

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

Expand All @@ -461,15 +461,15 @@ export const PRIVATE_EMPTY_TITLE = i18n.translate(
defaultMessage: 'You have no private sources',
}
);
export const SHARED_EMPTY_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.shared.empty.title',
export const ORG_SOURCES_EMPTY_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.org.empty.title',
{
defaultMessage: 'No content source available',
}
);

export const SHARED_EMPTY_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.shared.empty.description',
export const ORG_SOURCES_EMPTY_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.sources.org.empty.description',
{
defaultMessage:
'Once content sources are shared with you, they will be displayed here, and available via the search experience.',
Expand Down Expand Up @@ -526,8 +526,8 @@ export const UNDERSTAND_BUTTON = i18n.translate(
}
);

export const PRIVATE_DASHBOARD_READ_ONLY_MODE_WARNING = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.privateDashboard.readOnlyMode.warning',
export const PERSONAL_DASHBOARD_READ_ONLY_MODE_WARNING = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.personalDashboard.readOnlyMode.warning',
{
defaultMessage:
'Workplace Search is currently available for search only, due to regular maintenance. Contact your system administrator for more information.',
Expand Down
Loading