mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-02 03:39:03 +00:00
feat(subtypes): support subtypes for charts in the UI (#9186)
This commit is contained in:
parent
399e032dfa
commit
332d4afaab
@ -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,
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
@ -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,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -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}
|
||||
|
||||
@ -100,6 +100,9 @@ query getChart($urn: String!) {
|
||||
canEditLineage
|
||||
canEditEmbed
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -165,6 +165,9 @@ fragment lineageNodeProperties on EntityWithRelationships {
|
||||
status {
|
||||
removed
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
... on Dataset {
|
||||
name
|
||||
|
||||
@ -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
|
||||
|
||||
@ -120,6 +120,7 @@ entities:
|
||||
- globalTags
|
||||
- glossaryTerms
|
||||
- browsePathsV2
|
||||
- subTypes
|
||||
- name: dashboard
|
||||
keyAspect: dashboardKey
|
||||
aspects:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user