feat(subtypes): support subtypes for charts in the UI (#9186)

This commit is contained in:
Gabe Lyons 2023-11-08 10:22:09 -08:00 committed by GitHub
parent 399e032dfa
commit 332d4afaab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 1 deletions

View File

@ -1433,6 +1433,10 @@ public class GmsGraphQLEngine {
.dataFetcher("statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService)) .dataFetcher("statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient)) .dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService)) .dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("subTypes", new SubTypesResolver(
this.entityClient,
"chart",
"subTypes"))
); );
builder.type("ChartInfo", typeWiring -> typeWiring builder.type("ChartInfo", typeWiring -> typeWiring
.dataFetcher("inputs", new LoadableTypeBatchResolver<>(datasetType, .dataFetcher("inputs", new LoadableTypeBatchResolver<>(datasetType,

View File

@ -5249,6 +5249,11 @@ type Chart implements EntityWithRelationships & Entity & BrowsableEntity {
Whether or not this entity exists on DataHub Whether or not this entity exists on DataHub
""" """
exists: Boolean exists: Boolean
"""
Sub Types that this entity implements
"""
subTypes: SubTypes
} }
""" """

View File

@ -154,10 +154,12 @@ export class ChartEntity implements Entity<Chart> {
getOverridePropertiesFromEntity = (chart?: Chart | null): GenericEntityProperties => { getOverridePropertiesFromEntity = (chart?: Chart | null): GenericEntityProperties => {
// TODO: Get rid of this once we have correctly formed platform coming back. // TODO: Get rid of this once we have correctly formed platform coming back.
const name = chart?.properties?.name; const name = chart?.properties?.name;
const subTypes = chart?.subTypes;
const externalUrl = chart?.properties?.externalUrl; const externalUrl = chart?.properties?.externalUrl;
return { return {
name, name,
externalUrl, externalUrl,
entityTypeOverride: subTypes ? capitalizeFirstLetterOnly(subTypes.typeNames?.[0]) : '',
}; };
}; };
@ -187,6 +189,7 @@ export class ChartEntity implements Entity<Chart> {
return ( return (
<ChartPreview <ChartPreview
urn={data.urn} urn={data.urn}
subType={data.subTypes?.typeNames?.[0]}
platform={data?.platform?.properties?.displayName || capitalizeFirstLetterOnly(data?.platform?.name)} platform={data?.platform?.properties?.displayName || capitalizeFirstLetterOnly(data?.platform?.name)}
platformInstanceId={data.dataPlatformInstance?.instanceId} platformInstanceId={data.dataPlatformInstance?.instanceId}
name={data.properties?.name} name={data.properties?.name}
@ -222,6 +225,7 @@ export class ChartEntity implements Entity<Chart> {
type: EntityType.Chart, type: EntityType.Chart,
icon: entity?.platform?.properties?.logoUrl || undefined, icon: entity?.platform?.properties?.logoUrl || undefined,
platform: entity?.platform, platform: entity?.platform,
subtype: entity?.subTypes?.typeNames?.[0] || undefined,
}; };
}; };

View File

@ -15,6 +15,7 @@ import {
EntityPath, EntityPath,
} from '../../../../types.generated'; } from '../../../../types.generated';
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard'; import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
import { capitalizeFirstLetterOnly } from '../../../shared/textUtil';
import { useEntityRegistry } from '../../../useEntityRegistry'; import { useEntityRegistry } from '../../../useEntityRegistry';
import { IconStyleType } from '../../Entity'; import { IconStyleType } from '../../Entity';
import { ChartStatsSummary as ChartStatsSummaryView } from '../shared/ChartStatsSummary'; import { ChartStatsSummary as ChartStatsSummaryView } from '../shared/ChartStatsSummary';
@ -43,6 +44,7 @@ export const ChartPreview = ({
snippet, snippet,
degree, degree,
paths, paths,
subType,
}: { }: {
urn: string; urn: string;
platform?: string; platform?: string;
@ -67,6 +69,7 @@ export const ChartPreview = ({
snippet?: React.ReactNode | null; snippet?: React.ReactNode | null;
degree?: number; degree?: number;
paths?: EntityPath[]; paths?: EntityPath[];
subType?: string | null;
}): JSX.Element => { }): JSX.Element => {
const entityRegistry = useEntityRegistry(); const entityRegistry = useEntityRegistry();
@ -76,7 +79,7 @@ export const ChartPreview = ({
name={name || ''} name={name || ''}
urn={urn} urn={urn}
description={description || ''} description={description || ''}
type="Chart" type={capitalizeFirstLetterOnly(subType) || 'Chart'}
typeIcon={entityRegistry.getIcon(EntityType.Chart, 14, IconStyleType.ACCENT)} typeIcon={entityRegistry.getIcon(EntityType.Chart, 14, IconStyleType.ACCENT)}
logoUrl={logoUrl || ''} logoUrl={logoUrl || ''}
platform={platform} platform={platform}

View File

@ -100,6 +100,9 @@ query getChart($urn: String!) {
canEditLineage canEditLineage
canEditEmbed canEditEmbed
} }
subTypes {
typeNames
}
} }
} }

View File

@ -165,6 +165,9 @@ fragment lineageNodeProperties on EntityWithRelationships {
status { status {
removed removed
} }
subTypes {
typeNames
}
} }
... on Dataset { ... on Dataset {
name name

View File

@ -105,6 +105,9 @@ fragment autoCompleteFields on Entity {
parentContainers { parentContainers {
...parentContainersFields ...parentContainersFields
} }
subTypes {
typeNames
}
} }
... on DataFlow { ... on DataFlow {
orchestrator orchestrator
@ -550,6 +553,9 @@ fragment searchResultFields on Entity {
} }
} }
} }
subTypes {
typeNames
}
} }
... on DataFlow { ... on DataFlow {
flowId flowId

View File

@ -120,6 +120,7 @@ entities:
- globalTags - globalTags
- glossaryTerms - glossaryTerms
- browsePathsV2 - browsePathsV2
- subTypes
- name: dashboard - name: dashboard
keyAspect: dashboardKey keyAspect: dashboardKey
aspects: aspects: