Fix "now" and mixed format date handling in share modal#245539
Conversation
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
nreese
left a comment
There was a problem hiding this comment.
kibana-presentation changes LGTM. Thanks for fixing this issue
code review only
akowalska622
left a comment
There was a problem hiding this comment.
Data Discovery code only review LGTM
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
History
|
eokoneyo
left a comment
There was a problem hiding this comment.
changes LGTM, left a comment
| const handleTimeTypeChange = useCallback( | ||
| (isAbsolute: boolean) => { | ||
| if (urlToCopy?.current && isAbsolute !== isAbsoluteTime) { | ||
| urlToCopy.current = undefined; | ||
| } | ||
| setIsAbsoluteTime(isAbsolute); | ||
| }, | ||
| [isAbsoluteTime] | ||
| ); |
There was a problem hiding this comment.
nit: we could improve this further, such that we simply pass the setIsAbsolute method to onTimeTypeChange and then react to changes to it's value to set urlToCopy only within the context it was defined, your call.
|
Starting backport for target branches: 8.19, 9.1, 9.2 |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary This PR fixes a bug where mixed dates (e.g one absolute and one relative) wouldn't work properly and "now" was rendering as 0 seconds in share modal date switcher. <img width="494" height="432" alt="Screenshot 2025-12-09 at 13 13 05" src="https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a" /> It also makes `ShareableUrlLocatorParams` strongly typed, requiring `timeRange` to be always present even if it has an undefined value, in response to a regression where dashboard time range parameter name was renamed to be snake_case, which broke the functionality as `TimeTypeSection` would always expect `timeRange`. Closes: elastic#241084 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit bae752e) # Conflicts: # src/platform/plugins/shared/discover/public/application/main/components/top_nav/app_menu_actions/get_share.tsx # src/platform/plugins/shared/share/moon.yml
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary This PR fixes a bug where mixed dates (e.g one absolute and one relative) wouldn't work properly and "now" was rendering as 0 seconds in share modal date switcher. <img width="494" height="432" alt="Screenshot 2025-12-09 at 13 13 05" src="https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a" /> It also makes `ShareableUrlLocatorParams` strongly typed, requiring `timeRange` to be always present even if it has an undefined value, in response to a regression where dashboard time range parameter name was renamed to be snake_case, which broke the functionality as `TimeTypeSection` would always expect `timeRange`. Closes: elastic#241084 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit bae752e) # Conflicts: # src/platform/plugins/shared/discover/public/application/main/components/top_nav/app_menu_actions/get_share.tsx # src/platform/plugins/shared/share/moon.yml # src/platform/plugins/shared/share/public/components/share_context_menu.tsx # src/platform/plugins/shared/share/public/components/tabs/link/time_type_section.tsx # src/platform/plugins/shared/share/public/components/url_panel_content.tsx # src/platform/plugins/shared/share/tsconfig.json
…) (#245846) # Backport This will backport the following commits from `main` to `8.19`: - [Fix "now" and mixed format date handling in share modal (#245539)](#245539) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Krzysztof Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix \"now\" and mixed format date handling in share modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},{"url":"https://github.com/elastic/kibana/pull/245841","number":245841,"branch":"9.2","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/245845","number":245845,"branch":"9.1","state":"OPEN"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
… (#245841) # Backport This will backport the following commits from `main` to `9.2`: - [Fix "now" and mixed format date handling in share modal (#245539)](#245539) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Krzysztof Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix \"now\" and mixed format date handling in share modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}}]}] BACKPORT-->
… (#245845) # Backport This will backport the following commits from `main` to `9.1`: - [Fix "now" and mixed format date handling in share modal (#245539)](#245539) <!--- Backport version: 10.2.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Krzysztof Kowalczyk","email":"krzysztof.kowalczyk@elastic.co"},"sourceCommit":{"committedDate":"2025-12-10T14:12:00Z","message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:SharedUX","backport:all-open","papercut","v9.3.0"],"title":"Fix \"now\" and mixed format date handling in share modal","number":245539,"url":"https://github.com/elastic/kibana/pull/245539","mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/245539","number":245539,"mergeCommit":{"message":"Fix \"now\" and mixed format date handling in share modal (#245539)\n\n## Summary\n\nThis PR fixes a bug where mixed dates (e.g one absolute and one\nrelative) wouldn't work properly and \"now\" was rendering as 0 seconds in\nshare modal date switcher.\n\n<img width=\"494\" height=\"432\" alt=\"Screenshot 2025-12-09 at 13 13 05\"\nsrc=\"https://github.com/user-attachments/assets/4d5eb332-7329-40be-b725-97cf5020b73a\"\n/>\n\n\nIt also makes `ShareableUrlLocatorParams` strongly typed, requiring\n`timeRange` to be always present even if it has an undefined value, in\nresponse to a regression where dashboard time range parameter name was\nrenamed to be snake_case, which broke the functionality as\n`TimeTypeSection` would always expect `timeRange`.\n\nCloses: https://github.com/elastic/kibana/issues/241084\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"bae752eb63e5e899019ab4a063a02d2f92815262"}},{"url":"https://github.com/elastic/kibana/pull/245841","number":245841,"branch":"9.2","state":"OPEN"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
This PR fixes a bug where mixed dates (e.g one absolute and one relative) wouldn't work properly and "now" was rendering as 0 seconds in share modal date switcher.
It also makes
ShareableUrlLocatorParamsstrongly typed, requiringtimeRangeto be always present even if it has an undefined value, in response to a regression where dashboard time range parameter name was renamed to be snake_case, which broke the functionality asTimeTypeSectionwould always expecttimeRange.Closes: #241084