Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLuisGJ committed Jan 7, 2025
1 parent 18fd171 commit 8b5c11d
Show file tree
Hide file tree
Showing 9 changed files with 397 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ import {
EuiContextMenuPanel,
EuiFlexGroup,
EuiFlexItem,
EuiLink,
EuiPopover,
EuiSearchBar,
EuiSpacer,
EuiText,
EuiTitle,
} from '@elastic/eui';

import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

import { HttpLogic } from '../../../shared/http';
import { LEARN_MORE_LINK } from '../../../shared/constants';
import { KibanaLogic } from '../../../shared/kibana';
import { handlePageChange } from '../../../shared/table_pagination';
import {
NEW_CRAWLER_PATH,
NEW_INDEX_SELECT_CONNECTOR_CLIENTS_PATH,
NEW_INDEX_SELECT_CONNECTOR_NATIVE_PATH,
NEW_INDEX_SELECT_CONNECTOR_PATH,
Expand All @@ -41,9 +42,10 @@ import { DefaultSettingsFlyout } from '../settings/default_settings_flyout';
import { ConnectorStats } from './connector_stats';
import { ConnectorsLogic } from './connectors_logic';
import { ConnectorsTable } from './connectors_table';
import { CrawlerEmptyState } from './crawler_empty_state';
import { CreateConnector } from './create_connector';
import { DeleteConnectorModal } from './delete_connector_modal';
import { ElasticManagedWebCrawlerEmptyPrompt } from './elastic_managed_web_crawler_empty_prompt';
import { SelfManagedWebCrawlerEmptyPrompt } from './self_managed_web_crawler_empty_prompt';

export const connectorsBreadcrumbs = [
i18n.translate('xpack.enterpriseSearch.content.connectors.breadcrumb', {
Expand All @@ -59,12 +61,12 @@ export const crawlersBreadcrumbs = [

export interface ConnectorsProps {
isCrawler: boolean;
isCrawlerSelfManaged: boolean;
}
export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler, isCrawlerSelfManaged }) => {
const { fetchConnectors, onPaginate, setIsFirstRequest, openDeleteModal } =
useActions(ConnectorsLogic);
const { data, isLoading, searchParams, isEmpty, connectors } = useValues(ConnectorsLogic);
const { errorConnectingMessage } = useValues(HttpLogic);
const [searchQuery, setSearchValue] = useState('');
const [showMoreOptionsPopover, setShowMoreOptionsPopover] = useState<boolean>(false);
const [showDefaultSettingsFlyout, setShowDefaultSettingsFlyout] = useState<boolean>(false);
Expand Down Expand Up @@ -95,6 +97,29 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
: i18n.translate('xpack.enterpriseSearch.crawlers.title', {
defaultMessage: 'Elastic Web Crawler',
}),
description: [
<EuiText>
<p>
<FormattedMessage
id="xpack.enterpriseSearch.webcrawlers.headerContent"
defaultMessage="Discover extract and index searchable content from websites and knowledge bases {learnMoreLink}"
values={{
learnMoreLink: (
<EuiLink
data-test-subj="entSearchContentConnectorsLearnMoreLink"
external
target="_blank"
href={'https://github.com/elastic/crawler'}
>
{LEARN_MORE_LINK}
</EuiLink>
),
}}
/>
</p>
</EuiText>,
],

rightSideGroupProps: {
gutterSize: 's',
responsive: false,
Expand Down Expand Up @@ -199,52 +224,26 @@ export const Connectors: React.FC<ConnectorsProps> = ({ isCrawler }) => {
]
: []),
]
: [
<EuiButton
data-test-subj="entSearchContent-crawlers-newCrawlerButton"
data-telemetry-id="entSearchContent-crawlers-newCrawlerButton"
disabled={Boolean(errorConnectingMessage)}
key="newCrawler"
color="primary"
iconType="plusInCircle"
fill
onClick={() => {
KibanaLogic.values.navigateToUrl(NEW_CRAWLER_PATH);
}}
>
{i18n.translate('xpack.enterpriseSearch.connectors.newCrawlerButtonLabel', {
defaultMessage: 'New web crawler',
})}
</EuiButton>,
...(productFeatures.hasDefaultIngestPipeline
? [
<EuiButton
color="primary"
data-test-subj="entSearchContent-connectors-defaultSettingsPopover"
data-telemetry-id="entSearchContent-connectors-defaultSettingsPopover"
onClick={() => setShowDefaultSettingsFlyout(true)}
>
{i18n.translate(
'xpack.enterpriseSearch.content.searchIndices.defaultSettings',
{
defaultMessage: 'Default settings',
}
)}
</EuiButton>,
]
: []),
],
: undefined,
}}
>
{productFeatures.hasDefaultIngestPipeline && showDefaultSettingsFlyout && (
<DefaultSettingsFlyout closeFlyout={() => setShowDefaultSettingsFlyout(false)} />
)}
<ConnectorStats isCrawler={isCrawler} />
<EuiSpacer />
{!isCrawler && (
<>
<ConnectorStats isCrawler={isCrawler} />
<EuiSpacer />
</>
)}

<EuiFlexGroup direction="column">
{isEmpty && isCrawler ? (
<CrawlerEmptyState />
isCrawlerSelfManaged ? (
<SelfManagedWebCrawlerEmptyPrompt />
) : (
<ElasticManagedWebCrawlerEmptyPrompt />
)
) : (
<>
<EuiFlexItem>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import React from 'react';

import { Routes, Route } from '@kbn/shared-ux-router';

import { CRAWLERS_PATH, NEW_CRAWLER_PATH } from '../../routes';
import { CRAWLERS_PATH, CRAWLERS_ELASTIC_MANAGED_PATH, NEW_CRAWLER_PATH } from '../../routes';
import { NewSearchIndexPage } from '../new_index/new_search_index_page';

import { Connectors } from './connectors';
Expand All @@ -20,8 +20,11 @@ export const CrawlersRouter: React.FC = () => {
<Route path={NEW_CRAWLER_PATH}>
<NewSearchIndexPage type="crawler" />
</Route>
<Route path={CRAWLERS_PATH}>
<Connectors isCrawler />
<Route exact path={CRAWLERS_PATH}>
<Connectors isCrawler isCrawlerSelfManaged />
</Route>
<Route exact path={CRAWLERS_ELASTIC_MANAGED_PATH}>
<Connectors isCrawler isCrawlerSelfManaged={false} />
</Route>
</Routes>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React from 'react';

import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiPanel, EuiText } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { SearchEmptyPrompt, DecorativeHorizontalStepper } from '@kbn/search-shared-ui';

import { BACK_BUTTON_LABEL, COMING_SOON_LABEL } from '../../../shared/constants';
import { CrawlerIcon } from '../../../shared/icons/crawler';
import { KibanaLogic } from '../../../shared/kibana';
import { CRAWLERS_PATH } from '../../routes';

export const ElasticManagedWebCrawlerEmptyPrompt: React.FC = () => {
return (
<SearchEmptyPrompt
backButton={{
label: BACK_BUTTON_LABEL,
onClickBack: () => KibanaLogic.values.navigateToUrl(CRAWLERS_PATH),
}}
icon={CrawlerIcon}
title={i18n.translate('xpack.enterpriseSearch.elasticManagedWebCrawlerEmpty.title', {
defaultMessage: 'Elastic managed web crawlers',
})}
isComingSoon
comingSoonLabel={COMING_SOON_LABEL}
description={i18n.translate(
'xpack.enterpriseSearch.elasticManagedWebCrawlerEmpty.description',
{
defaultMessage:
"We're actively developing Elastic managed web crawlers, that won't require any self-managed infrastructure. You'll be able to handle all configuration in the UI. This will simplify syncing your data into a serverless Elasticsearch project. This new workflow will have two steps:",
}
)}
body={
<EuiFlexGroup
alignItems="stretch"
justifyContent="center"
direction="column"
gutterSize="s"
>
<EuiFlexItem>
<EuiPanel color="subdued">
<EuiFlexItem grow={false}>
<DecorativeHorizontalStepper stepCount={2} />
</EuiFlexItem>
<EuiFlexGroup>
<EuiFlexItem>
<EuiFlexGroup justifyContent="flexStart" alignItems="center" direction="column">
<EuiFlexItem grow={false}>
<EuiFlexGroup
justifyContent="center"
alignItems="center"
direction="row"
gutterSize="s"
>
<EuiFlexItem grow={false}>
<EuiIcon color="primary" size="l" type="globe" />
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiText>
<p>
{i18n.translate(
'xpack.enterpriseSearch.elasticManagedWebCrawlerEmpty.guideOneDescription',
{
defaultMessage: 'Set one or more domain URLs you want to crawl',
}
)}
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup justifyContent="flexStart" alignItems="center" direction="column">
<EuiFlexItem grow={false}>
<EuiFlexGroup
gutterSize="s"
direction="row"
alignItems="center"
justifyContent="center"
>
<EuiFlexItem>
<EuiIcon color="primary" size="l" type={CrawlerIcon} />
</EuiFlexItem>
<EuiFlexItem>
<EuiIcon color="primary" size="l" type="logoElastic" />
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
<p>
{i18n.translate(
'xpack.enterpriseSearch.elasticManagedWebCrawlerEmpty.guideThreeDescription',
{
defaultMessage: 'Configure all the web crawler process using Kibana',
}
)}
</p>
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPanel>
</EuiFlexItem>
</EuiFlexGroup>
}
/>
);
};
Loading

0 comments on commit 8b5c11d

Please sign in to comment.