mirror of
https://github.com/datahub-project/datahub.git
synced 2025-11-07 06:13:40 +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("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,
|
||||||
|
|||||||
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -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,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -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}
|
||||||
|
|||||||
@ -100,6 +100,9 @@ query getChart($urn: String!) {
|
|||||||
canEditLineage
|
canEditLineage
|
||||||
canEditEmbed
|
canEditEmbed
|
||||||
}
|
}
|
||||||
|
subTypes {
|
||||||
|
typeNames
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -165,6 +165,9 @@ fragment lineageNodeProperties on EntityWithRelationships {
|
|||||||
status {
|
status {
|
||||||
removed
|
removed
|
||||||
}
|
}
|
||||||
|
subTypes {
|
||||||
|
typeNames
|
||||||
|
}
|
||||||
}
|
}
|
||||||
... on Dataset {
|
... on Dataset {
|
||||||
name
|
name
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -120,6 +120,7 @@ entities:
|
|||||||
- globalTags
|
- globalTags
|
||||||
- glossaryTerms
|
- glossaryTerms
|
||||||
- browsePathsV2
|
- browsePathsV2
|
||||||
|
- subTypes
|
||||||
- name: dashboard
|
- name: dashboard
|
||||||
keyAspect: dashboardKey
|
keyAspect: dashboardKey
|
||||||
aspects:
|
aspects:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user