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

[UI v2] Add FlowRunActivityBarGraph component #16284

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

desertaxle
Copy link
Member

@desertaxle desertaxle commented Dec 9, 2024

Summary

This PR ports the flow run activity bar graph to the v2 UI. The bucketing algorithm from the existing UI was ported with minimal modifications (mostly to remove Vue references). The component isn't used anywhere in the app yet and this PR only adds a Storybook entry for development. The fist place this component will be used is in the deployments table.

The following customizations were made to the stock recharts bar graph:

  1. A custom bar shape to display a placeholder bar when no flow run falls into a given bucket.
  2. A custom tooltip to display flow run information on hover.
  3. The active state is semi-controlled to apply an asymmetric debounce to the tooltip display. The tooltip appears instantly but disappears after a 500ms delay. The delay time can be modified, but I added this to make mousing to the tooltip easier.

This PR also adds @faker-js/faker to enable generating randomized test data when developing with Storybook.

Video

Screen.Recording.2024-12-09.at.10.39.37.AM.mov

@desertaxle desertaxle changed the title UI v2 flow run activity bar graph [UI v2] Add FlowRunActivityBarGraph component Dec 9, 2024
@desertaxle desertaxle marked this pull request as ready for review December 9, 2024 17:19
initialValue: boolean | undefined = undefined,
leaveDelay = 500,
) => {
const [internalValue, setInternalValue] = useState<boolean | undefined>(
Copy link
Contributor

@devinvillarosa devinvillarosa Dec 9, 2024

Choose a reason for hiding this comment

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

q: Is there a differentiation between an undefined state and false state?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, false will cause the tooltip never to appear, and undefined allows recharts to control whether or not to display the tooltip. This implementation selectively takes over the state of the tooltip so that users can mouse over the tooltip to click on links to the flow, flow run, or deployment.

Copy link
Contributor

@devinvillarosa devinvillarosa left a comment

Choose a reason for hiding this comment

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

🚀 🚀 💹

Comment on lines +39 to +45
class ResizeObserverMock {
observe() {}
unobserve() {}
disconnect() {}
}

global.ResizeObserver = ResizeObserverMock;
Copy link
Contributor

@devinvillarosa devinvillarosa Dec 10, 2024

Choose a reason for hiding this comment

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

Is there a way to move this to tests/setup?

I'm also hitting a problem this problem with dialogs and needed to copy/paste the same logic

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think if you move the entire beforeAll hook into ui-v2/tests/setup.ts, then all tests should get this mock by default. If specific tests need a different mock then they should be able to override it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants