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] For runs targeting assets, show >1 asset in the Target column #26122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bengotow
Copy link
Collaborator

@bengotow bengotow commented Nov 25, 2024

We’ve had reports that users who launch small N numbers of assets together find the new run feed UI difficult to use, since it shows either “asset name” or “2 assets” in the Target column. The "2 assets" form makes it difficult to scan for a run you have in mind:

image

This PR:

  • Makes the target column a bit wider
  • Shows as many asset / check tags as will fit in the available space, and then “X more”

The implementation of this uses a new hook useAdjustChildVisibilityToFill. The idea is that your component renders some reasonable max number of tags (10) and a more tag, and the hook uses a resize observer + layout effect to show/hide the tags to fit the available space. I tried doing this using React state, but it looks bad because you can see it adding / removing tags, especially as you resize the viewport. I think the other approach would be to write a tag “measure” function, or otherwise repeatedly render + size them offscreen, but that’d still force layouts with the added cost of a React.render (the tags are not identical react components - the “4 more” tag is slightly different - so I think the offscreen approach would need to actually render the tag...) The text + size of the "more" tag also changes based on the number of tags displayed.

Sidenote: There’s a bunch of cruft here because the “Target” column components all have to support a “tags” rendering and a “plain” rendering. This is going away soon when we remove the FF allowing users to revert to the old runs page, and I think it’ll clean up this code!

How I Tested These Changes

I added a storybook that makes it easy to test what this looks like in a bunch of scenarios and verify it works nicely.

Screen.Recording.2024-11-24.at.12.21.15.PM.mov

Before:

image image

After:

image image

Related: https://linear.app/dagster-labs/issue/FE-702/show-more-than-one-asset-tag-on-the-new-runs-feed-page

Copy link

github-actions bot commented Nov 25, 2024

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-nvgvwxcli-elementl.vercel.app
https://bengotow-2024-11-FE702.core-storybook.dagster-docs.io

Built with commit 5d19ed5.
This pull request is being automatically deployed with vercel-action

We’ve had reports that users who launch small N numbers of assets together find the new run feed UI difficult to use, since it shows either “asset name” or “2 assets” in the Target column. This PR:

- Expands the target column a bit
- Shows as many asset / check tags as will fit in the available space, and then “X more”

The implementation of this uses a new hook `useAdjustChildVisibilityToFill`. The idea is that your component renders some reasonable max number of tags (10) and a more tag, and the hook uses a resize observer + layout effect to show/hide the tags to fit the available space.  I tried doing this using React state, but it looks bad if you can see it adding / removing tags. I think the other approach would be to write a tag “measure” function, or otherwise repeatedly render + size them offscreen, but that’d still force layouts, and in this case the tags are not identical react components (the “4 more” tag is slightly different)

I added a storybook that makes it easy to test what this looks like in a bunch of scenarios.

Sidenote: There’s a bunch of cruft here because the “Target” column components all have to support a “tags” rendering and a “plain” rendering.  This is going away soon when we remove the FF allowing users to revert to the old runs page, and I think it’ll clean up this code!
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.

1 participant