Skip to content

Commit

Permalink
[8.6] [Enterprise Search] Fix support for cron scheduling for Elastic…
Browse files Browse the repository at this point in the history
… Crawler Indices (#146357) (#146463)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Enterprise Search] Fix support for cron scheduling for Elastic
Crawler Indices
(#146357)](#146357)

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

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

<!--BACKPORT [{"author":{"name":"Byron
Hulcher","email":"[email protected]"},"sourceCommit":{"committedDate":"2022-11-28T19:13:08Z","message":"[Enterprise
Search] Fix support for cron scheduling for Elastic Crawler Indices
(#146357)","sha":"5b79dbea96c9e4694cec2e47d87b1bcbea6740b5","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:EnterpriseSearch","backport:prev-minor","v8.6.0","v8.7.0"],"number":146357,"url":"https://github.com/elastic/kibana/pull/146357","mergeCommit":{"message":"[Enterprise
Search] Fix support for cron scheduling for Elastic Crawler Indices
(#146357)","sha":"5b79dbea96c9e4694cec2e47d87b1bcbea6740b5"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146357","number":146357,"mergeCommit":{"message":"[Enterprise
Search] Fix support for cron scheduling for Elastic Crawler Indices
(#146357)","sha":"5b79dbea96c9e4694cec2e47d87b1bcbea6740b5"}}]}]
BACKPORT-->

Co-authored-by: Byron Hulcher <[email protected]>
  • Loading branch information
kibanamachine and byronhulcher authored Nov 28, 2022
1 parent 301bd83 commit c4de26f
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 287 deletions.
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

0 comments on commit c4de26f

Please sign in to comment.