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

fix(ui): update default preview component with new ui design #4783

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions datahub-web-react/src/app/preview/DefaultPreviewCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ const PlatformDivider = styled.div`
`;

const DescriptionContainer = styled.div`
margin-top: 5px;
color: ${ANTD_GRAY[7]};
`;

Expand All @@ -88,9 +87,15 @@ const AvatarContainer = styled.div`
`;

const TagContainer = styled.div`
display: inline-block;
display: inline-flex;
margin-left: 0px;
margin-top: -2px;
margin-top: 5px;
`;

const TagSeparator = styled.div`
margin: 2px 8px 0 0;
height: 17px;
border-right: 1px solid #cccccc;
`;

const InsightContainer = styled.div`
Expand Down Expand Up @@ -241,20 +246,19 @@ export default function DefaultPreviewCard({
{name || ' '}
</EntityTitle>
</Link>
<TagContainer>
<TagTermGroup
domain={domain}
uneditableGlossaryTerms={glossaryTerms}
uneditableTags={tags}
maxShow={3}
/>
</TagContainer>
</TitleContainer>
{description && description.length > 0 && (
<DescriptionContainer>
<NoMarkdownViewer limit={200}>{description}</NoMarkdownViewer>
</DescriptionContainer>
)}
<TagContainer>
<TagTermGroup domain={domain} maxShow={3} />
{domain && <TagSeparator />}
<TagTermGroup uneditableGlossaryTerms={glossaryTerms} maxShow={3} />
{tags && <TagSeparator />}
<TagTermGroup uneditableTags={tags} maxShow={3} />
</TagContainer>
{owners && owners.length > 0 && (
<AvatarContainer>
<AvatarsGroup size={28} owners={owners} entityRegistry={entityRegistry} maxCount={4} />
Expand Down
43 changes: 34 additions & 9 deletions datahub-web-react/src/app/shared/tags/TagTermGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useEntityRegistry } from '../../useEntityRegistry';
import { Domain, EntityType, GlobalTags, GlossaryTerms, SubResourceType } from '../../../types.generated';
import AddTagTermModal from './AddTagTermModal';
import { StyledTag } from '../../entity/shared/components/styled/StyledTag';
import { EMPTY_MESSAGES } from '../../entity/shared/constants';
import { EMPTY_MESSAGES, ANTD_GRAY } from '../../entity/shared/constants';
import { useRemoveTagMutation, useRemoveTermMutation } from '../../../graphql/mutations.generated';
import { DomainLink } from './DomainLink';
import { TagProfileDrawer } from './TagProfileDrawer';
Expand Down Expand Up @@ -52,6 +52,10 @@ const NoElementButton = styled(Button)`
}
`;

const TagText = styled.span`
color: ${ANTD_GRAY[7]};
`;

export default function TagTermGroup({
uneditableTags,
editableTags,
Expand Down Expand Up @@ -173,14 +177,30 @@ export default function TagTermGroup({
{domain && (
<DomainLink urn={domain.urn} name={entityRegistry.getDisplayName(EntityType.Domain, domain) || ''} />
)}
{uneditableGlossaryTerms?.terms?.map((term) => (
<TermLink to={entityRegistry.getEntityUrl(EntityType.GlossaryTerm, term.term.urn)} key={term.term.urn}>
<Tag closable={false}>
<BookOutlined style={{ marginRight: '3%' }} />
{entityRegistry.getDisplayName(EntityType.GlossaryTerm, term.term)}
</Tag>
</TermLink>
))}
{uneditableGlossaryTerms?.terms?.map((term) => {
renderedTags += 1;
if (maxShow && renderedTags === maxShow + 1)
return (
<TagText>
{uneditableGlossaryTerms?.terms
? `+${uneditableGlossaryTerms?.terms?.length - maxShow}`
: null}
</TagText>
);
if (maxShow && renderedTags > maxShow) return null;

return (
<TermLink
to={entityRegistry.getEntityUrl(EntityType.GlossaryTerm, term.term.urn)}
key={term.term.urn}
>
<Tag closable={false}>
<BookOutlined style={{ marginRight: '3%' }} />
{entityRegistry.getDisplayName(EntityType.GlossaryTerm, term.term)}
</Tag>
</TermLink>
);
})}
{editableGlossaryTerms?.terms?.map((term) => (
<TermLink to={entityRegistry.getEntityUrl(EntityType.GlossaryTerm, term.term.urn)} key={term.term.urn}>
<Tag
Expand All @@ -198,7 +218,12 @@ export default function TagTermGroup({
{/* uneditable tags are provided by ingestion pipelines exclusively */}
{uneditableTags?.tags?.map((tag) => {
renderedTags += 1;
if (maxShow && renderedTags === maxShow + 1)
return (
<TagText>{uneditableTags?.tags ? `+${uneditableTags?.tags?.length - maxShow}` : null}</TagText>
);
if (maxShow && renderedTags > maxShow) return null;

return (
<TagLink key={tag?.tag?.urn}>
<StyledTag
Expand Down