Skip to content

Commit

Permalink
[8.8] [Enterprise Search] Fix minor text issues in create index (#155892
Browse files Browse the repository at this point in the history
) (#156264)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Enterprise Search] Fix minor text issues in create index
(#155892)](#155892)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sander
Philipse","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-04-26T19:09:08Z","message":"[Enterprise
Search] Fix minor text issues in create index (#155892)\n\n##
Summary\r\n\r\nThis fixes some minor issues and adds a few enhancements
in the create\r\nsearch index
flow.","sha":"a5b51f82c66e33f2c39e5a04ae3e592aad67fff8","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport","release_note:skip","auto-backport","Team:EnterpriseSearch","v8.8.0","v8.9.0"],"number":155892,"url":"https://github.com/elastic/kibana/pull/155892","mergeCommit":{"message":"[Enterprise
Search] Fix minor text issues in create index (#155892)\n\n##
Summary\r\n\r\nThis fixes some minor issues and adds a few enhancements
in the create\r\nsearch index
flow.","sha":"a5b51f82c66e33f2c39e5a04ae3e592aad67fff8"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155892","number":155892,"mergeCommit":{"message":"[Enterprise
Search] Fix minor text issues in create index (#155892)\n\n##
Summary\r\n\r\nThis fixes some minor issues and adds a few enhancements
in the create\r\nsearch index
flow.","sha":"a5b51f82c66e33f2c39e5a04ae3e592aad67fff8"}},{"branch":"8.9","label":"v8.9.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
sphilipse and kibanamachine authored May 1, 2023
1 parent ab48fa7 commit 8af3ab8
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const MethodConnector: React.FC<MethodConnectorProps> = ({ serviceType })

const isNative =
Boolean(NATIVE_CONNECTORS.find((connector) => connector.serviceType === serviceType)) &&
isCloud;
(isCloud || hasPlatinumLicense);

const isGated = isNative && !isCloud && !hasPlatinumLicense;
const hasLowMemory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,18 @@

import React, { useState } from 'react';

import { useLocation } from 'react-router-dom';

import { useValues } from 'kea';

import { EuiButton, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { INGESTION_METHOD_IDS } from '../../../../../common/constants';

import { ProductFeatures } from '../../../../../common/types';

import { CONTINUE_BUTTON_LABEL } from '../../../shared/constants';

import { generateEncodedPath } from '../../../shared/encode_path_params';
import { KibanaLogic } from '../../../shared/kibana/kibana_logic';

import { parseQueryParams } from '../../../shared/query_params';
import { EuiLinkTo } from '../../../shared/react_router_helpers';
import { NEW_INDEX_METHOD_PATH, NEW_INDEX_SELECT_CONNECTOR_PATH } from '../../routes';
import { EnterpriseSearchContentPageTemplate } from '../layout/page_template';
Expand All @@ -34,20 +29,16 @@ import { NewIndexCard } from './new_index_card';
const getAvailableMethodOptions = (productFeatures: ProductFeatures): INGESTION_METHOD_IDS[] => {
return [
...(productFeatures.hasWebCrawler ? [INGESTION_METHOD_IDS.CRAWLER] : []),
INGESTION_METHOD_IDS.API,
...(productFeatures.hasConnectors ? [INGESTION_METHOD_IDS.CONNECTOR] : []),
INGESTION_METHOD_IDS.API,
];
};

export const NewIndex: React.FC = () => {
const { search } = useLocation();
const { method } = parseQueryParams(search);
const { capabilities, productFeatures } = useValues(KibanaLogic);
const availableIngestionMethodOptions = getAvailableMethodOptions(productFeatures);

const [selectedMethod, setSelectedMethod] = useState<string>(
Array.isArray(method) ? method[0] : method ?? INGESTION_METHOD_IDS.CRAWLER
);
const [selectedMethod, setSelectedMethod] = useState<string>('');
return (
<EnterpriseSearchContentPageTemplate
pageChrome={[
Expand Down Expand Up @@ -78,53 +69,29 @@ export const NewIndex: React.FC = () => {
type={type}
onSelect={() => {
setSelectedMethod(type);
if (type === INGESTION_METHOD_IDS.CONNECTOR) {
KibanaLogic.values.navigateToUrl(NEW_INDEX_SELECT_CONNECTOR_PATH);
} else {
KibanaLogic.values.navigateToUrl(
generateEncodedPath(NEW_INDEX_METHOD_PATH, { type })
);
}
}}
isSelected={selectedMethod === type}
/>
</EuiFlexItem>
))}
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem>
{capabilities.navLinks.integrations && (
<>
<EuiLinkTo to="/app/integrations" shouldNotCreateHref>
{i18n.translate(
'xpack.enterpriseSearch.content.newIndex.viewIntegrationsLink',
{
defaultMessage: 'View additional integrations',
}
)}
</EuiLinkTo>
</>
)}
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
color="primary"
disabled={
!Object.values(INGESTION_METHOD_IDS as Record<string, string>).includes(
selectedMethod
)
}
fill
onClick={() => {
if (selectedMethod === INGESTION_METHOD_IDS.CONNECTOR) {
KibanaLogic.values.navigateToUrl(NEW_INDEX_SELECT_CONNECTOR_PATH);
} else {
KibanaLogic.values.navigateToUrl(
generateEncodedPath(NEW_INDEX_METHOD_PATH, { type: selectedMethod })
);
}
}}
>
{CONTINUE_BUTTON_LABEL}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{capabilities.navLinks.integrations && (
<EuiFlexItem>
<EuiLinkTo to="/app/integrations" shouldNotCreateHref>
{i18n.translate('xpack.enterpriseSearch.content.newIndex.viewIntegrationsLink', {
defaultMessage: 'View additional integrations',
})}
</EuiLinkTo>
</EuiFlexItem>
)}
</>
</EuiFlexGroup>
</EnterpriseSearchContentPageTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ export interface MethodCardOptions {
title: EuiCardProps['title'];
}

const NO_DEVELOPMENT_LABEL = i18n.translate(
'xpack.enterpriseSearch.content.newIndex.methodCard.noDevelopment.label',
{
defaultMessage: 'No development required',
}
);

const METHOD_CARD_OPTIONS: Record<INGESTION_METHOD_IDS, MethodCardOptions> = {
[INGESTION_METHOD_IDS.CRAWLER]: {
description: i18n.translate(
Expand All @@ -51,7 +44,6 @@ const METHOD_CARD_OPTIONS: Record<INGESTION_METHOD_IDS, MethodCardOptions> = {
defaultMessage: 'Use a web crawler',
}
),
label: NO_DEVELOPMENT_LABEL,
},
icon: getIngestionMethodIconType(INGESTION_METHOD_IDS.CRAWLER),
title: i18n.translate('xpack.enterpriseSearch.content.newIndex.methodCard.crawler.title', {
Expand All @@ -73,7 +65,6 @@ const METHOD_CARD_OPTIONS: Record<INGESTION_METHOD_IDS, MethodCardOptions> = {
defaultMessage: 'Use a connector',
}
),
label: NO_DEVELOPMENT_LABEL,
},
icon: getIngestionMethodIconType(INGESTION_METHOD_IDS.CONNECTOR),
title: i18n.translate('xpack.enterpriseSearch.content.newIndex.methodCard.connector.title', {
Expand All @@ -91,9 +82,6 @@ const METHOD_CARD_OPTIONS: Record<INGESTION_METHOD_IDS, MethodCardOptions> = {
buttonLabel: i18n.translate('xpack.enterpriseSearch.content.newIndex.methodCard.api.label', {
defaultMessage: 'Use the API',
}),
label: i18n.translate('xpack.enterpriseSearch.content.newIndex.methodCard.api.footer', {
defaultMessage: 'Some development required',
}),
},
icon: getIngestionMethodIconType(INGESTION_METHOD_IDS.API),
title: i18n.translate('xpack.enterpriseSearch.content.newIndex.methodCard.api.title', {
Expand All @@ -115,8 +103,12 @@ export const NewIndexCard: React.FC<NewIndexCardProps> = ({ onSelect, isSelected
description={<EuiTextColor color="subdued">{description}</EuiTextColor>}
footer={
<>
<EuiBadge color="hollow">{footer.label}</EuiBadge>
<EuiSpacer size="m" />
{footer.label && (
<>
<EuiBadge color="hollow">{footer.label}</EuiBadge>
<EuiSpacer size="m" />
</>
)}
<EuiButton
fullWidth
onClick={onSelect}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,27 @@ export const ConnectorCheckable: React.FC<ConnectorCheckableProps> = ({
name={name}
value={serviceType}
>
{documentationUrl && (
<EuiLink target="_blank" href={documentationUrl}>
{i18n.translate(
'xpack.enterpriseSearch.content.indices.selectConnector.connectorCheckable.documentationLinkLabel',
{
defaultMessage: 'Documentation',
}
)}
</EuiLink>
)}
{isBeta && (
<EuiBadge color="hollow" iconType="beaker">
<EuiText size="xs">{BETA_LABEL}</EuiText>
</EuiBadge>
)}
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween" gutterSize="s">
{documentationUrl && (
<EuiFlexItem grow={false}>
<EuiLink target="_blank" href={documentationUrl}>
{i18n.translate(
'xpack.enterpriseSearch.content.indices.selectConnector.connectorCheckable.documentationLinkLabel',
{
defaultMessage: 'Documentation',
}
)}
</EuiLink>
</EuiFlexItem>
)}
{isBeta && (
<EuiFlexItem grow={false}>
<EuiBadge color="hollow" iconType="beaker">
<EuiText size="xs">{BETA_LABEL}</EuiText>
</EuiBadge>
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiCheckableCard>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const SelectConnector: React.FC = () => {
description: i18n.translate(
'xpack.enterpriseSearch.content.indices.selectConnector.description',
{
defaultMessage: 'A search connector syncs data from a third party source.',
defaultMessage: 'A connector will sync data from a data source.',
}
),
pageTitle: i18n.translate('xpack.enterpriseSearch.content.indices.selectConnector.title', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,16 @@ class DocLinks {
this.clientsRustOverview = docLinks.links.clients.rustOverview;
this.cloudIndexManagement = docLinks.links.cloud.indexManagement;
this.connectors = docLinks.links.enterpriseSearch.connectors;
this.connectorsAzureBlobStorage = docLinks.links.enterpriseSearch.connectorsAzureBlobStorage;
this.connectorsGoogleCloudStorage =
docLinks.links.enterpriseSearch.connectorsGoogleCloudStorage;
this.connectorsMicrosoftSQL = docLinks.links.enterpriseSearch.connectorsMicrosoftSQL;
this.connectorsMongoDB = docLinks.links.enterpriseSearch.connectorsMongoDB;
this.connectorsMySQL = docLinks.links.enterpriseSearch.connectorsMySQL;
this.connectorsNetworkDrive = docLinks.links.enterpriseSearch.connectorsNetworkDrive;
this.connectorsOracle = docLinks.links.enterpriseSearch.connectorsOracle;
this.connectorsPostgreSQL = docLinks.links.enterpriseSearch.connectorsPostgreSQL;
this.connectorsS3 = docLinks.links.enterpriseSearch.connectorsS3;
this.connectorsWorkplaceSearch = docLinks.links.enterpriseSearch.connectorsWorkplaceSearch;
this.crawlerExtractionRules = docLinks.links.enterpriseSearch.crawlerExtractionRules;
this.crawlerManaging = docLinks.links.enterpriseSearch.crawlerManaging;
Expand Down

0 comments on commit 8af3ab8

Please sign in to comment.