Skip to content

[Sharing URLs] Add the ability to switch between relative and absolute time range#218056

Merged
kowalczyk-krzysztof merged 28 commits intoelastic:mainfrom
kowalczyk-krzysztof:feat/share-modal-time-range
Apr 29, 2025
Merged

[Sharing URLs] Add the ability to switch between relative and absolute time range#218056
kowalczyk-krzysztof merged 28 commits intoelastic:mainfrom
kowalczyk-krzysztof:feat/share-modal-time-range

Conversation

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member

@kowalczyk-krzysztof kowalczyk-krzysztof commented Apr 14, 2025

Summary

This PR adds the ability to switch between relative and absolute time range for short links in Share Modal. By default "absolute time" is pre-selected.

Screenshot 2025-04-23 at 23 01 07
Screenshot 2025-04-23 at 23 01 40
Screenshot 2025-04-23 at 23 02 37

Closes: #189156

@kowalczyk-krzysztof kowalczyk-krzysztof added release_note:enhancement enhancement New value added to drive a business result Feature:SharingURLs Short URLs and Share URL features Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// backport:version Backport to applied version labels v8.19.0 labels Apr 14, 2025
@kowalczyk-krzysztof kowalczyk-krzysztof self-assigned this Apr 14, 2025
Copy link
Copy Markdown
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This working very well!

I left a few comments about the content strings in the new component.

In regards to this only working in Discover, it sounds like there should be an issue filed on requiring (shareableUrlLocatorParams in toggleShareContextMenu. This could get more crossed over with the coming changes from Sharing Modal Architecture, so maybe it's just something to keep an eye on. cc @eokoneyo

Last comment, I think we should run this by @ek-so, to give final approval on the design. (1) The increased amount of text makes this feel a little unfriendly (2) when absolute time range is the forced default, simply having a disabled checkbox doesn't make it entirely clear:

image

@kowalczyk-krzysztof
Copy link
Copy Markdown
Member Author

kowalczyk-krzysztof commented Apr 17, 2025

For this to work on dashboards, a dashboard server-side locator is needed. There's a draft PR for this: #218495

@kowalczyk-krzysztof kowalczyk-krzysztof marked this pull request as ready for review April 28, 2025 15:31
@kowalczyk-krzysztof kowalczyk-krzysztof requested review from a team as code owners April 28, 2025 15:31
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/appex-sharedux (Team:SharedUX)

Copy link
Copy Markdown
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the time utils function is not working correctly if the time string has /d

https://www.elastic.co/guide/en/elasticsearch/reference/8.x/common-options.html#date-math

Comment thread src/platform/plugins/shared/share/public/lib/time_utils.tsx Outdated
Copy link
Copy Markdown
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for going through all of the feedback :)

@nickpeihl nickpeihl self-requested a review April 29, 2025 17:27
...inputParams,
params: {
...inputParams.params,
timeRange: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little concerned that were injecting a timeRange on the LocatorParams even if the timeRange const on line 83 could be undefined such as in DashboardLocatorParams. Would it be possible to make the conditional something like if (isAbsoluteTime && timeRange) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated the condition to be safe.

Copy link
Copy Markdown
Contributor

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! code review and tested sharing absolute and relative links on dashboards

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
share 67 69 +2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 548.1KB 548.1KB +74.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
share 55.9KB 59.7KB +3.8KB

History

cc @kowalczyk-krzysztof

@kowalczyk-krzysztof kowalczyk-krzysztof merged commit 6ab7593 into elastic:main Apr 29, 2025
10 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19

https://github.com/elastic/kibana/actions/runs/14740659195

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.19 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.19:
- [Dashboards] Register dashboard locator on server start (#218495)

Manual backport

To create the backport manually run:

node scripts/backport --pr 218056

Questions ?

Please refer to the Backport tool documentation

akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request Apr 30, 2025
…e time range (elastic#218056)

## Summary

This PR adds the ability to switch between relative and absolute time
range for short links in Share Modal. By default "absolute time" is
pre-selected.

![Screenshot 2025-04-23 at 23 01
07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)
![Screenshot 2025-04-23 at 23 01
40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)
![Screenshot 2025-04-23 at 23 02
37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)


Closes: elastic#189156

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kowalczyk-krzysztof
Copy link
Copy Markdown
Member Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kowalczyk-krzysztof added a commit to kowalczyk-krzysztof/kibana that referenced this pull request Apr 30, 2025
…e time range (elastic#218056)

## Summary

This PR adds the ability to switch between relative and absolute time
range for short links in Share Modal. By default "absolute time" is
pre-selected.

![Screenshot 2025-04-23 at 23 01
07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)
![Screenshot 2025-04-23 at 23 01
40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)
![Screenshot 2025-04-23 at 23 02
37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)

Closes: elastic#189156

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 6ab7593)

# Conflicts:
#	src/platform/plugins/shared/share/public/components/tabs/link/link_content.tsx
kowalczyk-krzysztof added a commit that referenced this pull request Apr 30, 2025
…absolute time range (#218056) (#219755)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Sharing URLs] Add the ability to switch between relative and
absolute time range
(#218056)](#218056)

<!--- Backport version: 9.6.6 -->

### 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-04-29T20:25:38Z","message":"[Sharing
URLs] Add the ability to switch between relative and absolute time range
(#218056)\n\n## Summary\n\nThis PR adds the ability to switch between
relative and absolute time\nrange for short links in Share Modal. By
default \"absolute time\" is\npre-selected.\n\n![Screenshot 2025-04-23
at 23
01\n07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)\n![Screenshot
2025-04-23 at 23
01\n40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)\n![Screenshot
2025-04-23 at 23
02\n37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)\n\n\nCloses:
#189156\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6ab7593fe0b0f1e93dd7f62ca0443a8d05b54faa","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","enhancement","Feature:SharingURLs","Team:SharedUX","backport:version","v9.1.0","v8.19.0"],"title":"[Sharing
URLs] Add the ability to switch between relative and absolute time
range","number":218056,"url":"https://github.com/elastic/kibana/pull/218056","mergeCommit":{"message":"[Sharing
URLs] Add the ability to switch between relative and absolute time range
(#218056)\n\n## Summary\n\nThis PR adds the ability to switch between
relative and absolute time\nrange for short links in Share Modal. By
default \"absolute time\" is\npre-selected.\n\n![Screenshot 2025-04-23
at 23
01\n07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)\n![Screenshot
2025-04-23 at 23
01\n40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)\n![Screenshot
2025-04-23 at 23
02\n37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)\n\n\nCloses:
#189156\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6ab7593fe0b0f1e93dd7f62ca0443a8d05b54faa"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218056","number":218056,"mergeCommit":{"message":"[Sharing
URLs] Add the ability to switch between relative and absolute time range
(#218056)\n\n## Summary\n\nThis PR adds the ability to switch between
relative and absolute time\nrange for short links in Share Modal. By
default \"absolute time\" is\npre-selected.\n\n![Screenshot 2025-04-23
at 23
01\n07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)\n![Screenshot
2025-04-23 at 23
01\n40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)\n![Screenshot
2025-04-23 at 23
02\n37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)\n\n\nCloses:
#189156\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6ab7593fe0b0f1e93dd7f62ca0443a8d05b54faa"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
pborgonovi pushed a commit that referenced this pull request Apr 30, 2025
…e time range (#218056)

## Summary

This PR adds the ability to switch between relative and absolute time
range for short links in Share Modal. By default "absolute time" is
pre-selected.

![Screenshot 2025-04-23 at 23 01
07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)
![Screenshot 2025-04-23 at 23 01
40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)
![Screenshot 2025-04-23 at 23 02
37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)


Closes: #189156

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
…e time range (elastic#218056)

## Summary

This PR adds the ability to switch between relative and absolute time
range for short links in Share Modal. By default "absolute time" is
pre-selected.

![Screenshot 2025-04-23 at 23 01
07](https://github.com/user-attachments/assets/9b88ec53-fe05-4868-83e4-d93faf4a88de)
![Screenshot 2025-04-23 at 23 01
40](https://github.com/user-attachments/assets/abd5bbed-cee1-450b-bafe-83449dab7f0f)
![Screenshot 2025-04-23 at 23 02
37](https://github.com/user-attachments/assets/22943393-51e9-4faa-a842-95485ea40a99)


Closes: elastic#189156

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kowalczyk-krzysztof kowalczyk-krzysztof deleted the feat/share-modal-time-range branch August 31, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels enhancement New value added to drive a business result Feature:SharingURLs Short URLs and Share URL features release_note:enhancement Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default short links to using absolute time when opened on Dashboards and Discover

9 participants