Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 authored Aug 1, 2022
2 parents 52cd544 + d9d7764 commit 474407c
Show file tree
Hide file tree
Showing 83 changed files with 3,305 additions and 725 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
import com.linkedin.datahub.graphql.generated.IngestionConfig;
import com.linkedin.datahub.graphql.generated.IngestionSchedule;
import com.linkedin.datahub.graphql.generated.IngestionSource;
import com.linkedin.datahub.graphql.generated.StructuredReport;
import com.linkedin.datahub.graphql.types.common.mappers.StringMapMapper;
import com.linkedin.entity.EntityResponse;
import com.linkedin.entity.EnvelopedAspect;
import com.linkedin.entity.EnvelopedAspectMap;
import com.linkedin.execution.ExecutionRequestInput;
import com.linkedin.execution.ExecutionRequestResult;
import com.linkedin.execution.ExecutionRequestSource;
import com.linkedin.execution.StructuredExecutionReport;
import com.linkedin.ingestion.DataHubIngestionSourceConfig;
import com.linkedin.ingestion.DataHubIngestionSourceInfo;
import com.linkedin.ingestion.DataHubIngestionSourceSchedule;
Expand Down Expand Up @@ -77,9 +79,20 @@ public static com.linkedin.datahub.graphql.generated.ExecutionRequestResult mapE
result.setStartTimeMs(execRequestResult.getStartTimeMs());
result.setDurationMs(execRequestResult.getDurationMs());
result.setReport(execRequestResult.getReport());
if (execRequestResult.hasStructuredReport()) {
result.setStructuredReport(mapStructuredReport(execRequestResult.getStructuredReport()));
}
return result;
}

public static StructuredReport mapStructuredReport(final StructuredExecutionReport structuredReport) {
StructuredReport structuredReportResult = new StructuredReport();
structuredReportResult.setType(structuredReport.getType());
structuredReportResult.setSerializedValue(structuredReport.getSerializedValue());
structuredReportResult.setContentType(structuredReport.getContentType());
return structuredReportResult;
}

public static List<IngestionSource> mapIngestionSources(final Collection<EntityResponse> entities) {
final List<IngestionSource> results = new ArrayList<>();
for (EntityResponse response : entities) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public CompletableFuture<String> get(final DataFetchingEnvironment environment)

Map<String, String> arguments = new HashMap<>();
arguments.put(RECIPE_ARG_NAME, input.getRecipe());
arguments.put(VERSION_ARG_NAME, _ingestionConfiguration.getDefaultCliVersion());
execInput.setArgs(new StringMap(arguments));

proposal.setEntityType(Constants.EXECUTION_REQUEST_ENTITY_NAME);
Expand Down
23 changes: 23 additions & 0 deletions datahub-graphql-core/src/main/resources/ingestion.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,29 @@ type ExecutionRequestResult {
"""
report: String

"""
A structured report for this Execution Request
"""
structuredReport: StructuredReport

}

"""
A flexible carrier for structured results of an execution request.
"""
type StructuredReport {
"""
The type of the structured report. (e.g. INGESTION_REPORT, TEST_CONNECTION_REPORT, etc.)
"""
type: String!
"""
The serialized value of the structured report
"""
serializedValue: String!
"""
The content-type of the serialized value (e.g. application/json, application/json;gzip etc.)
"""
contentType: String!
}

"""
Expand Down
35 changes: 35 additions & 0 deletions datahub-web-react/src/app/entity/Entity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@ export enum IconStyleType {
SVG,
}

/**
* A standard set of Entity Capabilities that span across entity types.
*/
export enum EntityCapabilityType {
/**
* Ownership of an entity
*/
OWNERS,
/**
* Adding a glossary term to the entity
*/
GLOSSARY_TERMS,
/**
* Adding a tag to an entity
*/
TAGS,
/**
* Assigning the entity to a domain
*/
DOMAINS,
/**
* Deprecating an entity
*/
DEPRECATION,
/**
* Soft deleting an entity
*/
SOFT_DELETE,
}

/**
* Base interface used for authoring DataHub Entities on the client side.
*
Expand Down Expand Up @@ -124,4 +154,9 @@ export interface Entity<T> {
* Returns generic entity properties for the entity
*/
getGenericEntityProperties: (data: T) => GenericEntityProperties | null;

/**
* Returns the supported features for the entity
*/
supportedCapabilities: () => Set<EntityCapabilityType>;
}
15 changes: 14 additions & 1 deletion datahub-web-react/src/app/entity/EntityRegistry.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Entity as EntityInterface, EntityType, SearchResult } from '../../types.generated';
import { FetchedEntity } from '../lineage/types';
import { Entity, IconStyleType, PreviewType } from './Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from './Entity';
import { GenericEntityProperties } from './shared/types';
import { dictToQueryStringParams, urlEncodeUrn } from './shared/utils';

Expand Down Expand Up @@ -153,4 +153,17 @@ export default class EntityRegistry {
const entity = validatedGet(type, this.entityTypeToEntity);
return entity.getGenericEntityProperties(data);
}

getSupportedEntityCapabilities(type: EntityType): Set<EntityCapabilityType> {
const entity = validatedGet(type, this.entityTypeToEntity);
return entity.supportedCapabilities();
}

getTypesWithSupportedCapabilities(capability: EntityCapabilityType): Set<EntityType> {
return new Set(
this.getEntities()
.filter((entity) => entity.supportedCapabilities().has(capability))
.map((entity) => entity.type),
);
}
}
13 changes: 12 additions & 1 deletion datahub-web-react/src/app/entity/chart/ChartEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LineChartOutlined } from '@ant-design/icons';
import * as React from 'react';
import { Chart, EntityType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { ChartPreview } from './preview/ChartPreview';
import { GetChartQuery, useGetChartQuery, useUpdateChartMutation } from '../../../graphql/chart.generated';
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
Expand Down Expand Up @@ -209,4 +209,15 @@ export class ChartEntity implements Entity<Chart> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
12 changes: 11 additions & 1 deletion datahub-web-react/src/app/entity/container/ContainerEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FolderOutlined } from '@ant-design/icons';
import { Container, EntityType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { Preview } from './preview/Preview';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
Expand Down Expand Up @@ -164,4 +164,14 @@ export class ContainerEntity implements Entity<Container> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
13 changes: 12 additions & 1 deletion datahub-web-react/src/app/entity/dashboard/DashboardEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
useUpdateDashboardMutation,
} from '../../../graphql/dashboard.generated';
import { Dashboard, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection';
import { SidebarAboutSection } from '../shared/containers/profile/sidebar/SidebarAboutSection';
Expand Down Expand Up @@ -226,4 +226,15 @@ export class DashboardEntity implements Entity<Dashboard> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
13 changes: 12 additions & 1 deletion datahub-web-react/src/app/entity/dataFlow/DataFlowEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { ShareAltOutlined } from '@ant-design/icons';
import { DataFlow, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { Preview } from './preview/Preview';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { useGetDataFlowQuery, useUpdateDataFlowMutation } from '../../../graphql/dataFlow.generated';
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
Expand Down Expand Up @@ -158,4 +158,15 @@ export class DataFlowEntity implements Entity<DataFlow> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
13 changes: 12 additions & 1 deletion datahub-web-react/src/app/entity/dataJob/DataJobEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { ConsoleSqlOutlined } from '@ant-design/icons';
import { DataJob, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { Preview } from './preview/Preview';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { GetDataJobQuery, useGetDataJobQuery, useUpdateDataJobMutation } from '../../../graphql/dataJob.generated';
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
Expand Down Expand Up @@ -195,4 +195,15 @@ export class DataJobEntity implements Entity<DataJob> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
13 changes: 12 additions & 1 deletion datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { DatabaseFilled, DatabaseOutlined } from '@ant-design/icons';
import { Typography } from 'antd';
import { Dataset, DatasetProperties, EntityType, OwnershipType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { Preview } from './preview/Preview';
import { FIELDS_TO_HIGHLIGHT } from './search/highlights';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
Expand Down Expand Up @@ -322,4 +322,15 @@ export class DatasetEntity implements Entity<Dataset> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.GLOSSARY_TERMS,
EntityCapabilityType.TAGS,
EntityCapabilityType.DOMAINS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}
9 changes: 8 additions & 1 deletion datahub-web-react/src/app/entity/domain/DomainEntity.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import { FolderOutlined } from '@ant-design/icons';
import { Domain, EntityType, SearchResult } from '../../../types.generated';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { Preview } from './preview/Preview';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { DocumentationTab } from '../shared/tabs/Documentation/DocumentationTab';
Expand All @@ -11,6 +11,7 @@ import { getDataForEntityType } from '../shared/containers/profile/utils';
import { useGetDomainQuery } from '../../../graphql/domain.generated';
import { DomainEntitiesTab } from './DomainEntitiesTab';
import { EntityMenuItems } from '../shared/EntityDropdown/EntityDropdown';
import { EntityActionItem } from '../shared/entity/EntityActions';

/**
* Definition of the DataHub Domain entity.
Expand Down Expand Up @@ -65,6 +66,7 @@ export class DomainEntity implements Entity<Domain> {
useUpdateQuery={undefined}
getOverrideProperties={this.getOverridePropertiesFromEntity}
headerDropdownItems={new Set([EntityMenuItems.COPY_URL, EntityMenuItems.DELETE])}
headerActionItems={new Set([EntityActionItem.BATCH_ADD_DOMAIN])}
isNameEditable
tabs={[
{
Expand Down Expand Up @@ -134,4 +136,9 @@ export class DomainEntity implements Entity<Domain> {
getOverrideProperties: this.getOverridePropertiesFromEntity,
});
};

supportedCapabilities = () => {
// TODO.. Determine whether SOFT_DELETE should go into here.
return new Set([EntityCapabilityType.OWNERS]);
};
}
6 changes: 6 additions & 0 deletions datahub-web-react/src/app/entity/glossaryNode/ChildrenTab.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import React from 'react';
import { EntityType, GlossaryNode, GlossaryTerm } from '../../../types.generated';
import GlossaryEntitiesList from '../../glossary/GlossaryEntitiesList';
import { useEntityRegistry } from '../../useEntityRegistry';
import { sortGlossaryTerms } from '../glossaryTerm/utils';
import { useEntityData } from '../shared/EntityContext';
import { sortGlossaryNodes } from './utils';

function ChildrenTab() {
const { entityData } = useEntityData();
const entityRegistry = useEntityRegistry();

const childNodes = entityData?.children?.relationships
.filter((child) => child.entity?.type === EntityType.GlossaryNode)
.sort((nodeA, nodeB) => sortGlossaryNodes(entityRegistry, nodeA.entity, nodeB.entity))
.map((child) => child.entity);
const childTerms = entityData?.children?.relationships
.filter((child) => child.entity?.type === EntityType.GlossaryTerm)
.sort((termA, termB) => sortGlossaryTerms(entityRegistry, termA.entity, termB.entity))
.map((child) => child.entity);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import { useGetGlossaryNodeQuery } from '../../../graphql/glossaryNode.generated';
import { EntityType, GlossaryNode, SearchResult } from '../../../types.generated';
import GlossaryEntitiesPath from '../../glossary/GlossaryEntitiesPath';
import { Entity, IconStyleType, PreviewType } from '../Entity';
import { Entity, EntityCapabilityType, IconStyleType, PreviewType } from '../Entity';
import { EntityProfile } from '../shared/containers/profile/EntityProfile';
import { SidebarOwnerSection } from '../shared/containers/profile/sidebar/Ownership/SidebarOwnerSection';
import { SidebarAboutSection } from '../shared/containers/profile/sidebar/SidebarAboutSection';
Expand Down Expand Up @@ -135,6 +135,14 @@ class GlossaryNodeEntity implements Entity<GlossaryNode> {
getOverrideProperties: (data) => data,
});
};

supportedCapabilities = () => {
return new Set([
EntityCapabilityType.OWNERS,
EntityCapabilityType.DEPRECATION,
EntityCapabilityType.SOFT_DELETE,
]);
};
}

export default GlossaryNodeEntity;
8 changes: 8 additions & 0 deletions datahub-web-react/src/app/entity/glossaryNode/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Entity, EntityType } from '../../../types.generated';
import EntityRegistry from '../EntityRegistry';

export function sortGlossaryNodes(entityRegistry: EntityRegistry, nodeA?: Entity | null, nodeB?: Entity | null) {
const nodeAName = entityRegistry.getDisplayName(EntityType.GlossaryNode, nodeA);
const nodeBName = entityRegistry.getDisplayName(EntityType.GlossaryNode, nodeB);
return nodeAName.localeCompare(nodeBName);
}
Loading

0 comments on commit 474407c

Please sign in to comment.