Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public class DatasetType
SUB_TYPES_ASPECT_NAME,
APPLICATION_MEMBERSHIP_ASPECT_NAME,
VERSION_PROPERTIES_ASPECT_NAME,
LOGICAL_PARENT_ASPECT_NAME);
LOGICAL_PARENT_ASPECT_NAME,
ASSET_SETTINGS_ASPECT_NAME);

private static final Set<String> FACET_FIELDS = ImmutableSet.of("origin", "platform");
private static final String ENTITY_NAME = "dataset";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import com.linkedin.datahub.graphql.generated.EntityType;
import com.linkedin.datahub.graphql.generated.FabricType;
import com.linkedin.datahub.graphql.types.application.ApplicationAssociationMapper;
import com.linkedin.datahub.graphql.types.common.mappers.AssetSettingsMapper;
import com.linkedin.datahub.graphql.types.common.mappers.BrowsePathsV2Mapper;
import com.linkedin.datahub.graphql.types.common.mappers.CustomPropertiesMapper;
import com.linkedin.datahub.graphql.types.common.mappers.DataPlatformInstanceAspectMapper;
Expand Down Expand Up @@ -65,6 +66,7 @@
import com.linkedin.metadata.key.DatasetKey;
import com.linkedin.schema.EditableSchemaMetadata;
import com.linkedin.schema.SchemaMetadata;
import com.linkedin.settings.asset.AssetSettings;
import com.linkedin.structured.StructuredProperties;
import java.util.Optional;
import javax.annotation.Nonnull;
Expand Down Expand Up @@ -209,6 +211,10 @@ public Dataset apply(
logicalParent ->
UrnToEntityMapper.map(context, logicalParent.getDestinationUrn()))
.orElse(null)));
mappingHelper.mapToResult(
ASSET_SETTINGS_ASPECT_NAME,
((entity, dataMap) ->
entity.setSettings(AssetSettingsMapper.map(new AssetSettings(dataMap)))));

if (context != null && !canView(context.getOperationContext(), entityUrn)) {
return AuthorizationUtils.restrictEntity(mappingHelper.getResult(), Dataset.class);
Expand Down
7 changes: 7 additions & 0 deletions datahub-graphql-core/src/main/resources/settings.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,10 @@ extend type GlossaryNode {
"""
settings: AssetSettings
}

extend type Dataset {
"""
Settings associated with this asset
"""
settings: AssetSettings
}
3 changes: 3 additions & 0 deletions datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export const dataset1 = {
structuredProperties: null,
forms: null,
activeIncidents: null,
settings: null,
};

export const dataset2 = {
Expand Down Expand Up @@ -460,6 +461,7 @@ export const dataset2 = {
structuredProperties: null,
forms: null,
activeIncidents: null,
settings: null,
};

export const dataset3 = {
Expand Down Expand Up @@ -725,6 +727,7 @@ export const dataset3 = {
upstream: null,
downstream: null,
versionProperties: null,
settings: null,
} as Dataset;

export const dataset3WithSchema = {
Expand Down
275 changes: 148 additions & 127 deletions datahub-web-react/src/app/entityV2/dataset/DatasetEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { getDataForEntityType } from '@app/entityV2/shared/containers/profile/ut
import EmbeddedProfile from '@app/entityV2/shared/embed/EmbeddedProfile';
import SidebarNotesSection from '@app/entityV2/shared/sidebarSection/SidebarNotesSection';
import SidebarStructuredProperties from '@app/entityV2/shared/sidebarSection/SidebarStructuredProperties';
import { SUMMARY_TAB_ICON } from '@app/entityV2/shared/summary/HeaderComponents';
import AccessManagement from '@app/entityV2/shared/tabs/Dataset/AccessManagement/AccessManagement';
import QueriesTab from '@app/entityV2/shared/tabs/Dataset/Queries/QueriesTab';
import { SchemaTab } from '@app/entityV2/shared/tabs/Dataset/Schema/SchemaTab';
Expand All @@ -54,12 +55,15 @@ import { EmbedTab } from '@app/entityV2/shared/tabs/Embed/EmbedTab';
import { IncidentTab } from '@app/entityV2/shared/tabs/Incident/IncidentTab';
import { LineageTab } from '@app/entityV2/shared/tabs/Lineage/LineageTab';
import { PropertiesTab } from '@app/entityV2/shared/tabs/Properties/PropertiesTab';
import { EntityTab } from '@app/entityV2/shared/types';
import {
SidebarTitleActionType,
getDatasetLastUpdatedMs,
getFirstSubType,
isOutputPort,
} from '@app/entityV2/shared/utils';
import SummaryTab from '@app/entityV2/summary/SummaryTab';
import { useShowDatasetSummaryPage } from '@app/entityV2/summary/useShowDatasetSummaryPage';
import { DBT_URN } from '@app/ingest/source/builder/constants';
import { MatchedFieldList } from '@app/searchV2/matches/MatchedFieldList';
import { matchedFieldPathsRenderer } from '@app/searchV2/matches/matchedFieldPathsRenderer';
Expand Down Expand Up @@ -147,133 +151,7 @@ export class DatasetEntity implements Entity<Dataset> {
subHeader={{
component: DatasetStatsSummarySubHeader,
}}
tabs={[
{
name: 'Columns',
component: SchemaTab,
icon: LayoutOutlined,
getCount: useGetColumnTabCount,
},
{
name: 'View Definition',
component: ViewDefinitionTab,
icon: CodeOutlined,
display: {
visible: (_, dataset: GetDatasetQuery) =>
!!dataset?.dataset?.viewProperties?.logic ||
!!dataset?.dataset?.subTypes?.typeNames
?.map((t) => t.toLocaleLowerCase())
.includes(SUBTYPES.VIEW.toLocaleLowerCase()),
enabled: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.viewProperties?.logic,
},
},
{
name: 'Documentation',
component: DocumentationTab,
icon: FileOutlined,
},
{
name: 'Preview',
component: EmbedTab,
icon: EyeOutlined,
display: {
visible: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.embed?.renderUrl,
enabled: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.embed?.renderUrl,
},
},
{
name: 'Lineage',
component: LineageTab,
icon: PartitionOutlined,
},
{
name: 'Access',
component: AccessManagement,
icon: UnlockOutlined,
display: {
visible: (_, _1) => this.appconfig().config.featureFlags.showAccessManagement,
enabled: (_, _2) => true,
},
},
{
name: 'Properties',
component: PropertiesTab,
icon: UnorderedListOutlined,
getCount: (_, dataset: GetDatasetQuery) => {
const customPropertiesCount = dataset?.dataset?.properties?.customProperties?.length || 0;
const structuredPropertiesCount =
dataset?.dataset?.structuredProperties?.properties?.length || 0;
const propertiesCount = customPropertiesCount + structuredPropertiesCount;
return propertiesCount;
},
},
{
name: 'Queries',
component: QueriesTab,
icon: ConsoleSqlOutlined,
display: {
visible: (_, _1) => true,
enabled: (_, _2) => true,
},
},
{
name: 'Stats',
component: StatsTabWrapper,
icon: FundOutlined,
display: {
visible: (_, _1) => true,
enabled: (_, dataset: GetDatasetQuery) =>
(dataset?.dataset?.latestFullTableProfile?.length || 0) > 0 ||
(dataset?.dataset?.latestPartitionProfile?.length || 0) > 0 ||
(dataset?.dataset?.usageStats?.buckets?.length || 0) > 0 ||
(dataset?.dataset?.operations?.length || 0) > 0,
},
},
{
name: QUALITY_TAB_NAME,
component: AcrylValidationsTab, // Use SaaS specific Validations Tab.
icon: CheckCircleOutlined,
},
{
name: GOVERNANCE_TAB_NAME,
icon: () => (
<span
style={{
marginRight: 6,
verticalAlign: '-0.2em',
}}
>
<GovernMenuIcon width={16} height={16} fill="currentColor" />
</span>
),
component: GovernanceTab,
getCount: (_, dataset) => {
const passingTests = dataset?.dataset?.testResults?.passing || [];
const failingTests = dataset?.dataset?.testResults?.failing || [];
return passingTests.length + failingTests.length;
},
},
{
name: 'Runs', // TODO: Rename this to DatasetRunsTab.
component: OperationsTab,
display: {
visible: (_, dataset: GetDatasetQuery) => {
return (dataset?.dataset?.runs?.total || 0) > 0;
},
enabled: (_, dataset: GetDatasetQuery) => {
return (dataset?.dataset?.runs?.total || 0) > 0;
},
},
},
{
name: 'Incidents',
icon: WarningOutlined,
component: IncidentTab,
getCount: (_, dataset) => {
return dataset?.dataset?.activeIncidents?.total;
},
},
]}
tabs={this.getProfileTabs()}
sidebarSections={this.getSidebarSections()}
sidebarTabs={this.getSidebarTabs()}
/>
Expand Down Expand Up @@ -377,6 +255,149 @@ export class DatasetEntity implements Entity<Dataset> {
};
};

getProfileTabs = (): EntityTab[] => {
const showSummaryTab = useShowDatasetSummaryPage();
return [
...(showSummaryTab
? [
{
name: 'Summary',
component: SummaryTab,
icon: SUMMARY_TAB_ICON,
},
]
: []),
{
name: 'Columns',
component: SchemaTab,
icon: LayoutOutlined,
getCount: useGetColumnTabCount,
},
{
name: 'View Definition',
component: ViewDefinitionTab,
icon: CodeOutlined,
display: {
visible: (_, dataset: GetDatasetQuery) =>
!!dataset?.dataset?.viewProperties?.logic ||
!!dataset?.dataset?.subTypes?.typeNames
?.map((t) => t.toLocaleLowerCase())
.includes(SUBTYPES.VIEW.toLocaleLowerCase()),
enabled: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.viewProperties?.logic,
},
},
...(!showSummaryTab
? [
{
name: 'Documentation',
component: DocumentationTab,
icon: FileOutlined,
},
]
: []),
{
name: 'Preview',
component: EmbedTab,
icon: EyeOutlined,
display: {
visible: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.embed?.renderUrl,
enabled: (_, dataset: GetDatasetQuery) => !!dataset?.dataset?.embed?.renderUrl,
},
},
{
name: 'Lineage',
component: LineageTab,
icon: PartitionOutlined,
},
{
name: 'Access',
component: AccessManagement,
icon: UnlockOutlined,
display: {
visible: (_, _1) => this.appconfig().config.featureFlags.showAccessManagement,
enabled: (_, _2) => true,
},
},
{
name: 'Properties',
component: PropertiesTab,
icon: UnorderedListOutlined,
getCount: (_, dataset: GetDatasetQuery) => {
const customPropertiesCount = dataset?.dataset?.properties?.customProperties?.length || 0;
const structuredPropertiesCount = dataset?.dataset?.structuredProperties?.properties?.length || 0;
const propertiesCount = customPropertiesCount + structuredPropertiesCount;
return propertiesCount;
},
},
{
name: 'Queries',
component: QueriesTab,
icon: ConsoleSqlOutlined,
display: {
visible: (_, _1) => true,
enabled: (_, _2) => true,
},
},
{
name: 'Stats',
component: StatsTabWrapper,
icon: FundOutlined,
display: {
visible: (_, _1) => true,
enabled: (_, dataset: GetDatasetQuery) =>
(dataset?.dataset?.latestFullTableProfile?.length || 0) > 0 ||
(dataset?.dataset?.latestPartitionProfile?.length || 0) > 0 ||
(dataset?.dataset?.usageStats?.buckets?.length || 0) > 0 ||
(dataset?.dataset?.operations?.length || 0) > 0,
},
},
{
name: QUALITY_TAB_NAME,
component: AcrylValidationsTab, // Use SaaS specific Validations Tab.
icon: CheckCircleOutlined,
},
{
name: GOVERNANCE_TAB_NAME,
icon: () => (
<span
style={{
marginRight: 6,
verticalAlign: '-0.2em',
}}
>
<GovernMenuIcon width={16} height={16} fill="currentColor" />
</span>
),
component: GovernanceTab,
getCount: (_, dataset) => {
const passingTests = dataset?.dataset?.testResults?.passing || [];
const failingTests = dataset?.dataset?.testResults?.failing || [];
return passingTests.length + failingTests.length;
},
},
{
name: 'Runs', // TODO: Rename this to DatasetRunsTab.
component: OperationsTab,
display: {
visible: (_, dataset: GetDatasetQuery) => {
return (dataset?.dataset?.runs?.total || 0) > 0;
},
enabled: (_, dataset: GetDatasetQuery) => {
return (dataset?.dataset?.runs?.total || 0) > 0;
},
},
},
{
name: 'Incidents',
icon: WarningOutlined,
component: IncidentTab,
getCount: (_, dataset) => {
return dataset?.dataset?.activeIncidents?.total;
},
},
];
};

renderPreview = (previewType: PreviewType, data: Dataset) => {
const genericProperties = this.getGenericEntityProperties(data);
const platformNames = genericProperties?.siblingPlatforms?.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('useBasicAssetProperties', () => {
});

it('should return an empty array for other entity types', () => {
(useEntityContext as any).mockReturnValue({ entityType: EntityType.Dataset });
(useEntityContext as any).mockReturnValue({ entityType: EntityType.Chart });
const { result } = renderHook(() => useBasicAssetProperties());
expect(result.current).toEqual([]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export default function useBasicAssetProperties() {
return [CREATED_PROPERTY, OWNERS_PROPERTY];
case EntityType.DataProduct:
return [CREATED_PROPERTY, OWNERS_PROPERTY, DOMAIN_PROPERTY, TAGS_PROPERTY, TERMS_PROPERTY];
case EntityType.Dataset:
return [CREATED_PROPERTY, OWNERS_PROPERTY, DOMAIN_PROPERTY, TAGS_PROPERTY, TERMS_PROPERTY];
default:
return [];
}
Expand Down
Loading
Loading