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

feat(tooltip): pinned tooltip with actions #1782

Merged
merged 114 commits into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
f1d2cd0
feat(tooltip): initial sticky interactions
nickofthyme Aug 10, 2022
8d2b100
feat: add support for actions on tooltip
nickofthyme Aug 10, 2022
8d8f953
refactor(tooltip): ephemeral context menu with actions
nickofthyme Aug 20, 2022
56d33df
feat: scroll highlighted table row into view
nickofthyme Aug 30, 2022
cdd5113
feat(partition): contextual tooltip
nickofthyme Sep 8, 2022
797804a
feat(goal): contextual tooltip
nickofthyme Sep 8, 2022
3faddfa
feat(tooltip): improve tooltip api
nickofthyme Sep 13, 2022
3a61ed7
feat: apply contrast logic to dot selection ui
nickofthyme Sep 13, 2022
f9a1ed9
fix: cleanup action clickable area
nickofthyme Sep 13, 2022
9a186e7
feat: test center scroll to
nickofthyme Sep 14, 2022
00f0208
fix: category axis tooltip columns
nickofthyme Sep 14, 2022
b69dc68
fix: tooltip heatmap interactions
nickofthyme Sep 14, 2022
e837950
fix(heatmap): disable cursor pointer on hidden bands
nickofthyme Sep 15, 2022
3b07252
feat(flame): context tooltip menu with actions
nickofthyme Sep 16, 2022
bbef0c5
refactor: selection based on tooltip value instead of series id
nickofthyme Sep 20, 2022
9843a6c
fix: preselected values from right click
nickofthyme Sep 20, 2022
7309dd7
chore: cleanup pinned tooltip interactions
nickofthyme Sep 22, 2022
f7b05f6
chore: fix code formatting
nickofthyme Sep 22, 2022
76bce7c
build: add temporary build for usage in kibana
nickofthyme Sep 22, 2022
8cb26f0
chore: remove dist
nickofthyme Sep 23, 2022
d64c607
fix: prevent pinning on unsupported chart types
nickofthyme Sep 23, 2022
8bded58
feat(xy): tooltip max series and type bug fixes
nickofthyme Sep 26, 2022
56c3aeb
fix: type errors
nickofthyme Sep 26, 2022
1d3acbf
chore: add object shorthand lint rule
nickofthyme Sep 26, 2022
e6d68a2
fix: issues with flame chart context interactions
nickofthyme Sep 26, 2022
8d30b3b
Merge branch 'master' into tooltip-actions
nickofthyme Sep 26, 2022
1631a13
fix: tooltip pinning logic
nickofthyme Sep 26, 2022
7aadfd3
fix: minor tweaks to new vertical tooltip behavior
nickofthyme Sep 26, 2022
a08187c
fix: pinned tooltip interactions on line charts
nickofthyme Sep 27, 2022
06cc1ac
fix: pass all tooltip values to onSelect
nickofthyme Sep 27, 2022
ce1e1ee
fix: standalone tooltip stories
nickofthyme Sep 27, 2022
4d87b6c
fix: block scroll style issues
nickofthyme Sep 30, 2022
aac0e94
fix: move maxHeight theme prop to table wrapper and remove all unused
nickofthyme Sep 30, 2022
ba9d0df
feat: pin tooltip when not actionable
nickofthyme Sep 30, 2022
91aca96
feat: heatmap select x and y, default to hovered x value
nickofthyme Sep 30, 2022
caeb3ed
feat: truncate tooltip text when floating and not when pinned
nickofthyme Oct 5, 2022
365f213
fix: tooltip sticky headers with new grid styles
nickofthyme Oct 5, 2022
d2ac2f0
feat: limit unpinned tooltip height by max visible items
nickofthyme Oct 5, 2022
912185f
feat: update select styles with checkmark
nickofthyme Oct 5, 2022
df9992e
feat(tooltip): async actions
nickofthyme Oct 11, 2022
0f15615
fix: type errors in tooltip wrapper
nickofthyme Oct 11, 2022
d988b9b
Merge branch 'master' into tooltip-actions
nickofthyme Oct 12, 2022
84a9b55
fix(tooltip): truncation styles
nickofthyme Oct 12, 2022
98f5436
fix(flame): don't register a mousemove listener with a context menu
markov00 Oct 13, 2022
09f608e
fix(flame): do not pin tooltip when nothing is hovered
markov00 Oct 13, 2022
9d65066
feat: allow using actions with custom tooltip
nickofthyme Oct 13, 2022
4f1ca9b
Merge branch 'master' into tooltip-actions
nickofthyme Oct 13, 2022
350b915
Merge remote-tracking branch 'origin/tooltip-actions' into tooltip-ac…
nickofthyme Oct 13, 2022
d9019b1
chore: example usages
nickofthyme Oct 13, 2022
f21b35e
fix: tooltip pinning across many charts
nickofthyme Oct 14, 2022
bf13e3d
fix: block highlights, cursors, tooltip and legend when brushing
nickofthyme Oct 15, 2022
3ebf0a5
refactor: use a const for the secondary button value
markov00 Oct 14, 2022
2f47a10
fix(tooltip): disable pointer-events when not pinned
markov00 Oct 14, 2022
10b0c0f
fix(tooltip): always truncate label
markov00 Oct 18, 2022
44045d6
Merge remote-tracking branch 'origin/tooltip-actions' into tooltip-ac…
nickofthyme Oct 18, 2022
e68b948
chore: cleanup tooltip styles
nickofthyme Oct 19, 2022
a1e4030
feat: place tooltip based on max width
nickofthyme Oct 19, 2022
67d0c55
fix: only highlight on hover for selected or selectable rows
nickofthyme Oct 19, 2022
ef89849
fix: type errors
nickofthyme Oct 20, 2022
d5d58f0
fix: apply the border to the entire tooltip
markov00 Oct 20, 2022
02d43dc
fix: row key to avoid duplicates
markov00 Oct 20, 2022
9ae73ff
fix(style): run prettier on tooltip scss
markov00 Oct 24, 2022
cc3cc89
chore: simplify types and update api
nickofthyme Oct 24, 2022
95b9f02
Merge remote-tracking branch 'origin/tooltip-actions' into tooltip-ac…
nickofthyme Oct 24, 2022
ef69e85
Merge branch 'master' into tooltip-actions
nickofthyme Oct 24, 2022
133d6e2
test: update snapshots
nickofthyme Oct 24, 2022
7fd4de9
Merge branch 'master' into tooltip-actions
nickofthyme Oct 24, 2022
056e0b9
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Oct 24, 2022
4f58b0e
fix(style): reduce the size of the color strip
markov00 Oct 26, 2022
5b1e5ac
fix(style): correct dark/light mode table selections
markov00 Oct 26, 2022
5fbae78
fix(style): adjust action text color
markov00 Oct 26, 2022
c0ce327
fix(style): remove commented style
markov00 Oct 26, 2022
7f84531
fix(style): truncate tooltip actions and add partition example
markov00 Oct 26, 2022
38d4e02
fix(style): use eui scrollbar
markov00 Oct 26, 2022
1bb9c94
fix(style): move divider into footer/header to add animation
markov00 Oct 27, 2022
5efde1c
feat: pin only for 5 or more and actionable tooltips
nickofthyme Nov 1, 2022
c81be77
feat: compute wrt max width when actionable
nickofthyme Nov 1, 2022
a66bb44
Merge branch 'master' into tooltip-actions
nickofthyme Nov 1, 2022
8ea67b1
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 1, 2022
1cda6be
chore: update api changes
nickofthyme Nov 1, 2022
c465037
chore: update lock file
nickofthyme Nov 1, 2022
56c43b7
test: update failing snapshots
nickofthyme Nov 1, 2022
debe8d0
Merge remote-tracking branch 'origin/tooltip-actions' into tooltip-ac…
nickofthyme Nov 1, 2022
fe55c2b
fix: prettier errors
nickofthyme Nov 1, 2022
0c46af8
fix: table row highlight styles
nickofthyme Nov 2, 2022
92e8a9b
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 2, 2022
76e91d9
fix(style): moved style into components dir
markov00 Oct 28, 2022
4c8ab6f
fix(style): remove unused style
markov00 Oct 28, 2022
99133a7
refactor(style): divide footer, header, divider styles
markov00 Oct 28, 2022
703673a
docs: add async action example
markov00 Nov 2, 2022
1a17637
refactor: split actions and prompts
markov00 Nov 2, 2022
34c04d7
refactor: extract tooltip actions component
markov00 Nov 2, 2022
15a37bf
fix(style): correct mixin path
markov00 Nov 2, 2022
ad12d1f
refactor: bring back original stories [update-vrt]
markov00 Nov 2, 2022
c79cb4d
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 2, 2022
de570d8
fix: style merge conflict
nickofthyme Nov 2, 2022
75c9823
refactor(stories): bring back original heatmap/flamegraph stories
markov00 Nov 2, 2022
1d15992
test: add real chart examples
markov00 Nov 3, 2022
63b50a9
Merge branch 'master' into tooltip-actions
markov00 Nov 3, 2022
e2aeb02
test: update css selector
markov00 Nov 3, 2022
931804e
fix(style): lintin files
markov00 Nov 3, 2022
17f1d4f
refactor: reordering of some properties in type
markov00 Nov 3, 2022
f4d0656
(test): bring back original VRTs to do a final check on the tooltip c…
markov00 Nov 3, 2022
aebedf3
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 3, 2022
ecbaea0
Merge branch 'master' into tooltip-actions
nickofthyme Nov 3, 2022
0356c58
chore: update action options to include selected and all items
nickofthyme Nov 4, 2022
563defc
test: add vrt for new tooltip actions
nickofthyme Nov 4, 2022
7697057
Merge remote-tracking branch 'origin/tooltip-actions' into tooltip-ac…
nickofthyme Nov 4, 2022
dee8447
chore: fix tooltip test and add knob
nickofthyme Nov 4, 2022
dd0b7c3
test(vrt): update screenshots [skip ci]
elastic-datavis[bot] Nov 4, 2022
c9bd721
feat: have seperate prompt for actions vs scrolling list [update-scre…
nickofthyme Nov 4, 2022
55f1bc7
chore: update api
nickofthyme Nov 4, 2022
0367fed
fix: control click interactions
nickofthyme Nov 7, 2022
c464300
Merge branch 'master' into tooltip-actions
markov00 Nov 8, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .buildkite/utils/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const auth = JSON.parse(process.env.GITHUB_AUTH);
const MyOctokit = Octokit.plugin(retry);
export const octokit = new MyOctokit({
authStrategy: createAppAuth,
auth: auth,
auth,
});

export const defaultGHOptions = {
Expand Down Expand Up @@ -237,7 +237,7 @@ export const updateCheckStatus = async (
const output =
title && typeof title === 'string'
? {
title: title,
title,
summary: title,
...options.output,
}
Expand Down
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ module.exports = {
'react/require-default-props': 0,
'react/display-name': 0,
'react/require-render-return': 0, // rule is broken for certain types of function syntax
'react/prefer-stateless-function': 0, // annoying rule that could be used in the future
'jsx-a11y/no-static-element-interactions': 1,
'jsx-a11y/mouse-events-have-key-events': 1,
'jsx-a11y/click-events-have-key-events': 1,
'jsx-a11y/no-static-element-interactions': 0,
'@typescript-eslint/member-ordering': 0,
eqeqeq: 2,

Expand All @@ -112,6 +114,7 @@ module.exports = {
'consistent-return': 0,
'no-plusplus': 0,
'no-bitwise': 0,
'object-shorthand': ['error', 'properties'],
'no-void': [2, { allowAsStatement: true }],
yoda: 0,
'no-restricted-globals': 0,
Expand Down
38 changes: 33 additions & 5 deletions e2e/page_objects/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,12 @@ export class CommonPage {
* @param mousePosition
* @param selector
*/
clickMouseRelativeToDOMElement = (page: Page) => async (mousePosition: MousePosition, selector: string) => {
const element = await this.getBoundingClientRect(page)(selector);
const { x, y } = getCursorPosition(mousePosition, element);
await page.mouse.click(x, y);
};
clickMouseRelativeToDOMElement =
(page: Page) => async (mousePosition: MousePosition, selector: string, button?: 'left' | 'right' | 'middle') => {
const element = await this.getBoundingClientRect(page)(selector);
const { x, y } = getCursorPosition(mousePosition, element);
await page.mouse.click(x, y, { button });
};

/**
* Drag mouse relative to element
Expand Down Expand Up @@ -435,6 +436,33 @@ export class CommonPage {
});
};

/**
* Expect a chart given a url from storybook with mouse click
*
* TODO - Find why this always creates a 2px diff
*
* @param url Storybook url from knobs section
* @param mousePosition - position of mouse relative to chart
* @param options
*/
expectChartWithClickAtUrlToMatchScreenshot =
(page: Page) =>
async (
url: string,
mousePosition: MousePosition,
button?: 'left' | 'right' | 'middle',
options?: ScreenshotElementAtUrlOptions,
) => {
const action = async () => {
await options?.action?.();
await this.clickMouseRelativeToDOMElement(page)(mousePosition, this.chartSelector, button);
};
await this.expectChartAtUrlToMatchScreenshot(page)(url, {
...options,
action,
});
};

/**
* Expect a chart given a url from storybook with keyboard events
* @param url
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions e2e/tests/tooltip.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { test } from '@playwright/test';

import { common } from '../page_objects/common';

process.env.ENV_URL = 'http://localhost:9002/';

test.describe('Tooltip', () => {
test.describe('Chart Types', () => {
test.describe('Cartesian', () => {
test('pinning without selection', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--cartesian-charts&globals=theme:light&knob-Chart%20type=treemap&knob-SeriesType=bar&knob-async%20delay%20(ms)=1500&knob-character%20set=rtl&knob-data%20polarity=Mixed&knob-pinned=true&knob-rtl%20language=AR&knob-show%20legend=true&knob-stacked=true&knob-visible=true',
{ left: 240, bottom: 260 },
'right',
);
});

test('pinning over selection', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--cartesian-charts&globals=theme:light&knob-Chart type=treemap&knob-SeriesType=bar&knob-async delay=1000&knob-async delay (ms)=1500&knob-character set=rtl&knob-chart type=line&knob-data polarity=Mixed&knob-pinned=true&knob-rtl language=AR&knob-show legend=true&knob-stacked=true&knob-visible=true&knob-reduce data=true&knob-async actions delay=0',
{ left: 220, bottom: 285 },
'right',
);
});

test('show loading prompt for async actions', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--cartesian-charts&globals=theme:light&knob-Chart type=treemap&knob-SeriesType=bar&knob-async delay=1000&knob-async delay (ms)=1500&knob-character set=rtl&knob-chart type=line&knob-data polarity=Mixed&knob-pinned=true&knob-rtl language=AR&knob-show legend=true&knob-stacked=true&knob-visible=true&knob-reduce data=true&knob-async actions delay=1000',
{ left: 220, bottom: 285 },
'right',
);
});

test('selecting series on pinned tooltip', async ({ page }) => {
await common.expectChartAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--cartesian-charts&globals=theme:light&knob-Chart type=treemap&knob-SeriesType=bar&knob-async delay=1000&knob-async delay (ms)=1500&knob-character set=rtl&knob-chart type=bar&knob-data polarity=Mixed&knob-pinned=true&knob-rtl language=AR&knob-show legend=true&knob-stacked=true&knob-visible=true&knob-reduce data=true&knob-async actions delay=0',
{
action: async () => {
await common.clickMouseRelativeToDOMElement(page)({ left: 260, top: 180 }, common.chartSelector, 'right');
// table row not visible thus not clickable by playwright
const items = page.locator('.echTooltip__tableRow .echTooltip__tableCell:first-of-type');
await items.nth(5).click();
await items.nth(0).click();
await items.nth(2).click();
},
},
);
});

test('selecting series on pinned tooltip async', async ({ page }) => {
const delay = 100;
await common.expectChartAtUrlToMatchScreenshot(page)(
`http://localhost:9001/?path=/story/components-tooltip--cartesian-charts&globals=theme:light&knob-Chart type=treemap&knob-SeriesType=bar&knob-async delay=1000&knob-async delay (ms)=1500&knob-character set=rtl&knob-chart type=bar&knob-data polarity=Mixed&knob-pinned=true&knob-rtl language=AR&knob-show legend=true&knob-stacked=true&knob-visible=true&knob-reduce data=true&knob-async actions delay=${delay}`,
{
action: async () => {
await common.clickMouseRelativeToDOMElement(page)({ left: 260, top: 180 }, common.chartSelector, 'right');
// table row not visible thus not clickable by playwright
const items = page.locator('.echTooltip__tableRow .echTooltip__tableCell:first-of-type');
await items.nth(2).click();
},
delay,
},
);
});
});

test.describe('Partition', () => {
test('pinning with selection', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--partition-charts&globals=background:white;theme:light&knob-Chart%20type=treemap&knob-SeriesType=bar&knob-async%20delay%20(ms)=1500&knob-character%20set=rtl&knob-data%20polarity=Mixed&knob-pinned=true&knob-rtl%20language=AR&knob-show%20legend=true&knob-stacked=true&knob-visible=true',
{ left: 245, bottom: 185 },
'right',
);
});
});

test.describe('Heatmap', () => {
test('pinning with selection', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--heatmap-chart&globals=theme:light&knob-Chart%20type=treemap&knob-SeriesType=bar&knob-async%20delay%20(ms)=1500&knob-character%20set=rtl&knob-data%20polarity=Mixed&knob-pinned=true&knob-rtl%20language=AR&knob-show%20legend=true&knob-stacked=true&knob-visible=true',
{ left: 300, bottom: 180 },
'right',
);
});
});

test.describe('Flamegraph', () => {
test('pinning with selection', async ({ page }) => {
await common.expectChartWithClickAtUrlToMatchScreenshot(page)(
'http://localhost:9001/?path=/story/components-tooltip--flamegraph&globals=theme:light&knob-Chart%20type=treemap&knob-SeriesType=bar&knob-async%20delay%20(ms)=1500&knob-character%20set=rtl&knob-data%20polarity=Mixed&knob-pinned=true&knob-rtl%20language=AR&knob-show%20legend=true&knob-stacked=true&knob-visible=true',
{ left: 220, bottom: 220 },
'right',
);
});
});
});
});
Loading