-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New asset catalog page #20210
New asset catalog page #20210
Conversation
Deploy preview for dagit-storybook ready! ✅ Preview Built with commit 0b301e9. |
Deploy preview for dagit-core-storybook ready! ✅ Preview Built with commit 67a2a67. |
88f4ede
to
9989084
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @clairelin135 and the rest of your teammates on Graphite |
js_modules/dagster-ui/packages/ui-components/src/components/BaseTag.tsx
Outdated
Show resolved
Hide resolved
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I've got some comments and requests in line. :)
@@ -37,9 +38,15 @@ export const BaseTag = (props: Props) => { | |||
rightIcon, | |||
label, | |||
tooltipText, | |||
fontSize = '12px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you share a screenshot of where this change is needed? It's surprising to me that we would need to modify core components for this UI.
If it does need to be changed, can you separate the ui-components
change into its own PR, with an added Storybook example to demonstrate the new value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without it, owners that don't exist as users display in a smaller font size:
Though perhaps we should not use a BaseTag
for the OSS user display component and instead make the component match the internal implementation: https://github.com/dagster-io/internal/blob/87c74af6b49beef51c95b398cc0c1713b7795d42/dagster-cloud/js_modules/app-cloud/src/settings/audit-log/AuditLogUserDisplay.tsx#L29-L34
Regardless, will break this out into a separate diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think probably Tag
(or BaseTag
) aren't quite right for it, if all you really need is the subway dot and the team/user name. UserDisplayForPermissions
might be close.
js_modules/dagster-ui/packages/ui-core/src/assets/AssetPageHeader.tsx
Outdated
Show resolved
Hide resolved
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
const assetCountByCodeLocation: Record<string, number> = {}; | ||
|
||
assets.forEach((asset) => { | ||
if (asset.definition) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it looks like you don't really need to run this forEach
function if there's no asset.definition
, perhaps use an assets.filter
first?
repositoryLocationName: string; | ||
repositoryName: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RepoAddress
is nice for combining these values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did want to use RepoAddress
here too, but we build a URL linking to the asset graph filtered view from this object that relies on these specific key names.
If desired, I can use RepoAddress
here and then change the key names when we build the link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I just mean that RepoAddress
is nice for representing the combined strings in a single value to be passed around. Then when it needs to be stringified, we have the utilities to do that. Mostly I'd just want consistency, to having places where we are manually concatting or interpolating these values in a way that differs from how we represent RepoAddress
strings elsewhere.
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
<SectionBody> | ||
{Object.entries(assetCountBySection.countsByComputeKind).map( | ||
([label, count], idx) => ( | ||
<CountForAssetType key={idx} assetsCount={count}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
@@ -616,6 +616,25 @@ export const OpTags = React.memo(({tags, style, reduceColor, reduceText}: OpTags | |||
); | |||
}); | |||
|
|||
export const TagIcon = React.memo(({tag_label}: {tag_label: string}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always use camelCase
for JS variable names.
([label, count], idx) => ( | ||
<CountForAssetType key={idx} assetsCount={count}> | ||
<Box flex={{direction: 'row', gap: 4, alignItems: 'center'}}> | ||
<TagIcon tag_label={label} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below re: JS var naming conventions.
<SectionHeader sectionName="Asset groups" /> | ||
<SectionBody> | ||
{assetCountBySection.countPerAssetGroup.map( | ||
(assetGroupCount: CountPerGroupName, idx) => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably shouldn't have to annotate this type, TS should be able to infer it.
0b301e9
to
ebfc8fc
Compare
Looks like Dish and Marco beat me to the PR reviews - this is looking awesome! 🙌 |
Thanks @hellendag and @salazarm for all the feedback, super helpful to get a better understanding of best practices here. I updated the PR per the feedback, I think it's ready for another look! |
ebfc8fc
to
176d325
Compare
js_modules/dagster-ui/packages/ui-core/src/assets/AssetsOverview.tsx
Outdated
Show resolved
Hide resolved
176d325
to
b29093f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great!
b29093f
to
826fa28
Compare
826fa28
to
9f8c949
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How will we get to this page? I didn't see any links to it in the other PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet. Let's ship and iterate. Nice work!
<AssetPageHeader | ||
assetKey={{path: currentPath}} | ||
right={ | ||
<Box flex={{gap: 12, alignItems: 'center'}}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With only one item in the flex container, the gap
shouldn't be necessary here.
timeZone: timezone === 'Automatic' ? browserTimezone() : timezone, | ||
}), | ||
); | ||
if (hour < 12) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be Good morning
when it's like midnight or 2am? 🤔
new Date().toLocaleTimeString('en-US', { | ||
hour: '2-digit', | ||
hourCycle: 'h23', | ||
timeZone: timezone === 'Automatic' ? browserTimezone() : timezone, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to change anything here, but a couple notes:
- For future reference, these formatters can be expensive to set up. It's often a good idea to create a (memoized or static) single formatter object for reuse and call
format
on it. - The approach of parsing out the number from the string looks good to me. Alternatively, if we chose not to care about the user's timezone setting, you could use the
getHours()
method on the Date object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the heads up here.
Which item exactly is the formatter? Is it the date object?
@@ -8,6 +8,7 @@ const WorkspaceRoot = lazy(() => import('../workspace/WorkspaceRoot')); | |||
const OverviewRoot = lazy(() => import('../overview/OverviewRoot')); | |||
const FallthroughRoot = lazy(() => import('./FallthroughRoot')); | |||
const AssetsCatalogRoot = lazy(() => import('../assets/AssetsCatalogRoot')); | |||
const AssetsOverview = lazy(() => import('../assets/AssetsOverview')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used? Does this need a route added to the Switch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good catch, this will only be displayed on cloud so this line isn't needed
@salazarm no links pointing to this page yet. I was thinking that we'd only swap it with the current assets table view once the search UI is out. |
8cb67cf
to
67a2a67
Compare
First stab at displaying the new asset catalog page. Relies on the existing `assetsOrError` query to fetch asset definition info, and adds logic to group assets by code location / owner / etc. This will enable changes to this view, i.e. displaying a tooltip of the asset keys per group, if desired. Tagging others on this PR to get thoughts so far on the existing implementation. Next steps: - Add tests for this component - Unify styling for `UserDisplay` component across core and cloud. Currently they display differently. - Supporting asset search - Displaying a background for the search section Outstanding questions: - How do we handle large numbers of assets on this page? Do we need to implement some way to minimize each section, or paginate? <img width="1457" alt="image" src="https://github.com/dagster-io/dagster/assets/29110579/de586d6b-8ee9-4f62-9891-b491e937f562">
First stab at displaying the new asset catalog page.
Relies on the existing
assetsOrError
query to fetch asset definition info, and adds logic to group assets by code location / owner / etc. This will enable changes to this view, i.e. displaying a tooltip of the asset keys per group, if desired.Tagging others on this PR to get thoughts so far on the existing implementation.
Next steps:
UserDisplay
component across core and cloud. Currently they display differently.Outstanding questions: