diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx
index 46eccba6a4f706..9c38bdea220ca5 100644
--- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/connector/connector_scheduling/connector_cron_editor.tsx
@@ -135,7 +135,7 @@ function cronToFrequency(cron: string): Frequency {
if (fields.length < 4) {
return 'YEAR';
}
- if (fields[1] === '*' || fields[1].startsWith('*/')) {
+ if (fields[1] === '*' || fields[1].includes(',')) {
return 'MINUTE';
}
if (fields[2] === '*') {
diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/__snapshots__/cron_editor.test.tsx.snap b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/__snapshots__/cron_editor.test.tsx.snap
index 2e22e3bfe30b02..d490f4f87057d8 100644
--- a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/__snapshots__/cron_editor.test.tsx.snap
+++ b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/__snapshots__/cron_editor.test.tsx.snap
@@ -3391,241 +3391,21 @@ exports[`CronEditor is rendered with a MINUTE frequency 1`] = `
minute="10"
minuteOptions={
Array [
- Object {
- "text": "1",
- "value": "*/1",
- },
- Object {
- "text": "2",
- "value": "*/2",
- },
- Object {
- "text": "3",
- "value": "*/3",
- },
- Object {
- "text": "4",
- "value": "*/4",
- },
Object {
"text": "5",
- "value": "*/5",
- },
- Object {
- "text": "6",
- "value": "*/6",
- },
- Object {
- "text": "7",
- "value": "*/7",
- },
- Object {
- "text": "8",
- "value": "*/8",
- },
- Object {
- "text": "9",
- "value": "*/9",
+ "value": "0,5,10,15,20,25,30,35,40,45,50,55",
},
Object {
"text": "10",
- "value": "*/10",
- },
- Object {
- "text": "11",
- "value": "*/11",
- },
- Object {
- "text": "12",
- "value": "*/12",
- },
- Object {
- "text": "13",
- "value": "*/13",
- },
- Object {
- "text": "14",
- "value": "*/14",
+ "value": "0,10,20,30,40,50",
},
Object {
"text": "15",
- "value": "*/15",
- },
- Object {
- "text": "16",
- "value": "*/16",
- },
- Object {
- "text": "17",
- "value": "*/17",
- },
- Object {
- "text": "18",
- "value": "*/18",
- },
- Object {
- "text": "19",
- "value": "*/19",
- },
- Object {
- "text": "20",
- "value": "*/20",
- },
- Object {
- "text": "21",
- "value": "*/21",
- },
- Object {
- "text": "22",
- "value": "*/22",
- },
- Object {
- "text": "23",
- "value": "*/23",
- },
- Object {
- "text": "24",
- "value": "*/24",
- },
- Object {
- "text": "25",
- "value": "*/25",
- },
- Object {
- "text": "26",
- "value": "*/26",
- },
- Object {
- "text": "27",
- "value": "*/27",
- },
- Object {
- "text": "28",
- "value": "*/28",
- },
- Object {
- "text": "29",
- "value": "*/29",
+ "value": "0,15,30,45",
},
Object {
"text": "30",
- "value": "*/30",
- },
- Object {
- "text": "31",
- "value": "*/31",
- },
- Object {
- "text": "32",
- "value": "*/32",
- },
- Object {
- "text": "33",
- "value": "*/33",
- },
- Object {
- "text": "34",
- "value": "*/34",
- },
- Object {
- "text": "35",
- "value": "*/35",
- },
- Object {
- "text": "36",
- "value": "*/36",
- },
- Object {
- "text": "37",
- "value": "*/37",
- },
- Object {
- "text": "38",
- "value": "*/38",
- },
- Object {
- "text": "39",
- "value": "*/39",
- },
- Object {
- "text": "40",
- "value": "*/40",
- },
- Object {
- "text": "41",
- "value": "*/41",
- },
- Object {
- "text": "42",
- "value": "*/42",
- },
- Object {
- "text": "43",
- "value": "*/43",
- },
- Object {
- "text": "44",
- "value": "*/44",
- },
- Object {
- "text": "45",
- "value": "*/45",
- },
- Object {
- "text": "46",
- "value": "*/46",
- },
- Object {
- "text": "47",
- "value": "*/47",
- },
- Object {
- "text": "48",
- "value": "*/48",
- },
- Object {
- "text": "49",
- "value": "*/49",
- },
- Object {
- "text": "50",
- "value": "*/50",
- },
- Object {
- "text": "51",
- "value": "*/51",
- },
- Object {
- "text": "52",
- "value": "*/52",
- },
- Object {
- "text": "53",
- "value": "*/53",
- },
- Object {
- "text": "54",
- "value": "*/54",
- },
- Object {
- "text": "55",
- "value": "*/55",
- },
- Object {
- "text": "56",
- "value": "*/56",
- },
- Object {
- "text": "57",
- "value": "*/57",
- },
- Object {
- "text": "58",
- "value": "*/58",
- },
- Object {
- "text": "59",
- "value": "*/59",
+ "value": "0,30",
},
]
}
@@ -3690,241 +3470,21 @@ exports[`CronEditor is rendered with a MINUTE frequency 1`] = `
onFocus={[Function]}
options={
Array [
- Object {
- "text": "1",
- "value": "*/1",
- },
- Object {
- "text": "2",
- "value": "*/2",
- },
- Object {
- "text": "3",
- "value": "*/3",
- },
- Object {
- "text": "4",
- "value": "*/4",
- },
Object {
"text": "5",
- "value": "*/5",
- },
- Object {
- "text": "6",
- "value": "*/6",
- },
- Object {
- "text": "7",
- "value": "*/7",
- },
- Object {
- "text": "8",
- "value": "*/8",
- },
- Object {
- "text": "9",
- "value": "*/9",
+ "value": "0,5,10,15,20,25,30,35,40,45,50,55",
},
Object {
"text": "10",
- "value": "*/10",
- },
- Object {
- "text": "11",
- "value": "*/11",
- },
- Object {
- "text": "12",
- "value": "*/12",
- },
- Object {
- "text": "13",
- "value": "*/13",
- },
- Object {
- "text": "14",
- "value": "*/14",
+ "value": "0,10,20,30,40,50",
},
Object {
"text": "15",
- "value": "*/15",
- },
- Object {
- "text": "16",
- "value": "*/16",
- },
- Object {
- "text": "17",
- "value": "*/17",
- },
- Object {
- "text": "18",
- "value": "*/18",
- },
- Object {
- "text": "19",
- "value": "*/19",
- },
- Object {
- "text": "20",
- "value": "*/20",
- },
- Object {
- "text": "21",
- "value": "*/21",
- },
- Object {
- "text": "22",
- "value": "*/22",
- },
- Object {
- "text": "23",
- "value": "*/23",
- },
- Object {
- "text": "24",
- "value": "*/24",
- },
- Object {
- "text": "25",
- "value": "*/25",
- },
- Object {
- "text": "26",
- "value": "*/26",
- },
- Object {
- "text": "27",
- "value": "*/27",
- },
- Object {
- "text": "28",
- "value": "*/28",
- },
- Object {
- "text": "29",
- "value": "*/29",
+ "value": "0,15,30,45",
},
Object {
"text": "30",
- "value": "*/30",
- },
- Object {
- "text": "31",
- "value": "*/31",
- },
- Object {
- "text": "32",
- "value": "*/32",
- },
- Object {
- "text": "33",
- "value": "*/33",
- },
- Object {
- "text": "34",
- "value": "*/34",
- },
- Object {
- "text": "35",
- "value": "*/35",
- },
- Object {
- "text": "36",
- "value": "*/36",
- },
- Object {
- "text": "37",
- "value": "*/37",
- },
- Object {
- "text": "38",
- "value": "*/38",
- },
- Object {
- "text": "39",
- "value": "*/39",
- },
- Object {
- "text": "40",
- "value": "*/40",
- },
- Object {
- "text": "41",
- "value": "*/41",
- },
- Object {
- "text": "42",
- "value": "*/42",
- },
- Object {
- "text": "43",
- "value": "*/43",
- },
- Object {
- "text": "44",
- "value": "*/44",
- },
- Object {
- "text": "45",
- "value": "*/45",
- },
- Object {
- "text": "46",
- "value": "*/46",
- },
- Object {
- "text": "47",
- "value": "*/47",
- },
- Object {
- "text": "48",
- "value": "*/48",
- },
- Object {
- "text": "49",
- "value": "*/49",
- },
- Object {
- "text": "50",
- "value": "*/50",
- },
- Object {
- "text": "51",
- "value": "*/51",
- },
- Object {
- "text": "52",
- "value": "*/52",
- },
- Object {
- "text": "53",
- "value": "*/53",
- },
- Object {
- "text": "54",
- "value": "*/54",
- },
- Object {
- "text": "55",
- "value": "*/55",
- },
- Object {
- "text": "56",
- "value": "*/56",
- },
- Object {
- "text": "57",
- "value": "*/57",
- },
- Object {
- "text": "58",
- "value": "*/58",
- },
- Object {
- "text": "59",
- "value": "*/59",
+ "value": "0,30",
},
]
}
@@ -3970,358 +3530,28 @@ exports[`CronEditor is rendered with a MINUTE frequency 1`] = `
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
({
- value: '*/' + value.toString(),
- text: value.toString(),
-}));
+export const EVERY_MINUTE_OPTIONS = [
+ {
+ text: '5',
+ value: '0,5,10,15,20,25,30,35,40,45,50,55',
+ },
+ {
+ text: '10',
+ value: '0,10,20,30,40,50',
+ },
+ {
+ text: '15',
+ value: '0,15,30,45',
+ },
+ {
+ text: '30',
+ value: '0,30',
+ },
+];
export const MINUTE_OPTIONS = makeSequence(0, 59).map((value) => ({
value: value.toString(),
@@ -111,7 +125,7 @@ export const frequencyToFieldsMap: Record = {
export const frequencyToBaselineFieldsMap: Record = {
MINUTE: {
second: '0',
- minute: '*/1',
+ minute: '0,5,10,15,20,25,30,35,40,45,50,55',
hour: '*',
date: '*',
month: '*',
diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/cron_editor.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/cron_editor.tsx
index bcda5c37f33c73..ed27a69085d97f 100644
--- a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/cron_editor.tsx
+++ b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/cron_editor.tsx
@@ -29,7 +29,6 @@ import { CronMonthly } from './cron_monthly';
import { CronWeekly } from './cron_weekly';
import { CronYearly } from './cron_yearly';
import { cronExpressionToParts, cronPartsToExpression } from './services';
-import { convertFromEveryXMinute, convertToEveryXMinute } from './services/cron';
import { Frequency, Field, FieldToValueMap } from './types';
const excludeBlockListedFrequencies = (
@@ -80,20 +79,14 @@ export class CronEditor extends Component {
}
onChangeFrequency = (frequency: Frequency) => {
- const { onChange, fieldToPreferredValueMap, frequency: oldFrequency } = this.props;
+ const { onChange, fieldToPreferredValueMap } = this.props;
// Update fields which aren't editable with acceptable baseline values.
const editableFields = Object.keys(frequencyToFieldsMap[frequency]) as Field[];
const inheritedFields = editableFields.reduce(
(fieldBaselines, field) => {
if (fieldToPreferredValueMap[field] != null) {
- if (oldFrequency === 'MINUTE') {
- fieldBaselines[field] = convertFromEveryXMinute(fieldToPreferredValueMap[field]);
- } else if (frequency === 'MINUTE') {
- fieldBaselines[field] = convertToEveryXMinute(fieldToPreferredValueMap[field]);
- } else {
- fieldBaselines[field] = fieldToPreferredValueMap[field];
- }
+ fieldBaselines[field] = fieldToPreferredValueMap[field];
}
return fieldBaselines;
},
diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/services/cron.ts b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/services/cron.ts
index fc2019d63c17d7..542502fbcbe769 100644
--- a/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/services/cron.ts
+++ b/x-pack/plugins/enterprise_search/public/applications/shared/cron_editor/services/cron.ts
@@ -56,18 +56,3 @@ export function cronPartsToExpression({
}: FieldToValueMap): string {
return `${second} ${minute} ${hour} ${date} ${month} ${day}`;
}
-
-export function convertToEveryXMinute(
- minute: FieldToValueMap['minute']
-): FieldToValueMap['minute'] {
- if (!minute) return minute;
- if (minute.startsWith('*/')) return minute;
- return '*/' + minute;
-}
-
-export function convertFromEveryXMinute(
- minute: FieldToValueMap['minute']
-): FieldToValueMap['minute'] {
- if (!minute) return minute;
- return minute.startsWith('*/') ? minute.slice(2) : minute;
-}