Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into remove/legacy…
Browse files Browse the repository at this point in the history
…-optimizer
  • Loading branch information
spalger committed Aug 5, 2020
2 parents 9fe72ab + 47b9aba commit f7be502
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 44 deletions.
34 changes: 34 additions & 0 deletions x-pack/plugins/enterprise_search/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { i18n } from '@kbn/i18n';

export const ENTERPRISE_SEARCH_PLUGIN = {
ID: 'enterpriseSearch',
NAME: i18n.translate('xpack.enterpriseSearch.productName', {
defaultMessage: 'Enterprise Search',
}),
URL: '/app/enterprise_search',
};

export const APP_SEARCH_PLUGIN = {
ID: 'appSearch',
NAME: i18n.translate('xpack.enterpriseSearch.appSearch.productName', {
defaultMessage: 'App Search',
}),
DESCRIPTION: i18n.translate('xpack.enterpriseSearch.appSearch.productDescription', {
defaultMessage:
'Leverage dashboards, analytics, and APIs for advanced application search made simple.',
}),
URL: '/app/enterprise_search/app_search',
};

export const WORKPLACE_SEARCH_PLUGIN = {
ID: 'workplaceSearch',
NAME: i18n.translate('xpack.enterpriseSearch.workplaceSearch.productName', {
defaultMessage: 'Workplace Search',
}),
DESCRIPTION: i18n.translate('xpack.enterpriseSearch.workplaceSearch.productDescription', {
defaultMessage:
'Search all documents, files, and sources available across your virtual workplace.',
}),
URL: '/app/enterprise_search/workplace_search',
};

export const JSON_HEADER = { 'Content-Type': 'application/json' }; // This needs specific casing or Chrome throws a 415 error

export const ENGINES_PAGE_SIZE = 10;
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ import { EuiSpacer, EuiTitle, EuiText } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

import { APP_SEARCH_PLUGIN } from '../../../../../common/constants';
import { SetupGuide as SetupGuideLayout } from '../../../shared/setup_guide';
import { SetAppSearchBreadcrumbs as SetBreadcrumbs } from '../../../shared/kibana_breadcrumbs';
import { SendAppSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';
import GettingStarted from '../../assets/getting_started.png';

export const SetupGuide: React.FC = () => (
<SetupGuideLayout
productName={i18n.translate('xpack.enterpriseSearch.appSearch.productName', {
defaultMessage: 'App Search',
})}
productName={APP_SEARCH_PLUGIN.NAME}
productEuiIcon="logoAppSearch"
standardAuthLink="https://swiftype.com/documentation/app-search/self-managed/security#standard"
elasticsearchNativeAuthLink="https://swiftype.com/documentation/app-search/self-managed/security#elasticsearch-native-realm"
>
<SetBreadcrumbs text="Setup Guide" />
<SetBreadcrumbs
text={i18n.translate('xpack.enterpriseSearch.setupGuide.title', {
defaultMessage: 'Setup Guide',
})}
/>
<SendTelemetry action="viewed" metric="setup_guide" />

<a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
import { EuiBreadcrumb } from '@elastic/eui';
import { History } from 'history';

import {
ENTERPRISE_SEARCH_PLUGIN,
APP_SEARCH_PLUGIN,
WORKPLACE_SEARCH_PLUGIN,
} from '../../../../common/constants';

import { letBrowserHandleEvent } from '../react_router_helpers';

/**
Expand Down Expand Up @@ -44,14 +50,20 @@ export type TBreadcrumbs = IGenerateBreadcrumbProps[];
export const enterpriseSearchBreadcrumbs = (history: History) => (
breadcrumbs: TBreadcrumbs = []
) => [
generateBreadcrumb({ text: 'Enterprise Search' }),
generateBreadcrumb({ text: ENTERPRISE_SEARCH_PLUGIN.NAME }),
...breadcrumbs.map(({ text, path }: IGenerateBreadcrumbProps) =>
generateBreadcrumb({ text, path, history })
),
];

export const appSearchBreadcrumbs = (history: History) => (breadcrumbs: TBreadcrumbs = []) =>
enterpriseSearchBreadcrumbs(history)([{ text: 'App Search', path: '/' }, ...breadcrumbs]);
enterpriseSearchBreadcrumbs(history)([
{ text: APP_SEARCH_PLUGIN.NAME, path: '/' },
...breadcrumbs,
]);

export const workplaceSearchBreadcrumbs = (history: History) => (breadcrumbs: TBreadcrumbs = []) =>
enterpriseSearchBreadcrumbs(history)([{ text: 'Workplace Search', path: '/' }, ...breadcrumbs]);
enterpriseSearchBreadcrumbs(history)([
{ text: WORKPLACE_SEARCH_PLUGIN.NAME, path: '/' },
...breadcrumbs,
]);
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import React from 'react';
import { EuiPage, EuiPageBody, EuiPageContent } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { WORKPLACE_SEARCH_PLUGIN } from '../../../../../common/constants';
import { ErrorStatePrompt } from '../../../shared/error_state';
import { SetWorkplaceSearchBreadcrumbs as SetBreadcrumbs } from '../../../shared/kibana_breadcrumbs';
import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';
Expand All @@ -20,11 +20,7 @@ export const ErrorState: React.FC = () => {
<SendTelemetry action="error" metric="cannot_connect" />

<EuiPageBody>
<ViewContentHeader
title={i18n.translate('xpack.enterpriseSearch.workplaceSearch.productName', {
defaultMessage: 'Workplace Search',
})}
/>
<ViewContentHeader title={WORKPLACE_SEARCH_PLUGIN.NAME} />
<EuiPageContent>
<ErrorStatePrompt />
</EuiPageContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { EuiSpacer, EuiTitle, EuiText, EuiButton } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { i18n } from '@kbn/i18n';

import { WORKPLACE_SEARCH_PLUGIN } from '../../../../../common/constants';
import { SetupGuide as SetupGuideLayout } from '../../../shared/setup_guide';

import { SetWorkplaceSearchBreadcrumbs as SetBreadcrumbs } from '../../../shared/kibana_breadcrumbs';
import { SendWorkplaceSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';
import GettingStarted from '../../assets/getting_started.png';
Expand All @@ -21,14 +21,16 @@ const GETTING_STARTED_LINK_URL =
export const SetupGuide: React.FC = () => {
return (
<SetupGuideLayout
productName={i18n.translate('xpack.enterpriseSearch.workplaceSearch.productName', {
defaultMessage: 'Workplace Search',
})}
productName={WORKPLACE_SEARCH_PLUGIN.NAME}
productEuiIcon="logoWorkplaceSearch"
standardAuthLink="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-security.html#standard"
elasticsearchNativeAuthLink="https://www.elastic.co/guide/en/workplace-search/current/workplace-search-security.html#elasticsearch-native-realm"
>
<SetBreadcrumbs text="Setup Guide" />
<SetBreadcrumbs
text={i18n.translate('xpack.enterpriseSearch.setupGuide.title', {
defaultMessage: 'Setup Guide',
})}
/>
<SendTelemetry action="viewed" metric="setup_guide" />

<a href={GETTING_STARTED_LINK_URL} target="_blank" rel="noopener noreferrer">
Expand Down
31 changes: 15 additions & 16 deletions x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { LicensingPluginSetup } from '../../licensing/public';

import { APP_SEARCH_PLUGIN, WORKPLACE_SEARCH_PLUGIN } from '../common/constants';
import { getPublicUrl } from './applications/shared/enterprise_search_url';
import AppSearchLogo from './applications/app_search/assets/logo.svg';
import WorkplaceSearchLogo from './applications/workplace_search/assets/logo.svg';
Expand All @@ -44,9 +45,9 @@ export class EnterpriseSearchPlugin implements Plugin {
const config = { host: this.config.host };

core.application.register({
id: 'appSearch',
title: 'App Search',
appRoute: '/app/enterprise_search/app_search',
id: APP_SEARCH_PLUGIN.ID,
title: APP_SEARCH_PLUGIN.NAME,
appRoute: APP_SEARCH_PLUGIN.URL,
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
mount: async (params: AppMountParameters) => {
const [coreStart] = await core.getStartServices();
Expand All @@ -61,9 +62,9 @@ export class EnterpriseSearchPlugin implements Plugin {
});

core.application.register({
id: 'workplaceSearch',
title: 'Workplace Search',
appRoute: '/app/enterprise_search/workplace_search',
id: WORKPLACE_SEARCH_PLUGIN.ID,
title: WORKPLACE_SEARCH_PLUGIN.NAME,
appRoute: WORKPLACE_SEARCH_PLUGIN.URL,
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
mount: async (params: AppMountParameters) => {
const [coreStart] = await core.getStartServices();
Expand All @@ -76,23 +77,21 @@ export class EnterpriseSearchPlugin implements Plugin {
});

plugins.home.featureCatalogue.register({
id: 'appSearch',
title: 'App Search',
id: APP_SEARCH_PLUGIN.ID,
title: APP_SEARCH_PLUGIN.NAME,
icon: AppSearchLogo,
description:
'Leverage dashboards, analytics, and APIs for advanced application search made simple.',
path: '/app/enterprise_search/app_search',
description: APP_SEARCH_PLUGIN.DESCRIPTION,
path: APP_SEARCH_PLUGIN.URL,
category: FeatureCatalogueCategory.DATA,
showOnHomePage: true,
});

plugins.home.featureCatalogue.register({
id: 'workplaceSearch',
title: 'Workplace Search',
id: WORKPLACE_SEARCH_PLUGIN.ID,
title: WORKPLACE_SEARCH_PLUGIN.NAME,
icon: WorkplaceSearchLogo,
description:
'Search all documents, files, and sources available across your virtual workplace.',
path: '/app/enterprise_search/workplace_search',
description: WORKPLACE_SEARCH_PLUGIN.DESCRIPTION,
path: WORKPLACE_SEARCH_PLUGIN.URL,
category: FeatureCatalogueCategory.DATA,
showOnHomePage: true,
});
Expand Down
15 changes: 10 additions & 5 deletions x-pack/plugins/enterprise_search/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { SecurityPluginSetup } from '../../security/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';

import {
ENTERPRISE_SEARCH_PLUGIN,
APP_SEARCH_PLUGIN,
WORKPLACE_SEARCH_PLUGIN,
} from '../common/constants';
import { ConfigType } from './';
import { checkAccess } from './lib/check_access';
import { registerPublicUrlRoute } from './routes/enterprise_search/public_url';
Expand Down Expand Up @@ -64,13 +69,13 @@ export class EnterpriseSearchPlugin implements Plugin {
* Register space/feature control
*/
features.registerFeature({
id: 'enterpriseSearch',
name: 'Enterprise Search',
id: ENTERPRISE_SEARCH_PLUGIN.ID,
name: ENTERPRISE_SEARCH_PLUGIN.NAME,
order: 0,
icon: 'logoEnterpriseSearch',
navLinkId: 'appSearch', // TODO - remove this once functional tests no longer rely on navLinkId
app: ['kibana', 'appSearch', 'workplaceSearch'], // TODO: 'enterpriseSearch'
catalogue: ['appSearch', 'workplaceSearch'], // TODO: 'enterpriseSearch'
navLinkId: APP_SEARCH_PLUGIN.ID, // TODO - remove this once functional tests no longer rely on navLinkId
app: ['kibana', APP_SEARCH_PLUGIN.ID, WORKPLACE_SEARCH_PLUGIN.ID],
catalogue: [APP_SEARCH_PLUGIN.ID, WORKPLACE_SEARCH_PLUGIN.ID],
privileges: null,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n';

import {
Direction,
EuiButtonEmpty,
EuiButton,
EuiCallOut,
EuiEmptyPrompt,
EuiFlexGroup,
Expand Down Expand Up @@ -147,25 +147,29 @@ export const DataFrameAnalyticsList: FC<Props> = ({
return (
<>
<EuiEmptyPrompt
iconType="createAdvancedJob"
title={
<h2>
{i18n.translate('xpack.ml.dataFrame.analyticsList.emptyPromptTitle', {
defaultMessage: 'No data frame analytics jobs found',
defaultMessage: 'Create your first data frame analytics job',
})}
</h2>
}
actions={
!isManagementTable
? [
<EuiButtonEmpty
<EuiButton
onClick={() => setIsSourceIndexModalVisible(true)}
isDisabled={disabled}
color="primary"
iconType="plusInCircle"
fill
data-test-subj="mlAnalyticsCreateFirstButton"
>
{i18n.translate('xpack.ml.dataFrame.analyticsList.emptyPromptButtonText', {
defaultMessage: 'Create your first data frame analytics job',
defaultMessage: 'Create job',
})}
</EuiButtonEmpty>,
</EuiButton>,
]
: []
}
Expand Down

0 comments on commit f7be502

Please sign in to comment.