mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-24 08:28:12 +00:00
fix(ui): Fixing unreleased search preview bugs (#5432)
This commit is contained in:
parent
a52fac57f4
commit
ac61bcd951
@ -885,9 +885,14 @@ public class GmsGraphQLEngine {
|
||||
)
|
||||
.type("DatasetStatsSummary", typeWiring -> typeWiring
|
||||
.dataFetcher("topUsersLast30Days", new LoadableTypeBatchResolver<>(corpUserType,
|
||||
(env) -> ((DatasetStatsSummary) env.getSource()).getTopUsersLast30Days().stream()
|
||||
.map(CorpUser::getUrn)
|
||||
.collect(Collectors.toList())))
|
||||
(env) -> {
|
||||
DatasetStatsSummary summary = ((DatasetStatsSummary) env.getSource());
|
||||
return summary.getTopUsersLast30Days() != null
|
||||
? summary.getTopUsersLast30Days().stream()
|
||||
.map(CorpUser::getUrn)
|
||||
.collect(Collectors.toList())
|
||||
: null;
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
@ -1039,9 +1044,14 @@ public class GmsGraphQLEngine {
|
||||
);
|
||||
builder.type("DashboardStatsSummary", typeWiring -> typeWiring
|
||||
.dataFetcher("topUsersLast30Days", new LoadableTypeBatchResolver<>(corpUserType,
|
||||
(env) -> ((DashboardStatsSummary) env.getSource()).getTopUsersLast30Days().stream()
|
||||
.map(CorpUser::getUrn)
|
||||
.collect(Collectors.toList())))
|
||||
(env) -> {
|
||||
DashboardStatsSummary summary = ((DashboardStatsSummary) env.getSource());
|
||||
return summary.getTopUsersLast30Days() != null
|
||||
? summary.getTopUsersLast30Days().stream()
|
||||
.map(CorpUser::getUrn)
|
||||
.collect(Collectors.toList())
|
||||
: null;
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -5279,7 +5279,7 @@ type DatasetStatsSummary {
|
||||
"""
|
||||
The top users in the past 30 days
|
||||
"""
|
||||
topUsersLast30Days: [CorpUser!]!
|
||||
topUsersLast30Days: [CorpUser!]
|
||||
}
|
||||
|
||||
"""
|
||||
@ -5456,7 +5456,7 @@ type DashboardStatsSummary {
|
||||
"""
|
||||
The top users in the past 30 days
|
||||
"""
|
||||
topUsersLast30Days: [CorpUser!]!
|
||||
topUsersLast30Days: [CorpUser!]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,18 +1,53 @@
|
||||
import { Popover, Typography } from 'antd';
|
||||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { CorpGroup, CorpUser } from '../../../../../types.generated';
|
||||
import { ExpandedActor } from './ExpandedActor';
|
||||
|
||||
const PopoverActors = styled.div``;
|
||||
|
||||
const ActorsContainer = styled.div`
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
`;
|
||||
|
||||
const RemainderText = styled(Typography.Text)`
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
margin-right: 8px;
|
||||
`;
|
||||
|
||||
type Props = {
|
||||
actors: Array<CorpUser | CorpGroup>;
|
||||
max: number;
|
||||
onClose?: (actor: CorpUser | CorpGroup) => void;
|
||||
};
|
||||
|
||||
export const ExpandedActorGroup = ({ actors, onClose }: Props) => {
|
||||
const DEFAULT_MAX = 10;
|
||||
|
||||
export const ExpandedActorGroup = ({ actors, max = DEFAULT_MAX, onClose }: Props) => {
|
||||
const finalActors = actors.length > max ? actors.slice(0, max) : actors;
|
||||
const remainder = actors.length > max ? actors.length - max : undefined;
|
||||
|
||||
return (
|
||||
<>
|
||||
{actors.map((actor) => (
|
||||
<ExpandedActor key={actor.urn} actor={actor} onClose={() => onClose?.(actor)} />
|
||||
))}
|
||||
</>
|
||||
<Popover
|
||||
placement="left"
|
||||
content={
|
||||
<PopoverActors>
|
||||
{actors.map((actor) => (
|
||||
<ExpandedActor key={actor.urn} actor={actor} onClose={() => onClose?.(actor)} />
|
||||
))}
|
||||
</PopoverActors>
|
||||
}
|
||||
>
|
||||
<ActorsContainer>
|
||||
{finalActors.map((actor) => (
|
||||
<ExpandedActor key={actor.urn} actor={actor} onClose={() => onClose?.(actor)} />
|
||||
))}
|
||||
</ActorsContainer>
|
||||
{remainder && <RemainderText type="secondary">+ {remainder} more</RemainderText>}
|
||||
</Popover>
|
||||
);
|
||||
};
|
||||
|
||||
@ -113,7 +113,7 @@ export const EntityHeader = ({ refreshBrowser, headerDropdownItems, isNameEditab
|
||||
<PlatformContent />
|
||||
<TitleWrapper>
|
||||
<EntityName isNameEditable={canEditName} />
|
||||
{entityData?.deprecation && (
|
||||
{entityData?.deprecation?.deprecated && (
|
||||
<DeprecationPill deprecation={entityData?.deprecation} preview={isCompact} />
|
||||
)}
|
||||
{entityData?.health?.map((health) => (
|
||||
|
||||
@ -148,7 +148,7 @@ const UserListContainer = styled.div`
|
||||
|
||||
const UserListDivider = styled(Divider)`
|
||||
padding: 4px;
|
||||
height: 60px;
|
||||
height: auto;
|
||||
`;
|
||||
|
||||
const UserListTitle = styled(Typography.Text)`
|
||||
@ -266,7 +266,7 @@ export default function DefaultPreviewCard({
|
||||
{name || ' '}
|
||||
</EntityTitle>
|
||||
</Link>
|
||||
{deprecation && <DeprecationPill deprecation={deprecation} preview />}
|
||||
{deprecation?.deprecated && <DeprecationPill deprecation={deprecation} preview />}
|
||||
{externalUrl && (
|
||||
<ExternalUrlContainer>
|
||||
<ExternalUrlButton type="link" href={externalUrl} target="_blank">
|
||||
@ -324,22 +324,22 @@ export default function DefaultPreviewCard({
|
||||
)}
|
||||
</LeftColumn>
|
||||
<RightColumn>
|
||||
{topUsers && topUsers.length > 0 && (
|
||||
{topUsers && topUsers?.length > 0 && (
|
||||
<>
|
||||
<UserListContainer>
|
||||
<UserListTitle strong>Top Users</UserListTitle>
|
||||
<div>
|
||||
<ExpandedActorGroup actors={topUsers} />
|
||||
<ExpandedActorGroup actors={topUsers} max={2} />
|
||||
</div>
|
||||
</UserListContainer>
|
||||
<UserListDivider type="vertical" />
|
||||
</>
|
||||
)}
|
||||
{owners && owners.length > 0 && (
|
||||
{(topUsers?.length || 0) > 0 && (owners?.length || 0) > 0 && <UserListDivider type="vertical" />}
|
||||
{owners && owners?.length > 0 && (
|
||||
<UserListContainer>
|
||||
<UserListTitle strong>Owners</UserListTitle>
|
||||
<div>
|
||||
<ExpandedActorGroup actors={owners.map((owner) => owner.owner)} />
|
||||
<ExpandedActorGroup actors={owners.map((owner) => owner.owner)} max={2} />
|
||||
</div>
|
||||
</UserListContainer>
|
||||
)}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user