Skip to content

[Discover] [Metrics Experience] Hide the main table when the metrics profile resolves#260607

Merged
kertal merged 5 commits intoelastic:mainfrom
davismcphee:discover-metrics-hide-table
Apr 3, 2026
Merged

[Discover] [Metrics Experience] Hide the main table when the metrics profile resolves#260607
kertal merged 5 commits intoelastic:mainfrom
davismcphee:discover-metrics-hide-table

Conversation

@davismcphee
Copy link
Copy Markdown
Contributor

@davismcphee davismcphee commented Apr 1, 2026

Summary

Closes #260680

This pull request provides collapsed table by default for the metrics profile.

A-la-carte

Screen.Recording.2026-04-02.at.12.46.03.mov
Screenshot 2026-04-02 at 12 46 28

Checklist

  • Unit or functional tests were updated or added to match the most common scenarios
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@davismcphee davismcphee self-assigned this Apr 1, 2026
@davismcphee davismcphee added release_note:enhancement backport:skip This PR does not require backporting Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// labels Apr 1, 2026
Comment on lines +124 to +150
const getTableButton = ({
isHidden,
toggleTable,
isDisabled,
}: {
isHidden: boolean;
toggleTable: () => void;
isDisabled?: boolean;
}) => {
const label = isHidden
? i18n.translate('discover.panelsToggle.showTableButton', {
defaultMessage: 'Show results table',
})
: i18n.translate('discover.panelsToggle.hideTableButton', {
defaultMessage: 'Hide results table',
});

return {
label,
iconType: isHidden ? temporaryCollapseTableIcon : temporaryExpandTableIcon,
'data-test-subj': isHidden ? 'dscShowTableButton' : 'dscHideTableButton',
'aria-expanded': !isHidden,
isDisabled,
toolTipContent: isDisabled ? disabledCollapsingTooltip : label,
onClick: toggleTable,
};
};
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.

🟠 High panels_toggle/panels_toggle.tsx:124

The iconType logic in getTableButton is inverted: when isHidden is true, it displays temporaryCollapseTableIcon instead of temporaryExpandTableIcon. This shows the wrong icon — users see a collapse icon when the table is already hidden and clicking will expand it. Swap the icons so isHidden maps to temporaryExpandTableIcon.

-    iconType: isHidden ? temporaryCollapseTableIcon : temporaryExpandTableIcon,
+    iconType: isHidden ? temporaryExpandTableIcon : temporaryCollapseTableIcon,
🤖 Copy this AI Prompt to have your agent fix this:
In file src/platform/plugins/shared/discover/public/components/panels_toggle/panels_toggle.tsx around lines 124-150:

The `iconType` logic in `getTableButton` is inverted: when `isHidden` is true, it displays `temporaryCollapseTableIcon` instead of `temporaryExpandTableIcon`. This shows the wrong icon — users see a collapse icon when the table is already hidden and clicking will expand it. Swap the icons so `isHidden` maps to `temporaryExpandTableIcon`.

Evidence trail:
src/platform/plugins/shared/discover/public/components/panels_toggle/panels_toggle.tsx lines 39-67 (icon definitions), line 143 (iconType logic showing `isHidden ? temporaryCollapseTableIcon : temporaryExpandTableIcon`), lines 132-137 (label logic showing correct behavior: `isHidden ? 'Show results table' : 'Hide results table'`), line 144 (data-test-subj showing correct behavior: `isHidden ? 'dscShowTableButton' : 'dscHideTableButton'`). The icon logic at line 143 is inverted compared to the label and test subject logic.

Copy link
Copy Markdown
Contributor

@akowalska622 akowalska622 Apr 2, 2026

Choose a reason for hiding this comment

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

That's not entirely true, the icon visually is aligned with the action, what's inverted is naming of the SVG, which I must have confused in the previous PR and we didn't catch it. That being said, it'll be replaced by EUI icons soon, so I'm not sure if another CI run is worth the change of the variable name

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.

You're right — I misread the icon semantics. The upward arrow for expanding the table (pulling it into view) and downward arrow for collapsing it (pushing it away) are visually correct for the actions. The variable names are swapped, but since these will be replaced by EUI icons soon, it makes sense to leave as-is. Thanks for the clarification!

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'd appreciate a human reviewer input too before resolving 😁
I'm open for changing it, not sure if it's worth it though

@davismcphee davismcphee force-pushed the discover-metrics-hide-table branch from b0da51f to ff73464 Compare April 1, 2026 13:38
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
discover 1959 1960 +1

Async chunks

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

id before after diff
discover 1.6MB 1.6MB +76.0B

History

cc @davismcphee

@akowalska622 akowalska622 self-assigned this Apr 2, 2026
@akowalska622 akowalska622 marked this pull request as ready for review April 2, 2026 10:47
@akowalska622 akowalska622 requested review from a team as code owners April 2, 2026 10:47
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

Copy link
Copy Markdown
Contributor

@justinkambic justinkambic left a comment

Choose a reason for hiding this comment

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

This is awesome! Exploration code LGTM!

That said, one thing worth considering here is that the new behavior for all ES|QL is going to be a loading spinner replacing the old visualization, whether it is a TS metrics-* or a FROM logs-*.

Since there should be no delta for users that are writing FROM queries against logs data streams, this could be jarring for them. I am running against a local cluster, so it happens super fast, but you can imagine if the user is waiting a long time for their query to come back this could be annoying. Example:

main

Image

this branch

Image

@davismcphee
Copy link
Copy Markdown
Contributor Author

@justinkambic That's true, I reverted it in a690be6. We used to have a full screen loader prior to #253510 too, but I removed it since I also didn't like it. I re-added it here because there's some layout flickering when transitioning between profiles that we won't have time to look into for 9.4:

transition.mp4

But I think the alternative is worse since it will happen for all searches like you mentioned. Better a bit of flickering for now until we get a chance to look into it.

Copy link
Copy Markdown
Contributor

@MiloszRadzynski MiloszRadzynski left a comment

Choose a reason for hiding this comment

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

LGTM! Great Work! 🚀

@kertal kertal added Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness and removed Feature:Discover Discover Application labels Apr 3, 2026
@kertal kertal enabled auto-merge (squash) April 3, 2026 14:08
@kertal kertal merged commit 1c8c519 into elastic:main Apr 3, 2026
25 checks passed
@davismcphee davismcphee deleted the discover-metrics-hide-table branch April 7, 2026 19:45
florent-leborgne added a commit to elastic/docs-content that referenced this pull request Apr 22, 2026
…scover (#5845) (#6004)

## Summary

This PR addresses #5845 with the following changes:

- **`solutions/observability/infra-and-hosts/discover-metrics.md`**:
Added a sentence to the intro paragraph noting that the documents table
is collapsed by default when the metrics profile is active, and that
users can expand it at any time. This reflects the behavior introduced
in elastic/kibana#260607, which sets `hideTable: true` as the default
app state for the metrics data source profile.

Note: I didn't add applies_to because the page already has the right
values, so no need to repeat inline

## Resolves

Closes #5845

---

> **AI-generated draft** — created with Claude Sonnet 4.6.
> Review all generated content for factual accuracy before merging.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:Discover Discover Application Project:OneDiscover Enrich Discover with contextual awareness release_note:enhancement Team:DataDiscovery Discover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t// v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover] [Collapsible layout] Collapse table by default for metrics

8 participants