-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Daylight saving time calendar events #193605
[ML] Daylight saving time calendar events #193605
Conversation
/ci |
/ci |
/ci |
/ci |
<p> | ||
<FormattedMessage | ||
id="xpack.ml.settings.anomalyDetection.calendarsDstText" | ||
defaultMessage="Calendars contain a list of scheduled events for which you do not want to generate anomalies, such as planned system outages or public holidays." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szabosteve could you please help with the text for this page.
This text is copied from the normal calendar page, but should instead be about these new DST calendars.
Also the link here goes to our documentation which will need updating.
https://www.elastic.co/guide/en/machine-learning/master/ml-ad-run-jobs.html#ml-ad-calendars
description={ | ||
<FormattedMessage | ||
id="xpack.ml.newJob.wizard.jobDetailsStep.additionalSection.calendarsDstSelection.description" | ||
defaultMessage="Something about DST calendars. {learnMoreLink}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szabosteve can you help me with the text for this section which appears in the AD job wizard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see my suggestions for the DST calendar short description below and let me know what you think.
x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx
Outdated
Show resolved
Hide resolved
...ents/job_details_step/components/additional_section/components/calendars/description_dst.tsx
Outdated
Show resolved
Hide resolved
...ents/job_details_step/components/additional_section/components/calendars/description_dst.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/anomaly_detection_settings.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/calendars/list/header.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/calendars/list/header.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/calendars/list/header.tsx
Outdated
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/calendars/list/header.tsx
Outdated
Show resolved
Hide resolved
.../plugins/ml/public/application/settings/calendars/edit/calendar_form/dst_event_generator.tsx
Outdated
Show resolved
Hide resolved
singleSelection={{ asPlainText: true }} | ||
options={timeZoneOptions} | ||
selectedOptions={selectedTimeZones} | ||
onChange={setSelectedTimeZones} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it's better to clear the table of events onChange
? Otherwise it can appear that new DST events have been generated without having to press the 'Generate' button as the times in the table change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in db72ef0
The list is replaced when events are generated. I've also removed the generate button completely. Events are now created when a timezone is selected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, left a few questions and nitpicks
text: i18n.translate('xpack.ml.settings.breadcrumbs.calendarManagementLabel', { | ||
defaultMessage: 'Calendar DST management', | ||
}), | ||
href: '/settings/calendars_dst_list', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: I see that each breadcrumb is implemented this way, so it's not strictly related to the PR, but why aren't we using locator constants
instead of plain strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably should be using those here.
I believe these breadcrumb files pre-date the introduction of the locator constants.
const events = createDstEvents(timezone); | ||
|
||
// Each year should have 2 events (start and end of DST) | ||
const expectedNumberOfEvents = 20 * 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Maybe we could reuse YEARS_OF_DST_EVENTS
instead of 20
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I originally wrote it that way, but then decided that if someone changes YEARS_OF_DST_EVENTS
it should be caught in the test as a regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: With that rewrite to TS, maybe we could also convert the corresponding index.js file, which exports the component, to TS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, good spot. that file can change
@@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n'; | |||
import { EuiPageBody } from '@elastic/eui'; | |||
|
|||
import { getCalendarSettingsData, validateCalendarId } from './utils'; | |||
import { CalendarForm } from './calendar_form'; | |||
import { CalendarForm } from './calendar_form/calendar_form'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: Why are we directly importing from the file instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just a vscode autocomplete change. I'll change it back.
.../job_details_step/components/additional_section/components/calendars/calendars_selection.tsx
Show resolved
Hide resolved
x-pack/plugins/ml/public/application/settings/calendars/edit/calendar_form/calendar_form.tsx
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]Module Count
Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested latest changes and LGTM
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11216718699 |
Adds new pages for creating and managing DST calendars. Closes elastic#189469 New section added to Settings home page. ![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801) New page for listing DST calendars. The original calendar page does not show DST calendars. ![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4) New page for creating DST calendars. The ability to apply to all jobs and add a description has been removed. It is not possible manually add events. Events are automatically generated for a selected time zone. <img width="1170" alt="image" src="https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7"> If the selected time zone does not observe daylight savings, an info callout is displayed <img width="1178" alt="image" src="https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387"> A new DST calendar section is added to all AD job wizards. ![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f) (cherry picked from commit 2881b04)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[ML] Daylight saving time calendar events (#193605)](#193605) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"James Gowdy","email":"jgowdy@elastic.co"},"sourceCommit":{"committedDate":"2024-10-07T13:35:25Z","message":"[ML] Daylight saving time calendar events (#193605)\n\nAdds new pages for creating and managing DST calendars.\r\nCloses https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added to Settings home page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew page for listing DST calendars. The original calendar page does not\r\nshow DST calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew page for creating DST calendars.\r\nThe ability to apply to all jobs and add a description has been removed.\r\nIt is not possible manually add events. Events are automatically\r\ngenerated for a selected time zone.\r\n<img width=\"1170\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf the selected time zone does not observe daylight savings, an info\r\ncallout is displayed\r\n<img width=\"1178\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA new DST calendar section is added to all AD job wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","Feature:Anomaly Detection","v9.0.0","release_note:feature","v8.16.0","backport:version"],"title":"[ML] Daylight saving time calendar events","number":193605,"url":"https://github.com/elastic/kibana/pull/193605","mergeCommit":{"message":"[ML] Daylight saving time calendar events (#193605)\n\nAdds new pages for creating and managing DST calendars.\r\nCloses https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added to Settings home page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew page for listing DST calendars. The original calendar page does not\r\nshow DST calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew page for creating DST calendars.\r\nThe ability to apply to all jobs and add a description has been removed.\r\nIt is not possible manually add events. Events are automatically\r\ngenerated for a selected time zone.\r\n<img width=\"1170\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf the selected time zone does not observe daylight savings, an info\r\ncallout is displayed\r\n<img width=\"1178\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA new DST calendar section is added to all AD job wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193605","number":193605,"mergeCommit":{"message":"[ML] Daylight saving time calendar events (#193605)\n\nAdds new pages for creating and managing DST calendars.\r\nCloses https://github.com/elastic/kibana/issues/189469\r\n\r\nNew section added to Settings home page.\r\n\r\n![image](https://github.com/user-attachments/assets/9165906f-e571-46be-a5ac-bf7dc9cd2801)\r\n\r\nNew page for listing DST calendars. The original calendar page does not\r\nshow DST calendars.\r\n\r\n![image](https://github.com/user-attachments/assets/32a64a31-b4e5-4516-85fd-19e63aa9d5c4)\r\n\r\nNew page for creating DST calendars.\r\nThe ability to apply to all jobs and add a description has been removed.\r\nIt is not possible manually add events. Events are automatically\r\ngenerated for a selected time zone.\r\n<img width=\"1170\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/557b8d39-6c17-448a-aa30-a282d8a424a7\">\r\n\r\nIf the selected time zone does not observe daylight savings, an info\r\ncallout is displayed\r\n<img width=\"1178\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/627043bf-0368-4ab3-8ca7-1931f9622387\">\r\n\r\n\r\nA new DST calendar section is added to all AD job wizards.\r\n\r\n![image](https://github.com/user-attachments/assets/6359192b-faac-4ffb-ad3e-b8193f40f02f)","sha":"2881b0423d099649243ee01887f27a1fb6dbffe7"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: James Gowdy <jgowdy@elastic.co>
Fixing a typo in the ML locator switch statement which is missing a `break` for the edit calendar page. Bug introduced in #193605 Currently there are no instances where the locator is used to find this page, so this is not something which will affect the user, but it needs still fixing. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ...
Fixing a typo in the ML locator switch statement which is missing a `break` for the edit calendar page. Bug introduced in elastic#193605 Currently there are no instances where the locator is used to find this page, so this is not something which will affect the user, but it needs still fixing. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... (cherry picked from commit 2d970dc)
Fixing a typo in the ML locator switch statement which is missing a `break` for the edit calendar page. Bug introduced in elastic#193605 Currently there are no instances where the locator is used to find this page, so this is not something which will affect the user, but it needs still fixing. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ...
Fixing a typo in the ML locator switch statement which is missing a `break` for the edit calendar page. Bug introduced in elastic#193605 Currently there are no instances where the locator is used to find this page, so this is not something which will affect the user, but it needs still fixing. ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_node:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ...
Adds new pages for creating and managing DST calendars.
Closes #189469
New section added to Settings home page.
New page for listing DST calendars. The original calendar page does not show DST calendars.
New page for creating DST calendars.
The ability to apply to all jobs and add a description has been removed.
It is not possible manually add events. Events are automatically generated for a selected time zone.
If the selected time zone does not observe daylight savings, an info callout is displayed
A new DST calendar section is added to all AD job wizards.