Skip to content

Commit

Permalink
[Workplace Search] Add missing backport data (#89945)
Browse files Browse the repository at this point in the history
* Backport security routes

* Backport Security migration

* Better async tests
  • Loading branch information
scottybollinger authored Feb 2, 2021
1 parent c951f4e commit ab5defa
Show file tree
Hide file tree
Showing 18 changed files with 1,306 additions and 137 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface AppValues extends WorkplaceSearchInitialData {
interface AppActions {
initializeAppData(props: InitialAppData): InitialAppData;
setContext(isOrganization: boolean): boolean;
setSourceRestriction(canCreatePersonalSources: boolean): boolean;
}

const emptyOrg = {} as Organization;
Expand All @@ -34,6 +35,7 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
isFederatedAuth,
}),
setContext: (isOrganization) => isOrganization,
setSourceRestriction: (canCreatePersonalSources: boolean) => canCreatePersonalSources,
},
reducers: {
hasInitialized: [
Expand Down Expand Up @@ -64,6 +66,10 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
emptyAccount,
{
initializeAppData: (_, { workplaceSearch }) => workplaceSearch?.account || emptyAccount,
setSourceRestriction: (state, canCreatePersonalSources) => ({
...state,
canCreatePersonalSources,
}),
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export const WorkplaceSearchNav: React.FC<Props> = ({
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${ROLE_MAPPINGS_PATH}`)}>
{NAV.ROLE_MAPPINGS}
</SideNavLink>
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SECURITY_PATH}`)}>
{NAV.SECURITY}
</SideNavLink>
<SideNavLink to={SECURITY_PATH}>{NAV.SECURITY}</SideNavLink>
<SideNavLink subNav={settingsSubNav} to={ORG_SETTINGS_PATH}>
{NAV.SETTINGS}
</SideNavLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,87 @@ export const DOCUMENTATION_LINK_TITLE = i18n.translate(
}
);

export const PRIVATE_SOURCES_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.privateSources.description',
{
defaultMessage:
'Private sources are connected by users in your organization to create a personalized search experience.',
}
);

export const PRIVATE_SOURCES_TOGGLE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.privateSourcesToggle.description',
{
defaultMessage: 'Enable private sources for your organization',
}
);

export const REMOTE_SOURCES_TOGGLE_TEXT = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesToggle.text',
{
defaultMessage: 'Enable remote private sources',
}
);

export const REMOTE_SOURCES_TABLE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesTable.description',
{
defaultMessage:
'Remote sources synchronize and store a limited amount of data on disk, with a low impact on storage resources.',
}
);

export const REMOTE_SOURCES_EMPTY_TABLE_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesEmptyTable.title',
{
defaultMessage: 'No remote private sources configured yet',
}
);

export const STANDARD_SOURCES_TOGGLE_TEXT = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesToggle.text',
{
defaultMessage: 'Enable standard private sources',
}
);

export const STANDARD_SOURCES_TABLE_DESCRIPTION = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesTable.description',
{
defaultMessage:
'Standard sources synchronize and store all searchable data on disk, with a directly correlated impact on storage resources.',
}
);

export const STANDARD_SOURCES_EMPTY_TABLE_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesEmptyTable.title',
{
defaultMessage: 'No standard private sources configured yet',
}
);

export const SECURITY_UNSAVED_CHANGES_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.unsavedChanges.message',
{
defaultMessage:
'Your private sources settings have not been saved. Are you sure you want to leave?',
}
);

export const PRIVATE_SOURCES_UPDATE_CONFIRMATION_TEXT = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.privateSourcesUpdateConfirmation.text',
{
defaultMessage: 'Updates to private source configuration will take effect immediately.',
}
);

export const SOURCE_RESTRICTIONS_SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.security.sourceRestrictionsSuccess.message',
{
defaultMessage: 'Successfully updated source restrictions.',
}
);

export const PUBLIC_KEY_LABEL = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.publicKey.label',
{
Expand Down Expand Up @@ -382,6 +463,20 @@ export const SAVE_CHANGES_BUTTON = i18n.translate(
}
);

export const SAVE_SETTINGS_BUTTON = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.saveSettings.button',
{
defaultMessage: 'Save settings',
}
);

export const KEEP_EDITING_BUTTON = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.keepEditing.button',
{
defaultMessage: 'Keep editing',
}
);

export const NAME_LABEL = i18n.translate('xpack.enterpriseSearch.workplaceSearch.name.label', {
defaultMessage: 'Name',
});
Expand Down Expand Up @@ -493,6 +588,10 @@ export const UPDATE_BUTTON = i18n.translate(
}
);

export const RESET_BUTTON = i18n.translate('xpack.enterpriseSearch.workplaceSearch.reset.button', {
defaultMessage: 'Reset',
});

export const CONFIGURE_BUTTON = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.configure.button',
{
Expand Down Expand Up @@ -522,13 +621,31 @@ export const PRIVATE_PLATINUM_LICENSE_CALLOUT = i18n.translate(
}
);

export const SOURCE = i18n.translate('xpack.enterpriseSearch.workplaceSearch.source.text', {
defaultMessage: 'Source',
});

export const PRIVATE_SOURCE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.privateSource.text',
{
defaultMessage: 'Private Source',
}
);

export const PRIVATE_SOURCES = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.privateSources.text',
{
defaultMessage: 'Private Sources',
}
);

export const CONFIRM_CHANGES_TEXT = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.confirmChanges.text',
{
defaultMessage: 'Confirm changes',
}
);

export const CONNECTORS_HEADER_TITLE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.connectors.header.title',
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import {
SOURCES_PATH,
PERSONAL_SOURCES_PATH,
ORG_SETTINGS_PATH,
SECURITY_PATH,
} from './routes';

import { SetupGuide } from './views/setup_guide';
import { ErrorState } from './views/error_state';
import { NotFound } from '../shared/not_found';
import { Overview } from './views/overview';
import { GroupsRouter } from './views/groups';
import { Security } from './views/security';
import { SourcesRouter } from './views/content_sources';
import { SettingsRouter } from './views/settings';

Expand Down Expand Up @@ -102,6 +104,11 @@ export const WorkplaceSearchConfigured: React.FC<InitialAppData> = (props) => {
<GroupsRouter />
</Layout>
</Route>
<Route path={SECURITY_PATH}>
<Layout navigation={<WorkplaceSearchNav />} restrictWidth readOnlyMode={readOnlyMode}>
<Security />
</Layout>
</Route>
<Route path={ORG_SETTINGS_PATH}>
<Layout
navigation={<WorkplaceSearchNav settingsSubNav={<SettingsSubNav />} />}
Expand Down
Loading

0 comments on commit ab5defa

Please sign in to comment.