Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import {
import { EuiLinkTo } from '../../../../shared/react_router_helpers';
import { SOURCE_STATUSES as statuses } from '../../../constants';
import { ContentSourceDetails } from '../../../types';
import { ADD_SOURCE_PATH, SOURCE_DETAILS_PATH, getContentSourcePath } from '../../../routes';
import {
ADD_SOURCE_PATH,
SOURCE_DETAILS_PATH,
getContentSourcePath,
getSourcesPath,
} from '../../../routes';

import { SourceIcon } from '../source_icon';

Expand Down Expand Up @@ -77,7 +82,12 @@ export const SourceRow: React.FC<SourceRowProps> = ({
const imageClass = classNames('source-row__icon', { 'source-row__icon--loading': isIndexing });

const fixLink = (
<EuiLinkTo to={`${ADD_SOURCE_PATH}/${_kebabCase(serviceType)}/re-authenticate?sourceId=${id}`}>
<EuiLinkTo
to={getSourcesPath(
`${ADD_SOURCE_PATH}/${_kebabCase(serviceType)}/re-authenticate?sourceId=${id}`,
isOrganization
)}
>
Fix
</EuiLinkTo>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ export const SOURCE_NAMES = {
};

export const SOURCE_OBJ_TYPES = {
FOLDERS: i18n.translate('xpack.enterpriseSearch.workplaceSearch.sources.objTypes.folders', {
defaultMessage: 'Folders',
}),
PAGES: i18n.translate('xpack.enterpriseSearch.workplaceSearch.sources.objTypes.pages', {
defaultMessage: 'Pages',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const getContentSourcePath = (
export const getGroupPath = (groupId: string): string => generatePath(GROUP_PATH, { groupId });
export const getGroupSourcePrioritizationPath = (groupId: string): string =>
`${GROUPS_PATH}/${groupId}/source_prioritization`;
export const getSourcesPath = (path: string, isOrganization: boolean): string =>
export const getSourcesPath = (path: string, isOrganization?: boolean): string =>
isOrganization ? path : `${PERSONAL_PATH}${path}`;
export const getReindexJobRoute = (
sourceId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export interface ContentSourceFullData extends ContentSourceDetails {
groups: Group[];
custom: boolean;
accessToken: string;
key: string;
urlField: string;
titleField: string;
licenseSupportsPermissions: boolean;
Expand Down Expand Up @@ -177,7 +176,6 @@ export enum FeatureIds {

export interface CustomSource {
accessToken: string;
key: string;
name: string;
id: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,10 @@ export const SAVE_CUSTOM_ACCESS_TOKEN_LABEL = i18n.translate(
}
);

export const SAVE_CUSTOM_API_KEY_LABEL = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSource.saveCustom.apiKey.label',
export const SAVE_CUSTOM_ID_LABEL = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSource.saveCustom.id.label',
{
defaultMessage: 'Key',
defaultMessage: 'ID',
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
SAVE_CUSTOM_API_KEYS_TITLE,
SAVE_CUSTOM_API_KEYS_BODY,
SAVE_CUSTOM_ACCESS_TOKEN_LABEL,
SAVE_CUSTOM_API_KEY_LABEL,
SAVE_CUSTOM_ID_LABEL,
SAVE_CUSTOM_VISUAL_WALKTHROUGH_TITLE,
SAVE_CUSTOM_STYLING_RESULTS_TITLE,
SAVE_CUSTOM_DOC_PERMISSIONS_TITLE,
Expand All @@ -59,7 +59,7 @@ interface SaveCustomProps {

export const SaveCustom: React.FC<SaveCustomProps> = ({
documentationUrl,
newCustomSource: { key, id, accessToken, name },
newCustomSource: { id, accessToken, name },
isOrganization,
header,
}) => (
Expand Down Expand Up @@ -109,17 +109,13 @@ export const SaveCustom: React.FC<SaveCustomProps> = ({
<p>{SAVE_CUSTOM_API_KEYS_BODY}</p>
</EuiText>
<EuiSpacer />
<CredentialItem label={SAVE_CUSTOM_ID_LABEL} value={id} testSubj="ContentSourceId" />
<EuiSpacer />
<CredentialItem
label={SAVE_CUSTOM_ACCESS_TOKEN_LABEL}
value={accessToken}
testSubj="AccessToken"
/>
<EuiSpacer />
<CredentialItem
label={SAVE_CUSTOM_API_KEY_LABEL}
value={key}
testSubj="ContentSourceKey"
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* 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 LEAVE_UNASSIGNED_FIELD = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSources.displaySettings.leaveUnassignedField',
{
defaultMessage: 'Leave unassigned',
}
);

export const SUCCESS_MESSAGE = i18n.translate(
'xpack.enterpriseSearch.workplaceSearch.contentSources.displaySettings.successMessage',
{
defaultMessage: 'Display Settings have been successfuly updated.',
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ import {
import { AppLogic } from '../../../../app_logic';
import { SourceLogic } from '../../source_logic';

const SUCCESS_MESSAGE = 'Display Settings have been successfuly updated.';

import { DetailField, SearchResultConfig, OptionValue, Result } from '../../../../types';

import { LEAVE_UNASSIGNED_FIELD, SUCCESS_MESSAGE } from './constants';
export interface DisplaySettingsResponseProps {
sourceName: string;
searchResultConfig: SearchResultConfig;
Expand Down Expand Up @@ -271,7 +269,10 @@ export const DisplaySettingsLogic = kea<
() => [selectors.fieldOptions],
(fieldOptions) => {
const optionalFieldOptions = cloneDeep(fieldOptions);
optionalFieldOptions.unshift({ value: '', text: '' });
optionalFieldOptions.unshift({
value: LEAVE_UNASSIGNED_FIELD,
text: LEAVE_UNASSIGNED_FIELD,
});
return optionalFieldOptions;
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from '@elastic/eui';

import { DisplaySettingsLogic } from './display_settings_logic';
import { LEAVE_UNASSIGNED_FIELD } from './constants';

import { ExampleSearchResultGroup } from './example_search_result_group';
import { ExampleStandoutResult } from './example_standout_result';
Expand Down Expand Up @@ -104,8 +105,10 @@ export const SearchResults: React.FC = () => {
className="field-selector"
hasNoInitialSelection={true}
data-test-subj="SubtitleFieldSelect"
value={subtitleField || ''}
onChange={({ target: { value } }) => setSubtitleField(value === '' ? null : value)}
value={subtitleField || LEAVE_UNASSIGNED_FIELD}
onChange={({ target: { value } }) =>
setSubtitleField(value === LEAVE_UNASSIGNED_FIELD ? null : value)
}
/>
</EuiFormRow>
<EuiFormRow
Expand All @@ -121,9 +124,9 @@ export const SearchResults: React.FC = () => {
className="field-selector"
hasNoInitialSelection={true}
data-test-subj="DescriptionFieldSelect"
value={descriptionField || ''}
value={descriptionField || LEAVE_UNASSIGNED_FIELD}
onChange={({ target: { value } }) =>
setDescriptionField(value === '' ? null : value)
setDescriptionField(value === LEAVE_UNASSIGNED_FIELD ? null : value)
}
/>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import {
DOCUMENT_PERMISSIONS_DOCS_URL,
ENT_SEARCH_LICENSE_MANAGEMENT,
EXTERNAL_IDENTITIES_DOCS_URL,
SOURCE_CONTENT_PATH,
getContentSourcePath,
getGroupPath,
} from '../../../routes';

Expand All @@ -45,7 +43,7 @@ import { CredentialItem } from '../../../components/shared/credential_item';
import { ViewContentHeader } from '../../../components/shared/view_content_header';
import { LicenseBadge } from '../../../components/shared/license_badge';
import { Loading } from '../../../../shared/loading';
import { EuiButtonEmptyTo, EuiPanelTo } from '../../../../shared/react_router_helpers';
import { EuiPanelTo } from '../../../../shared/react_router_helpers';

import aclImage from '../../../assets/supports_acl.svg';
import { SourceLogic } from '../source_logic';
Expand All @@ -63,7 +61,6 @@ export const Overview: React.FC = () => {
details,
custom,
accessToken,
key,
licenseSupportsPermissions,
serviceTypeSupportsPermissions,
indexPermissions,
Expand Down Expand Up @@ -105,24 +102,9 @@ export const Overview: React.FC = () => {
return (
<div className="content-section">
<div className="section-header">
<EuiFlexGroup gutterSize="none" alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem>
<EuiTitle size="xs">
<h4>Content summary</h4>
</EuiTitle>
</EuiFlexItem>
{totalDocuments > 0 && (
<EuiFlexItem grow={false}>
<EuiButtonEmptyTo
to={getContentSourcePath(SOURCE_CONTENT_PATH, id, isOrganization)}
data-test-subj="ManageSourceContentLink"
size="s"
>
Manage
</EuiButtonEmptyTo>
</EuiFlexItem>
)}
</EuiFlexGroup>
<EuiTitle size="xs">
<h4>Content summary</h4>
</EuiTitle>
</div>
<EuiSpacer size="s" />
{!summary && <ComponentLoader text="Loading summary details..." />}
Expand Down Expand Up @@ -388,9 +370,9 @@ export const Overview: React.FC = () => {
</h6>
</EuiText>
<EuiSpacer size="s" />
<CredentialItem label="Access Token" value={accessToken} testSubj="AccessToken" />
<CredentialItem label="ID" value={id} testSubj="ContentSourceId" />
<EuiSpacer size="s" />
<CredentialItem label="Key" value={key} testSubj="ContentSourceKey" />
<CredentialItem label="Access Token" value={accessToken} testSubj="AccessToken" />
</EuiPanel>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,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>}
body={
<p>
Select from the content sources below to create a private source, available only to
you
</p>
}
/>
<EuiEmptyPrompt iconType="lock" title={<h2>You have no private sources</h2>} />
<EuiSpacer size="xxl" />
</EuiPanel>
</ContentSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export const staticSourceData = [
}
),
connectStepDescription: connectStepDescription.files,
objTypes: [SOURCE_OBJ_TYPES.ALL_FILES],
objTypes: [SOURCE_OBJ_TYPES.FOLDERS, SOURCE_OBJ_TYPES.ALL_FILES],
features: {
basicOrgContext: [
FeatureIds.SyncFrequency,
Expand Down Expand Up @@ -156,6 +156,7 @@ export const staticSourceData = [
FeatureIds.SyncedItems,
FeatureIds.GlobalAccessPermissions,
],
basicOrgContextExcludedFeatures: [FeatureIds.DocumentLevelPermissions],
platinumOrgContext: [FeatureIds.SyncFrequency, FeatureIds.SyncedItems],
platinumPrivateContext: [
FeatureIds.Private,
Expand Down Expand Up @@ -435,6 +436,7 @@ export const staticSourceData = [
FeatureIds.SyncedItems,
FeatureIds.GlobalAccessPermissions,
],
basicOrgContextExcludedFeatures: [FeatureIds.DocumentLevelPermissions],
platinumOrgContext: [FeatureIds.SyncFrequency, FeatureIds.SyncedItems],
platinumPrivateContext: [
FeatureIds.Private,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ export const SourceRouter: React.FC = () => {
<>
<EuiCallOut title="Content source is disabled" color="warning" iconType="alert">
<p>
Your organization&apos;s license level changed and no longer supports document-level
permissions.{' '}
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>
<p>Don&apos;t worry: your data is safe. Search has been disabled.</p>
<p>Upgrade to a Platinum license to re-enable this source.</p>
<EuiButton href={ENT_SEARCH_LICENSE_MANAGEMENT}>Explore Platinum license</EuiButton>
<EuiButton color="warning" href={ENT_SEARCH_LICENSE_MANAGEMENT}>
Explore Platinum license
</EuiButton>
</EuiCallOut>
<EuiSpacer />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import { EuiSpacer, EuiTitle, EuiText, EuiButton } from '@elastic/eui';
import { EuiSpacer, EuiTitle, EuiText, EuiButton, EuiLink } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

Expand All @@ -30,7 +30,7 @@ export const SetupGuide: React.FC = () => {
<SetPageChrome trail={[SETUP_GUIDE_TITLE]} />
<SendTelemetry action="viewed" metric="setup_guide" />

<a href={GETTING_STARTED_LINK_URL} target="_blank" rel="noopener noreferrer">
<EuiLink href={GETTING_STARTED_LINK_URL} target="_blank">
<img
className="setupGuide__thumbnail"
src={GettingStarted}
Expand All @@ -41,7 +41,7 @@ export const SetupGuide: React.FC = () => {
width="1280"
height-="720"
/>
</a>
</EuiLink>

<EuiTitle size="s">
<p>
Expand Down