[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover#214413
Conversation
|
@davismcphee @weltenwort I am working on this feature where when the user clicks on Stacktrace or DegradedField icon on Discover, it should -
I have opened this Draft PR just to discuss the code approach with both of you to understand how we can actually achieve this. Please keep in mind this PR is not a complete work and only sort of a Demo Work and only works for Stacktrace icon. What i have done
Basically just to maintain the accordion state, its super nasty prop drilling which i have to do. The question here is
|
Could you help me understand this? Kept open when clicking which icon?
Currently the fly-out doesn't seem to be represented in the url state at all, so it wouldn't be much help here. And, as you mentioned, the embeddable use-case forbids that anyway. Maybe this is not the right place to open that discussion again, but wouldn't it be cleaner to have the stack trace on a separate tab? Then we could forego all that scrolling business and just enhance the doc viewer to take an initial active tab. |
@weltenwort The
The idea does solve the problem with state management, but this will only solve the problem for StackTrace. We have Quality Issues accordion as well (second icon). That would mean we will have to have Quality Issues / degraded Fields as well in a separate tab which i doubt would scale well then. |
|
I see, thanks for the clarifications. While appreciate the attempt to work around the limitations of the fly-out API right now, establishing all these side-channels to juggle the collapse and scroll state seems brittle to me. How feasible would it be to enhance the fly-out API ( |
|
@achyutjhunjhunwala Thanks for looking into this. I took a look at it today, and the overall direction makes sense to me, but I agree with @weltenwort's thoughts on not leaking the overview tab internals into Discover or Unified Doc Viewer. The suggestion to extend For managing overview tab state, we could try something like passing an untyped context object through Unified Doc Viewer into the tab component where it could be casted, or another option would be to use the profile state management tools the context awareness framework currently offers. Your two options would be using React context + the I took a quick stab at modifying the approach to use custom context objects instead and created an example PR: #215072. I threw it together quickly so it's not very elegant or mergeable, but it should give an example of one of the options 🙂 |
…ontext Awareness to pass on the state for Accordions
|
@weltenwort @davismcphee Thank you both for your comments. @davismcphee Highly appreciate the PR you did, gave me a better idea of how the Profile work and i must appreciate the documentation around Context Awareness which you shared is real Gold. I was not aware that it exist. Saved me quite a lot of time. I have achieved the functionality which i intended with 1 minor bug, which i am unable to figure out on how to fix it. I must day this was a complex problem to solve 😆 What is expectedI am pointing our the Scenarios which this logic should handle and what i was able to achieve and where is the bug Scenarios -:
This happens because the Behavior Subject's last value was set when click action on Stacktrace-Quality Issue icon happens and we cannot reset it. Given i need to remount the component again to handle tab switches scenario, i am unable to find a spot to pass I hope i am able to explain the problem here. I will open this code for review now and start working on tests so that the other parts of the PR can be reviewed. |
|
@davismcphee @tonyghiani Hi Both i have merged the last bit of pending review comments. Can you please help me with an approvals |
davismcphee
left a comment
There was a problem hiding this comment.
We're so very close! Just noticed one potential issue with the latest commit.
src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.tsx
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.tsx
Show resolved
Hide resolved
...orm/plugins/shared/discover/public/application/main/components/layout/discover_documents.tsx
Outdated
Show resolved
Hide resolved
src/platform/plugins/shared/discover/public/embeddable/components/saved_search_grid.tsx
Outdated
Show resolved
Hide resolved
davismcphee
left a comment
There was a problem hiding this comment.
I believe the issue from the video I shared is still present, but I really want to unblock this PR so we can get all these nice test fixes in, and we can follow up on that issue separately 👍
Thanks again for all the effort put into this, I know it was probably super frustrating but also much appreciated. Now let's merge this thing and never speak of it again! (Kidding of course, let's consider how we can make things less painful for future contributors)
src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.tsx
Show resolved
Hide resolved
src/platform/plugins/shared/discover/public/embeddable/components/saved_search_grid.tsx
Outdated
Show resolved
Hide resolved
src/platform/packages/shared/kbn-unified-doc-viewer/src/components/doc_viewer/doc_viewer.tsx
Outdated
Show resolved
Hide resolved
💔 Build Failed
Failed CI StepsMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Unknown metric groupsAPI count
History
|
|
@achyutjhunjhunwala shouldn't this be backported to 8.19 too? |
|
@gbamparop thats a good question. I don't remember the backport rule we are currently having, but my understanding was all new features in 9.x and only important bug fixes in 8.19. |
|
All features should be backported to 8.19 as well, so this PR applies |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…ed Fields on Discover (#214413) (#221576) # Backport This will backport the following commits from `main` to `8.19`: - [[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover (#214413)](#214413) <!--- Backport version: 10.0.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Achyut Jhunjhunwala","email":"achyut.jhunjhunwala@elastic.co"},"sourceCommit":{"committedDate":"2025-05-06T15:33:26Z","message":"[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover (#214413)\n\nCloses: https://github.com/elastic/kibana/issues/190670\n\nThe PR adds click actions to Stacktrace and Degraded Fields Actions in\nDiscover.\n\nFor Eg - When you click on stacktrace icon in Discover, it opens the\nFlyout and Scroll Into View the Stacktrace Section\n\n\n\n## Whats pending\n\n- [x] Stateful FTR Tests - Discover\n- [x] Stateful FTR Tests - Discover inside a Dashboard\n- [x] Serverless FTR Tests - Discover\n- [x] Serverless FTR Tests - Discover inside a Dashboard\n- [x] Appropriate Unit tests\n\n## Test Plan\n\n- 'should open the flyout with stacktrace and quality issues accordion\nclosed when expand is clicked'\n- 'should open the flyout with stacktrace accordion open and quality\nissues accordion closed when stacktrace icon is clicked',\n- 'should open the flyout with stacktrace accordion close and quality\nissues accordion open when quality issues icon is clicked'\n- 'should keep old accordion open when 1st stacktrace and then quality\nissue control for the same row is clicked'\n- 'should toggle to quality issue accordion when 1st stacktrace and then\nquality issue control is clicked for different row'\n- 'should keep old accordion open when 1st quality issue and then\nstacktrace control for the same row is clicked'\n- 'should toggle to stacktrace accordion when 1st quality issue and then\nstacktrace control is clicked for different row'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of same row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of different row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of same row and flyout is already\nopen with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of different row and flyout is\nalready open with some other tab'\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>\nCo-authored-by: Davis McPhee <davis.mcphee@elastic.co>\nCo-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>","sha":"a1d60ae978bf0a651c3b1d2aee601748cb3ca8a6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","backport:skip","release_note:feature","Team:obs-ux-logs","Team:obs-ux-infra_services","v9.1.0"],"title":"[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover","number":214413,"url":"https://github.com/elastic/kibana/pull/214413","mergeCommit":{"message":"[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover (#214413)\n\nCloses: https://github.com/elastic/kibana/issues/190670\n\nThe PR adds click actions to Stacktrace and Degraded Fields Actions in\nDiscover.\n\nFor Eg - When you click on stacktrace icon in Discover, it opens the\nFlyout and Scroll Into View the Stacktrace Section\n\n\n\n## Whats pending\n\n- [x] Stateful FTR Tests - Discover\n- [x] Stateful FTR Tests - Discover inside a Dashboard\n- [x] Serverless FTR Tests - Discover\n- [x] Serverless FTR Tests - Discover inside a Dashboard\n- [x] Appropriate Unit tests\n\n## Test Plan\n\n- 'should open the flyout with stacktrace and quality issues accordion\nclosed when expand is clicked'\n- 'should open the flyout with stacktrace accordion open and quality\nissues accordion closed when stacktrace icon is clicked',\n- 'should open the flyout with stacktrace accordion close and quality\nissues accordion open when quality issues icon is clicked'\n- 'should keep old accordion open when 1st stacktrace and then quality\nissue control for the same row is clicked'\n- 'should toggle to quality issue accordion when 1st stacktrace and then\nquality issue control is clicked for different row'\n- 'should keep old accordion open when 1st quality issue and then\nstacktrace control for the same row is clicked'\n- 'should toggle to stacktrace accordion when 1st quality issue and then\nstacktrace control is clicked for different row'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of same row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of different row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of same row and flyout is already\nopen with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of different row and flyout is\nalready open with some other tab'\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>\nCo-authored-by: Davis McPhee <davis.mcphee@elastic.co>\nCo-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>","sha":"a1d60ae978bf0a651c3b1d2aee601748cb3ca8a6"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/214413","number":214413,"mergeCommit":{"message":"[Discover] Implementing click action for Stacktrace and Degraded Fields on Discover (#214413)\n\nCloses: https://github.com/elastic/kibana/issues/190670\n\nThe PR adds click actions to Stacktrace and Degraded Fields Actions in\nDiscover.\n\nFor Eg - When you click on stacktrace icon in Discover, it opens the\nFlyout and Scroll Into View the Stacktrace Section\n\n\n\n## Whats pending\n\n- [x] Stateful FTR Tests - Discover\n- [x] Stateful FTR Tests - Discover inside a Dashboard\n- [x] Serverless FTR Tests - Discover\n- [x] Serverless FTR Tests - Discover inside a Dashboard\n- [x] Appropriate Unit tests\n\n## Test Plan\n\n- 'should open the flyout with stacktrace and quality issues accordion\nclosed when expand is clicked'\n- 'should open the flyout with stacktrace accordion open and quality\nissues accordion closed when stacktrace icon is clicked',\n- 'should open the flyout with stacktrace accordion close and quality\nissues accordion open when quality issues icon is clicked'\n- 'should keep old accordion open when 1st stacktrace and then quality\nissue control for the same row is clicked'\n- 'should toggle to quality issue accordion when 1st stacktrace and then\nquality issue control is clicked for different row'\n- 'should keep old accordion open when 1st quality issue and then\nstacktrace control for the same row is clicked'\n- 'should toggle to stacktrace accordion when 1st quality issue and then\nstacktrace control is clicked for different row'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of same row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open quality issues accordion,\nwhen user clicks on quality issue control of different row and flyout is\nalready open with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of same row and flyout is already\nopen with some other tab'\n- 'should switch tab to logs overview and open stacktrace accordion,\nwhen user clicks on stacktrace control of different row and flyout is\nalready open with some other tab'\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co>\nCo-authored-by: Davis McPhee <davis.mcphee@elastic.co>\nCo-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>","sha":"a1d60ae978bf0a651c3b1d2aee601748cb3ca8a6"}}]}] BACKPORT-->
…ds on Discover (elastic#214413) Closes: elastic#190670 The PR adds click actions to Stacktrace and Degraded Fields Actions in Discover. For Eg - When you click on stacktrace icon in Discover, it opens the Flyout and Scroll Into View the Stacktrace Section  ## Whats pending - [x] Stateful FTR Tests - Discover - [x] Stateful FTR Tests - Discover inside a Dashboard - [x] Serverless FTR Tests - Discover - [x] Serverless FTR Tests - Discover inside a Dashboard - [x] Appropriate Unit tests ## Test Plan - 'should open the flyout with stacktrace and quality issues accordion closed when expand is clicked' - 'should open the flyout with stacktrace accordion open and quality issues accordion closed when stacktrace icon is clicked', - 'should open the flyout with stacktrace accordion close and quality issues accordion open when quality issues icon is clicked' - 'should keep old accordion open when 1st stacktrace and then quality issue control for the same row is clicked' - 'should toggle to quality issue accordion when 1st stacktrace and then quality issue control is clicked for different row' - 'should keep old accordion open when 1st quality issue and then stacktrace control for the same row is clicked' - 'should toggle to stacktrace accordion when 1st quality issue and then stacktrace control is clicked for different row' - 'should switch tab to logs overview and open quality issues accordion, when user clicks on quality issue control of same row and flyout is already open with some other tab' - 'should switch tab to logs overview and open quality issues accordion, when user clicks on quality issue control of different row and flyout is already open with some other tab' - 'should switch tab to logs overview and open stacktrace accordion, when user clicks on stacktrace control of same row and flyout is already open with some other tab' - 'should switch tab to logs overview and open stacktrace accordion, when user clicks on stacktrace control of different row and flyout is already open with some other tab' --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co> Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>
…ds on Discover (elastic#214413) Closes: elastic#190670 The PR adds click actions to Stacktrace and Degraded Fields Actions in Discover. For Eg - When you click on stacktrace icon in Discover, it opens the Flyout and Scroll Into View the Stacktrace Section  ## Whats pending - [x] Stateful FTR Tests - Discover - [x] Stateful FTR Tests - Discover inside a Dashboard - [x] Serverless FTR Tests - Discover - [x] Serverless FTR Tests - Discover inside a Dashboard - [x] Appropriate Unit tests ## Test Plan - 'should open the flyout with stacktrace and quality issues accordion closed when expand is clicked' - 'should open the flyout with stacktrace accordion open and quality issues accordion closed when stacktrace icon is clicked', - 'should open the flyout with stacktrace accordion close and quality issues accordion open when quality issues icon is clicked' - 'should keep old accordion open when 1st stacktrace and then quality issue control for the same row is clicked' - 'should toggle to quality issue accordion when 1st stacktrace and then quality issue control is clicked for different row' - 'should keep old accordion open when 1st quality issue and then stacktrace control for the same row is clicked' - 'should toggle to stacktrace accordion when 1st quality issue and then stacktrace control is clicked for different row' - 'should switch tab to logs overview and open quality issues accordion, when user clicks on quality issue control of same row and flyout is already open with some other tab' - 'should switch tab to logs overview and open quality issues accordion, when user clicks on quality issue control of different row and flyout is already open with some other tab' - 'should switch tab to logs overview and open stacktrace accordion, when user clicks on stacktrace control of same row and flyout is already open with some other tab' - 'should switch tab to logs overview and open stacktrace accordion, when user clicks on stacktrace control of different row and flyout is already open with some other tab' --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Karen Grigoryan <karen.grigoryan@elastic.co> Co-authored-by: Davis McPhee <davis.mcphee@elastic.co> Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani01@gmail.com>

Closes: #190670
The PR adds click actions to Stacktrace and Degraded Fields Actions in Discover.
For Eg - When you click on stacktrace icon in Discover, it opens the Flyout and Scroll Into View the Stacktrace Section
Whats pending
Test Plan