Skip to content

[Catalogv2] Add favorites support #29317

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

Merged
merged 6 commits into from
Apr 16, 2025
Merged

[Catalogv2] Add favorites support #29317

merged 6 commits into from
Apr 16, 2025

Conversation

salazarm
Copy link
Contributor

Summary & Motivation

Similar to what we do here and here. Basically since this is in OSS we use that hook to signal whether or not we're currently in the favorites view and so should use the favorited assets.

How I Tested These Changes

jest

Comment on lines -242 to -426
</div>
</Row>
);
}
return wrapper(<AssetRow asset={item} />);
})}
</Inner>
</Container>
);
},
);

const StatusHeader = React.memo(
({
status,
open,
count,
onToggle,
}: {
status: AssetHealthStatusString;
open: boolean;
count: number;
onToggle: () => void;
}) => {
const {iconName, iconColor, text} = STATUS_INFO[status];
return (
<StatusHeaderContainer
flex={{direction: 'row', alignItems: 'center', gap: 4}}
onClick={onToggle}
>
<Icon name={iconName} color={iconColor} />
<SubtitleSmall>
{text} ({numberFormatter.format(count)})
</SubtitleSmall>
<Icon
name="arrow_drop_down"
style={{transform: open ? 'rotate(0deg)' : 'rotate(-90deg)'}}
color={Colors.textLight()}
/>
</StatusHeaderContainer>
);
},
);

const StatusHeaderContainer = styled(Box)`
background-color: ${Colors.backgroundLight()};
&:hover {
background-color: ${Colors.backgroundLightHover()};
}
border-radius: 4px;
padding: 6px 24px;
`;

const AssetRow = React.memo(({asset}: {asset: AssetHealthFragment}) => {
const linkUrl = assetDetailsPathForKey({path: asset.assetKey.path});

return (
<RowWrapper to={linkUrl}>
<Box flex={{direction: 'row', alignItems: 'center', justifyContent: 'space-between'}}>
<Box flex={{direction: 'row', gap: 4, alignItems: 'center'}}>
<AssetIconWrapper>
<Icon name="asset" />
</AssetIconWrapper>
{asset.assetKey.path.join(' / ')}
</Box>
{/* Prevent clicks on the trend from propoagating to the row and triggering the link */}
<div
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
}}
className="test"
>
<AssetRecentUpdatesTrend asset={asset} />
</div>
</Box>
</RowWrapper>
);
});

type AssetWithDefinition = AssetTableFragment & {
definition: NonNullable<AssetTableFragment['definition']>;
};
const AssetIconWrapper = styled.div``;

const RowWrapper = styled(Link)`
color: ${Colors.textLight()};
cursor: pointer;
:hover {
&,
${AssetIconWrapper} ${IconWrapper} {
color: ${Colors.textDefault()};
text-decoration: none;
}
${AssetIconWrapper} ${IconWrapper} {
background: ${Colors.textDefault()};
text-decoration: none;
}
}
`;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I move all of this to a new file for easier testing

Copy link

github-actions bot commented Apr 16, 2025

Deploy preview for dagit-core-storybook ready!

✅ Preview
https://dagit-core-storybook-90nubwy4k-elementl.vercel.app
https://salazarm-new-catalog-page.core-storybook.dagster-docs.io

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

@@ -195,6 +188,8 @@ const Table = React.memo(
[assets],
);

// console.log({groupedByStatus, loading});
Copy link
Contributor

Choose a reason for hiding this comment

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

can remove debug log

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah yea oops

@salazarm salazarm merged commit 732373f into master Apr 16, 2025
5 of 6 checks passed
@salazarm salazarm deleted the salazarm/new-catalog-page branch April 16, 2025 14:13
jamiedemaria pushed a commit that referenced this pull request Apr 18, 2025
## Summary & Motivation

Similar to what we do
[here](https://github.com/dagster-io/dagster/blob/08aa439c5a52d3c24ff6e3e1856e2172f26bca8d/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsCatalogTable.tsx#L220)
and
[here](https://github.com/dagster-io/dagster/blob/08aa439c5a52d3c24ff6e3e1856e2172f26bca8d/js_modules/dagster-ui/packages/ui-core/src/assets/AssetsGlobalGraphRoot.tsx#L65).
Basically since this is in OSS we use that hook to signal whether or not
we're currently in the favorites view and so should use the favorited
assets.

## How I Tested These Changes

jest
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