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("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("subTypes", new SubTypesResolver(
this.entityClient,
"chart",
"subTypes"))
);
builder.type("ChartInfo", typeWiring -> typeWiring
.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
"""
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 => {
// TODO: Get rid of this once we have correctly formed platform coming back.
const name = chart?.properties?.name;
const subTypes = chart?.subTypes;
const externalUrl = chart?.properties?.externalUrl;
return {
name,
externalUrl,
entityTypeOverride: subTypes ? capitalizeFirstLetterOnly(subTypes.typeNames?.[0]) : '',
};
};
@ -187,6 +189,7 @@ export class ChartEntity implements Entity<Chart> {
return (
<ChartPreview
urn={data.urn}
subType={data.subTypes?.typeNames?.[0]}
platform={data?.platform?.properties?.displayName || capitalizeFirstLetterOnly(data?.platform?.name)}
platformInstanceId={data.dataPlatformInstance?.instanceId}
name={data.properties?.name}
@ -222,6 +225,7 @@ export class ChartEntity implements Entity<Chart> {
type: EntityType.Chart,
icon: entity?.platform?.properties?.logoUrl || undefined,
platform: entity?.platform,
subtype: entity?.subTypes?.typeNames?.[0] || undefined,
};
};

View File

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

View File

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

View File

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

View File

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

View File

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