mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-26 09:26:22 +00:00
feat(dashboard): add subTypes aspect to dashboard entity (#5843)
Co-authored-by: John Joyce <john@acryl.io>
This commit is contained in:
parent
41746690fd
commit
a407e0a370
@ -73,7 +73,8 @@ public class DashboardType implements SearchableEntityType<Dashboard, String>, B
|
||||
DOMAINS_ASPECT_NAME,
|
||||
DEPRECATION_ASPECT_NAME,
|
||||
DATA_PLATFORM_INSTANCE_ASPECT_NAME,
|
||||
INPUT_FIELDS_ASPECT_NAME
|
||||
INPUT_FIELDS_ASPECT_NAME,
|
||||
SUB_TYPES_ASPECT_NAME
|
||||
);
|
||||
private static final Set<String> FACET_FIELDS = ImmutableSet.of("access", "tool");
|
||||
|
||||
|
||||
@ -8,6 +8,7 @@ import com.linkedin.common.InputFields;
|
||||
import com.linkedin.common.InstitutionalMemory;
|
||||
import com.linkedin.common.Ownership;
|
||||
import com.linkedin.common.Status;
|
||||
import com.linkedin.common.SubTypes;
|
||||
import com.linkedin.common.urn.Urn;
|
||||
import com.linkedin.dashboard.EditableDashboardProperties;
|
||||
import com.linkedin.data.DataMap;
|
||||
@ -86,6 +87,7 @@ public class DashboardMapper implements ModelMapper<EntityResponse, Dashboard> {
|
||||
dataset.setDataPlatformInstance(DataPlatformInstanceAspectMapper.map(new DataPlatformInstance(dataMap))));
|
||||
mappingHelper.mapToResult(INPUT_FIELDS_ASPECT_NAME, (dashboard, dataMap) ->
|
||||
dashboard.setInputFields(InputFieldsMapper.map(new InputFields(dataMap), entityUrn)));
|
||||
mappingHelper.mapToResult(SUB_TYPES_ASPECT_NAME, this::mapSubTypes);
|
||||
|
||||
return mappingHelper.getResult();
|
||||
}
|
||||
@ -195,4 +197,13 @@ public class DashboardMapper implements ModelMapper<EntityResponse, Dashboard> {
|
||||
final Domains domains = new Domains(dataMap);
|
||||
dashboard.setDomain(DomainAssociationMapper.map(domains, dashboard.getUrn()));
|
||||
}
|
||||
|
||||
private void mapSubTypes(@Nonnull Dashboard dashboard, DataMap dataMap) {
|
||||
SubTypes pegasusSubTypes = new SubTypes(dataMap);
|
||||
if (pegasusSubTypes.hasTypeNames()) {
|
||||
com.linkedin.datahub.graphql.generated.SubTypes subTypes = new com.linkedin.datahub.graphql.generated.SubTypes();
|
||||
subTypes.setTypeNames(pegasusSubTypes.getTypeNames().stream().collect(Collectors.toList()));
|
||||
dashboard.setSubTypes(subTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4352,6 +4352,11 @@ type Dashboard implements EntityWithRelationships & Entity & BrowsableEntity {
|
||||
Input fields that power all the charts in the dashboard
|
||||
"""
|
||||
inputFields: InputFields
|
||||
|
||||
"""
|
||||
Sub Types of the dashboard
|
||||
"""
|
||||
subTypes: SubTypes
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
@ -22,6 +22,7 @@ import { getDataForEntityType } from '../shared/containers/profile/utils';
|
||||
import { SidebarDomainSection } from '../shared/containers/profile/sidebar/Domain/SidebarDomainSection';
|
||||
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';
|
||||
import { LineageTab } from '../shared/tabs/Lineage/LineageTab';
|
||||
import { capitalizeFirstLetterOnly } from '../../shared/textUtil';
|
||||
import { DashboardStatsSummarySubHeader } from './profile/DashboardStatsSummarySubHeader';
|
||||
import { ChartSnippet } from '../chart/ChartSnippet';
|
||||
|
||||
@ -153,9 +154,11 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
// TODO: Get rid of this once we have correctly formed platform coming back.
|
||||
const name = dashboard?.properties?.name;
|
||||
const externalUrl = dashboard?.properties?.externalUrl;
|
||||
const subTypes = dashboard?.subTypes;
|
||||
return {
|
||||
name,
|
||||
externalUrl,
|
||||
entityTypeOverride: subTypes ? capitalizeFirstLetterOnly(subTypes.typeNames?.[0]) : '',
|
||||
};
|
||||
};
|
||||
|
||||
@ -179,6 +182,7 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
statsSummary={data.statsSummary}
|
||||
lastUpdatedMs={data.properties?.lastModified?.time}
|
||||
createdMs={data.properties?.created?.time}
|
||||
subtype={data.subTypes?.typeNames?.[0]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -214,6 +218,7 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
inputFields={data.inputFields}
|
||||
/>
|
||||
}
|
||||
subtype={data.subTypes?.typeNames?.[0]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -223,6 +228,7 @@ export class DashboardEntity implements Entity<Dashboard> {
|
||||
urn: entity.urn,
|
||||
name: entity.properties?.name || '',
|
||||
type: EntityType.Dashboard,
|
||||
subtype: entity?.subTypes?.typeNames?.[0] || undefined,
|
||||
icon: entity?.platform?.properties?.logoUrl || '',
|
||||
platform: entity?.platform,
|
||||
};
|
||||
|
||||
@ -14,16 +14,17 @@ import {
|
||||
} from '../../../../types.generated';
|
||||
import DefaultPreviewCard from '../../../preview/DefaultPreviewCard';
|
||||
import { useEntityRegistry } from '../../../useEntityRegistry';
|
||||
import { capitalizeFirstLetter } from '../../../shared/textUtil';
|
||||
import { capitalizeFirstLetter, capitalizeFirstLetterOnly } from '../../../shared/textUtil';
|
||||
import { IconStyleType } from '../../Entity';
|
||||
import { DashboardStatsSummary as DashboardStatsSummaryView } from '../shared/DashboardStatsSummary';
|
||||
|
||||
export const DashboardPreview = ({
|
||||
urn,
|
||||
name,
|
||||
platformInstanceId,
|
||||
description,
|
||||
platform,
|
||||
platformInstanceId,
|
||||
name,
|
||||
subtype,
|
||||
description,
|
||||
access,
|
||||
owners,
|
||||
tags,
|
||||
@ -45,6 +46,7 @@ export const DashboardPreview = ({
|
||||
platform: string;
|
||||
platformInstanceId?: string;
|
||||
name?: string;
|
||||
subtype?: string | null;
|
||||
description?: string | null;
|
||||
access?: AccessLevel | null;
|
||||
owners?: Array<Owner> | null;
|
||||
@ -71,7 +73,7 @@ export const DashboardPreview = ({
|
||||
url={entityRegistry.getEntityUrl(EntityType.Dashboard, urn)}
|
||||
name={name || ''}
|
||||
description={description || ''}
|
||||
type="Dashboard"
|
||||
type={capitalizeFirstLetterOnly(subtype) || 'Dashboard'}
|
||||
typeIcon={entityRegistry.getIcon(EntityType.Dashboard, 14, IconStyleType.ACCENT)}
|
||||
logoUrl={logoUrl || ''}
|
||||
platformInstanceId={platformInstanceId}
|
||||
|
||||
@ -118,6 +118,7 @@ const ENTITIES_WITH_SUBTYPES = new Set([
|
||||
EntityType.Dataset.toLowerCase(),
|
||||
EntityType.Container.toLowerCase(),
|
||||
EntityType.Notebook.toLowerCase(),
|
||||
EntityType.Dashboard.toLowerCase(),
|
||||
]);
|
||||
|
||||
type EntityTypeCount = {
|
||||
|
||||
@ -121,5 +121,6 @@ export const dashboardEntity = (tool): Dashboard => {
|
||||
},
|
||||
platform: dataPlatform,
|
||||
__typename: 'Dashboard',
|
||||
subTypes: null,
|
||||
};
|
||||
};
|
||||
|
||||
@ -70,6 +70,9 @@ query getBrowseResults($input: BrowseInput!) {
|
||||
domain {
|
||||
...entityDomain
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
... on GlossaryTerm {
|
||||
ownership {
|
||||
|
||||
@ -426,6 +426,9 @@ fragment dashboardFields on Dashboard {
|
||||
inputFields {
|
||||
...inputFieldsFields
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
|
||||
fragment nonRecursiveMLFeature on MLFeature {
|
||||
|
||||
@ -123,6 +123,9 @@ fragment lineageNodeProperties on EntityWithRelationships {
|
||||
status {
|
||||
removed
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
... on Chart {
|
||||
tool
|
||||
|
||||
@ -102,6 +102,9 @@ fragment entityPreview on Entity {
|
||||
deprecation {
|
||||
...deprecationFields
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
... on Chart {
|
||||
urn
|
||||
|
||||
@ -378,6 +378,9 @@ fragment searchResultFields on Entity {
|
||||
inputFields {
|
||||
...inputFieldsFields
|
||||
}
|
||||
subTypes {
|
||||
typeNames
|
||||
}
|
||||
}
|
||||
... on Chart {
|
||||
chartId
|
||||
|
||||
@ -67,6 +67,7 @@ entities:
|
||||
- deprecation
|
||||
- dashboardUsageStatistics
|
||||
- inputFields
|
||||
- subTypes
|
||||
- name: notebook
|
||||
doc: Notebook represents a combination of query, text, chart and etc. This is in BETA version
|
||||
keyAspect: notebookKey
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user