[8.7] [Enterprise Search] Fix Connector scheduling show week information correctly (#155191) (#155227)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Enterprise Search] Fix Connector scheduling show week information
correctly (#155191)](https://github.com/elastic/kibana/pull/155191)

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

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

<!--BACKPORT [{"author":{"name":"Efe Gürkan
YALAMAN","email":"efeguerkan.yalaman@elastic.co"},"sourceCommit":{"committedDate":"2023-04-19T08:04:42Z","message":"[Enterprise
Search] Fix Connector scheduling show week information correctly
(#155191)\n\n##
Summary\r\n\r\n\r\nhttps://user-images.githubusercontent.com/1410658/232858008-ee843f6e-dfb4-40f1-b33f-66fd90bc8d2e.mov\r\n\r\nWhen
weekly scheduling selected we were showing the wrong
information.\r\nThis fixes cron string parsing and shows correct
information.\r\n\r\n## Release note\r\nFixes connector scheduling now
showing correct setting when weekly\r\nintervals
selected.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"8b6146d1836696ac894dfb017a4fdd777b79ee35","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:EnterpriseSearch","v8.8.0","v8.7.2"],"number":155191,"url":"https://github.com/elastic/kibana/pull/155191","mergeCommit":{"message":"[Enterprise
Search] Fix Connector scheduling show week information correctly
(#155191)\n\n##
Summary\r\n\r\n\r\nhttps://user-images.githubusercontent.com/1410658/232858008-ee843f6e-dfb4-40f1-b33f-66fd90bc8d2e.mov\r\n\r\nWhen
weekly scheduling selected we were showing the wrong
information.\r\nThis fixes cron string parsing and shows correct
information.\r\n\r\n## Release note\r\nFixes connector scheduling now
showing correct setting when weekly\r\nintervals
selected.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"8b6146d1836696ac894dfb017a4fdd777b79ee35"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155191","number":155191,"mergeCommit":{"message":"[Enterprise
Search] Fix Connector scheduling show week information correctly
(#155191)\n\n##
Summary\r\n\r\n\r\nhttps://user-images.githubusercontent.com/1410658/232858008-ee843f6e-dfb4-40f1-b33f-66fd90bc8d2e.mov\r\n\r\nWhen
weekly scheduling selected we were showing the wrong
information.\r\nThis fixes cron string parsing and shows correct
information.\r\n\r\n## Release note\r\nFixes connector scheduling now
showing correct setting when weekly\r\nintervals
selected.\r\n\r\n\r\n### Checklist\r\n\r\nDelete any items that are not
applicable to this PR.\r\n\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios","sha":"8b6146d1836696ac894dfb017a4fdd777b79ee35"}},{"branch":"8.7","label":"v8.7.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Efe Gürkan YALAMAN <efeguerkan.yalaman@elastic.co>
This commit is contained in:
Kibana Machine 2023-04-19 05:10:07 -04:00 committed by GitHub
parent 00df219859
commit 8b46647287
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,10 +66,10 @@ function cronToFrequency(cron: string): Frequency {
if (fields[3] === '*') {
return 'DAY';
}
if (fields[4] === '?') {
if (fields[4] === '*') {
return 'WEEK';
}
if (fields[4] === '*') {
if (fields[4] === '?') {
return 'MONTH';
}
return 'YEAR';