Skip to content
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

[Lens] context formula functions don't update on dashboard #170762

Closed
drewdaemon opened this issue Nov 7, 2023 · 2 comments · Fixed by #172710
Closed

[Lens] context formula functions don't update on dashboard #170762

drewdaemon opened this issue Nov 7, 2023 · 2 comments · Fixed by #172710
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@drewdaemon
Copy link
Contributor

drewdaemon commented Nov 7, 2023

Kibana version:
8.11, maybe earlier

Describe the bug:
The result of the time_range, now, and interval formula functions should be updated according to the current time range as well as the current moment in time.

For example, when the time range is changed, so should the result of time_range. This works in Lens, but not in Dashboard (embeddable).

Steps to reproduce:

  1. Create metric visualization
  2. Set primary metric dimension to time_range()
  3. Change time range within editor
  4. Notice that the result changes
  5. Add to dashboard
  6. Change time range in dashboard
  7. Result is frozen

Screenshots (if relevant):

Screen.Recording.2023-11-07.at.8.46.00.AM.mov
@drewdaemon drewdaemon added bug Fixes for quality problems that affect the customer experience Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. labels Nov 7, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations (Team:Visualizations)

@drewdaemon drewdaemon self-assigned this Dec 4, 2023
@drewdaemon
Copy link
Contributor Author

drewdaemon commented Dec 5, 2023

The time range is built into the (data source) expression when the expression is created.

In the editor, the expression is recreated from scratch every time the time range changes, leading to an updated value for time_range().

However, in the embeddable, we only generate the expression once at load time. Because of this, the original time range value persists no matter what the user does.

@drewdaemon drewdaemon changed the title [Lens] time_range formula function doesn't update on dashboard [Lens] context formula functions don't update on dashboard Dec 6, 2023
drewdaemon added a commit that referenced this issue Dec 19, 2023
## Summary
Fix #170762



https://github.com/elastic/kibana/assets/315764/f5b50ffa-4a03-45ee-bc7a-2f2aca7fa3bd



### Checklist
- [x] [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

---------

Co-authored-by: Kibana Machine <[email protected]>
drewdaemon added a commit to drewdaemon/kibana that referenced this issue Dec 20, 2023
## Summary
Fix elastic#170762

https://github.com/elastic/kibana/assets/315764/f5b50ffa-4a03-45ee-bc7a-2f2aca7fa3bd

### Checklist
- [x] [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

---------

Co-authored-by: Kibana Machine <[email protected]>
(cherry picked from commit 99763dc)
drewdaemon referenced this issue Dec 20, 2023
# Backport

This will backport the following commits from `main` to `8.12`:
- [[Lens] Fix context formula functions
(#172710)](#172710)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Drew
Tate","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-12-19T15:32:31Z","message":"[Lens]
Fix context formula functions (#172710)\n\n## Summary\r\nFix
https://github.com/elastic/kibana/issues/170762\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/315764/f5b50ffa-4a03-45ee-bc7a-2f2aca7fa3bd\r\n\r\n\r\n\r\n###
Checklist\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\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"99763dc61647c817384019f6603de7ad258eea01","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:ExpressionLanguage","Team:Visualizations","Feature:Lens","backport:prev-minor","v8.13.0"],"number":172710,"url":"https://github.com/elastic/kibana/pull/172710","mergeCommit":{"message":"[Lens]
Fix context formula functions (#172710)\n\n## Summary\r\nFix
https://github.com/elastic/kibana/issues/170762\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/315764/f5b50ffa-4a03-45ee-bc7a-2f2aca7fa3bd\r\n\r\n\r\n\r\n###
Checklist\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\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"99763dc61647c817384019f6603de7ad258eea01"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.13.0","labelRegex":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/172710","number":172710,"mergeCommit":{"message":"[Lens]
Fix context formula functions (#172710)\n\n## Summary\r\nFix
https://github.com/elastic/kibana/issues/170762\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/315764/f5b50ffa-4a03-45ee-bc7a-2f2aca7fa3bd\r\n\r\n\r\n\r\n###
Checklist\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\r\n\r\n---------\r\n\r\nCo-authored-by: Kibana Machine
<[email protected]>","sha":"99763dc61647c817384019f6603de7ad258eea01"}}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Lens impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants