Skip to content

Commit

Permalink
[Enterprise Search] Fix crawler domain management bugs (#165820)
Browse files Browse the repository at this point in the history
## Summary

Tackles 2 known crawler domain management issues:
- [Crawler manage domain doesn't clear data when creating multiple
Crawler
Indices](elastic/search-team#5659)
- [Crawler with multiple domain doesn't show newly added domains when
"All domains" button
clicked](elastic/search-team#5660)

Solution:
- When domain is added successfully we perform 2 additional steps:
- Fetch current domain list into domain management logic (this solves 2
issues but uncovers another issue): Crawler manage domain doesn't clear
user input field for domain, so when adding new crawler index this field
will be pre-populated with the last user input
- Therfore, we also clear user input from add domain form on successful
submission of a domain
  
Video:



https://github.com/elastic/kibana/assets/14121688/a2ba8941-cb76-4d97-9587-3392e815a338
  • Loading branch information
jedrazb authored Sep 6, 2023
1 parent 9ea8627 commit 852513a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ jest.mock('../../crawler_logic', () => ({
},
}));

jest.mock('../domain_management_logic', () => ({
DomainManagementLogic: {
actions: {
getDomains: jest.fn(),
},
},
}));

jest.mock('./utils', () => ({
...(jest.requireActual('./utils') as object),
getDomainWithProtocol: jest.fn().mockImplementation((domain) => domain),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { kea, MakeLogicType } from 'kea';

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

import { DEFAULT_META } from '../../../../../../shared/constants';
import { generateEncodedPath } from '../../../../../../shared/encode_path_params';
import { flashSuccessToast } from '../../../../../../shared/flash_messages';
import { getErrorsFromHttpResponse } from '../../../../../../shared/flash_messages/handle_api_errors';
Expand All @@ -28,6 +29,7 @@ import {
import { SEARCH_INDEX_CRAWLER_DOMAIN_DETAIL_PATH } from '../../../../../routes';
import { IndexNameLogic } from '../../../index_name_logic';
import { CrawlerLogic } from '../../crawler_logic';
import { DomainManagementLogic } from '../domain_management_logic';

import {
domainValidationFailureResultChange,
Expand Down Expand Up @@ -252,6 +254,8 @@ export const AddDomainLogic = kea<MakeLogicType<AddDomainLogicValues, AddDomainL
})
);
CrawlerLogic.actions.fetchCrawlerData();
DomainManagementLogic.actions.getDomains(DEFAULT_META);
actions.clearDomainFormInputValue();
},
performDomainValidationStep: async ({ stepName, checks }) => {
const { http } = HttpLogic.values;
Expand Down

0 comments on commit 852513a

Please sign in to comment.