-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(subtypes): support subtypes for charts in the UI #9186
feat(subtypes): support subtypes for charts in the UI #9186
Conversation
const externalUrl = chart?.properties?.externalUrl; | ||
return { | ||
name, | ||
externalUrl, | ||
entityTypeOverride: subTypes ? capitalizeFirstLetterOnly(subTypes.typeNames?.[0]) : '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be || Chart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. null entity type override is safe. see https://github.com/datahub-project/datahub/blob/master/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx#L247
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOverridePropertiesFromEntity = (dataset?: Dataset | null): GenericEntityProperties => {
// if dataset has subTypes filled out, pick the most specific subtype and return it
const subTypes = dataset?.subTypes;
const extendedProperties: DatasetProperties | undefined | null = dataset?.properties && {
...dataset?.properties,
qualifiedName: dataset?.properties?.qualifiedName || this.displayName(dataset),
};
return {
name: dataset && this.displayName(dataset),
externalUrl: dataset?.properties?.externalUrl,
entityTypeOverride: subTypes ? capitalizeFirstLetterOnly(subTypes.typeNames?.[0]) : '',
properties: extendedProperties,
};
};
@@ -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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit weird that the "t' in this is lower cased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is existing code. its intentional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
subtype: entity?.subTypes?.typeNames?.[0] || undefined, |
@@ -76,7 +79,7 @@ export const ChartPreview = ({ | |||
name={name || ''} | |||
urn={urn} | |||
description={description || ''} | |||
type="Chart" | |||
type={capitalizeFirstLetterOnly(subType) || 'Chart'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does capitalizeFirstLetterOnly handle case of undefined | null/
im assuming yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 🖖
return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comments please check first
Supports subtypes in UI for charts on search, entity page & lineage
Checklist