Table: Tooltip from Field (#109428)

* Table: Tooltip by Field

* add colorization support

* more progress on customizing the tooltip based on cell customization

* configurable as an option

* tooltip triggered from a chip in the corner, pinning tooltip

* i18n

* use enum where appropriate

* correctly orient the tooltip to the cell - but at what cost

* clean up some console.logs

* e2e test for the tooltip

* fix global click stuff

* remove console.log

* refine the style of the caret

* caret placement on same-side as alignment to avoid collision with inspect hover

* some updates from self-review

* increase hit target of tooltip caret

* fix width and height auto-sizing especially for dynamic height

* reorganize to pre-calc the per-field stuff

* use linear gradient for triangle

* update e2e to reflect current behavior, that clicking caret multiple times doesn't toggle pinning

* clean up event handlers a bit

* restore test for toggle click

* alright, re-remove the toggle case

* cursor pointer

* remove optional root from Popover for now

* remove this ridiculous autogenerated file

* update some of the text

* kill the cellRefMatrix

* remove unused import

* extract a util for the predicateByName part

* skip the intermediary step for getCellColors
This commit is contained in:
Paul Marbach
2025-08-18 10:11:43 -04:00
committed by GitHub
parent 4e5a51968f
commit 66eee1cb08
16 changed files with 562 additions and 68 deletions
@@ -353,6 +353,69 @@ test.describe('Panels test: Table - Kitchen Sink', { tag: ['@panels', '@table']
// TODO -- saving for another day.
});
test('Tests tooltip interactions', async ({ gotoDashboardPage, selectors }) => {
const dashboardPage = await gotoDashboardPage({
uid: DASHBOARD_UID,
queryParams: new URLSearchParams({ editPanel: '1' }),
});
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Panel.title('Table - Kitchen Sink'))
).toBeVisible();
const firstCaret = dashboardPage
.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Caret)
.first();
// test hovering over and blurring the caret, and whether the tooltip appears and disappears as expected.
await firstCaret.hover();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).toBeVisible();
await dashboardPage.getByGrafanaSelector(selectors.components.Panels.Panel.title('Table - Kitchen Sink')).hover();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).not.toBeVisible();
// when a pinned tooltip is open, clicking outside of it should close it.
await firstCaret.click();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).toBeVisible();
await dashboardPage.getByGrafanaSelector(selectors.components.Panels.Panel.title('Table - Kitchen Sink')).click();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).not.toBeVisible();
// when a pinned tooltip is open, clicking inside of it should NOT close it.
await firstCaret.click();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).toBeVisible();
const tooltip = dashboardPage.getByGrafanaSelector(
selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper
);
await tooltip.click();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).toBeVisible();
await dashboardPage.getByGrafanaSelector(selectors.components.Panels.Panel.title('Table - Kitchen Sink')).click();
await expect(
dashboardPage.getByGrafanaSelector(selectors.components.Panels.Visualization.TableNG.Tooltip.Wrapper)
).not.toBeVisible();
});
test('Empty Table panel', async ({ gotoDashboardPage, selectors }) => {
const dashboardPage = await gotoDashboardPage({
uid: DASHBOARD_UID,