mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Show crawler domain creation errors (on overview page) * Tweak whitespace around crawler domain form errors (in flyout) Co-authored-by: Orhan Toy <toyorhan@gmail.com>
This commit is contained in:
parent
27e86fde49
commit
26e8b37973
3 changed files with 41 additions and 1 deletions
|
@ -64,7 +64,14 @@ export const AddDomainFlyout: React.FC = () => {
|
|||
</h2>
|
||||
</EuiTitle>
|
||||
</EuiFlyoutHeader>
|
||||
<EuiFlyoutBody banner={<AddDomainFormErrors />}>
|
||||
<EuiFlyoutBody
|
||||
banner={
|
||||
<>
|
||||
<EuiSpacer size="l" />
|
||||
<AddDomainFormErrors />
|
||||
</>
|
||||
}
|
||||
>
|
||||
<EuiText>
|
||||
{i18n.translate(
|
||||
'xpack.enterpriseSearch.appSearch.crawler.addDomainFlyout.description',
|
||||
|
|
|
@ -12,17 +12,22 @@ import React from 'react';
|
|||
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import { useValues } from 'kea';
|
||||
|
||||
import { getPageHeaderActions } from '../../../test_helpers';
|
||||
|
||||
import { AddDomainFlyout } from './components/add_domain/add_domain_flyout';
|
||||
import { AddDomainForm } from './components/add_domain/add_domain_form';
|
||||
import { AddDomainFormErrors } from './components/add_domain/add_domain_form_errors';
|
||||
import { AddDomainFormSubmitButton } from './components/add_domain/add_domain_form_submit_button';
|
||||
import { AddDomainLogic } from './components/add_domain/add_domain_logic';
|
||||
import { CrawlDetailsFlyout } from './components/crawl_details_flyout';
|
||||
import { CrawlRequestsTable } from './components/crawl_requests_table';
|
||||
import { CrawlerStatusBanner } from './components/crawler_status_banner';
|
||||
import { CrawlerStatusIndicator } from './components/crawler_status_indicator/crawler_status_indicator';
|
||||
import { DomainsTable } from './components/domains_table';
|
||||
import { ManageCrawlsPopover } from './components/manage_crawls_popover/manage_crawls_popover';
|
||||
import { CrawlerLogic } from './crawler_logic';
|
||||
import { CrawlerOverview } from './crawler_overview';
|
||||
import {
|
||||
CrawlerDomainFromServer,
|
||||
|
@ -191,4 +196,23 @@ describe('CrawlerOverview', () => {
|
|||
|
||||
expect(wrapper.find(CrawlDetailsFlyout)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('contains a AddDomainFormErrors when there are errors', () => {
|
||||
const errors = ['Domain name already exists'];
|
||||
|
||||
(useValues as jest.Mock).mockImplementation((logic) => {
|
||||
switch (logic) {
|
||||
case AddDomainLogic:
|
||||
return { errors };
|
||||
case CrawlerLogic:
|
||||
return { ...mockValues, domains: [], events: [] };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
});
|
||||
|
||||
const wrapper = shallow(<CrawlerOverview />);
|
||||
|
||||
expect(wrapper.find(AddDomainFormErrors)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,7 +19,9 @@ import { AppSearchPageTemplate } from '../layout';
|
|||
|
||||
import { AddDomainFlyout } from './components/add_domain/add_domain_flyout';
|
||||
import { AddDomainForm } from './components/add_domain/add_domain_form';
|
||||
import { AddDomainFormErrors } from './components/add_domain/add_domain_form_errors';
|
||||
import { AddDomainFormSubmitButton } from './components/add_domain/add_domain_form_submit_button';
|
||||
import { AddDomainLogic } from './components/add_domain/add_domain_logic';
|
||||
import { CrawlDetailsFlyout } from './components/crawl_details_flyout';
|
||||
import { CrawlRequestsTable } from './components/crawl_requests_table';
|
||||
import { CrawlerStatusBanner } from './components/crawler_status_banner';
|
||||
|
@ -31,6 +33,7 @@ import { CrawlerLogic } from './crawler_logic';
|
|||
|
||||
export const CrawlerOverview: React.FC = () => {
|
||||
const { events, dataLoading, domains } = useValues(CrawlerLogic);
|
||||
const { errors: addDomainErrors } = useValues(AddDomainLogic);
|
||||
|
||||
return (
|
||||
<AppSearchPageTemplate
|
||||
|
@ -87,6 +90,12 @@ export const CrawlerOverview: React.FC = () => {
|
|||
</EuiLink>
|
||||
</p>
|
||||
</EuiText>
|
||||
{addDomainErrors && (
|
||||
<>
|
||||
<EuiSpacer size="l" />
|
||||
<AddDomainFormErrors />
|
||||
</>
|
||||
)}
|
||||
<EuiSpacer size="l" />
|
||||
<AddDomainForm />
|
||||
<EuiSpacer />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue