Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enterprise Search] Fix support for cron scheduling for Elastic Crawler Indices #146357

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {

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

import { CrawlerIndex } from '../../../../../../../common/types/indices';
import {
HOURS_UNIT_LABEL,
DAYS_UNIT_LABEL,
Expand All @@ -36,23 +35,21 @@ import {
} from '../../../../../shared/constants';
import { EnterpriseSearchCronEditor } from '../../../../../shared/cron_editor/enterprise_search_cron_editor';
import { docLinks } from '../../../../../shared/doc_links/doc_links';
import { UpdateConnectorSchedulingApiLogic } from '../../../../api/connector/update_connector_scheduling_api_logic';
import { CrawlUnits } from '../../../../api/crawler/types';
import { isCrawlerIndex } from '../../../../utils/indices';
import { IndexViewLogic } from '../../index_view_logic';

import { AutomaticCrawlSchedulerLogic } from './automatic_crawl_scheduler_logic';

export const AutomaticCrawlScheduler: React.FC = () => {
const { index } = useValues(IndexViewLogic);
const { makeRequest } = useActions(UpdateConnectorSchedulingApiLogic);
const {
setCrawlAutomatically,
setCrawlFrequency,
setCrawlUnit,
setUseConnectorSchedule,
submitConnectorSchedule,
} = useActions(AutomaticCrawlSchedulerLogic);

const scheduling = (index as CrawlerIndex)?.connector?.scheduling;

const { setCrawlFrequency, setCrawlUnit, setUseConnectorSchedule, toggleCrawlAutomatically } =
useActions(AutomaticCrawlSchedulerLogic);

const { crawlAutomatically, crawlFrequency, crawlUnit, useConnectorSchedule } = useValues(
const { index, crawlAutomatically, crawlFrequency, crawlUnit, useConnectorSchedule } = useValues(
AutomaticCrawlSchedulerLogic
);

Expand Down Expand Up @@ -84,7 +81,7 @@ export const AutomaticCrawlScheduler: React.FC = () => {
defaultMessage: 'Enable recurring crawls with the following schedule',
}
)}
onChange={toggleCrawlAutomatically}
onChange={(e) => setCrawlAutomatically(e.target.checked)}
compressed
/>
</EuiFormRow>
Expand Down Expand Up @@ -124,11 +121,11 @@ export const AutomaticCrawlScheduler: React.FC = () => {
>
<EnterpriseSearchCronEditor
disabled={!crawlAutomatically || !useConnectorSchedule}
scheduling={scheduling}
scheduling={index.connector.scheduling}
onChange={(newScheduling) =>
makeRequest({
connectorId: index.connector.id,
scheduling: { ...newScheduling },
submitConnectorSchedule({
...newScheduling,
enabled: true,
})
}
/>
Expand Down

This file was deleted.

Loading