Skip to content
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(ui) Build entity doesn't exist page for entity profiles #7150

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 @@ -617,6 +617,7 @@ private void configureContainerResolvers(final RuntimeWiring.Builder builder) {
.type("Container", typeWiring -> typeWiring
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher("entities", new ContainerEntitiesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("platform",
new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((Container) env.getSource()).getPlatform().getUrn()))
Expand Down Expand Up @@ -984,6 +985,7 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("assertions", new EntityAssertionsResolver(entityClient, graphClient))
.dataFetcher("testResults", new TestResultsResolver(entityClient))
.dataFetcher("aspects", new WeaklyTypedAspectsResolver(entityClient, entityRegistry))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("subTypes", new SubTypesResolver(
this.entityClient,
"dataset",
Expand Down Expand Up @@ -1057,13 +1059,15 @@ private void configureGlossaryTermResolvers(final RuntimeWiring.Builder builder)
.dataFetcher("schemaMetadata", new AspectResolver())
.dataFetcher("parentNodes", new ParentNodesResolver(entityClient))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
);
}

private void configureGlossaryNodeResolvers(final RuntimeWiring.Builder builder) {
builder.type("GlossaryNode", typeWiring -> typeWiring
.dataFetcher("parentNodes", new ParentNodesResolver(entityClient))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
);
}

Expand Down Expand Up @@ -1148,6 +1152,7 @@ private void configureNotebookResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("browsePaths", new EntityBrowsePathsResolver(this.notebookType))
.dataFetcher("platform", new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((Notebook) env.getSource()).getPlatform().getUrn()))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("dataPlatformInstance",
new LoadableTypeResolver<>(dataPlatformInstanceType,
(env) -> {
Expand Down Expand Up @@ -1185,6 +1190,7 @@ private void configureDashboardResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("usageStats", new DashboardUsageStatsResolver(timeseriesAspectService))
.dataFetcher("statsSummary", new DashboardStatsSummaryResolver(timeseriesAspectService))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
);
builder.type("DashboardInfo", typeWiring -> typeWiring
.dataFetcher("charts", new LoadableTypeBatchResolver<>(chartType,
Expand Down Expand Up @@ -1237,6 +1243,7 @@ private void configureChartResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("parentContainers", new ParentContainersResolver(entityClient))
.dataFetcher("statsSummary", new ChartStatsSummaryResolver(this.timeseriesAspectService))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
);
builder.type("ChartInfo", typeWiring -> typeWiring
.dataFetcher("inputs", new LoadableTypeBatchResolver<>(datasetType,
Expand Down Expand Up @@ -1314,6 +1321,7 @@ private void configureDataJobResolvers(final RuntimeWiring.Builder builder) {
)
.dataFetcher("runs", new DataJobRunsResolver(entityClient))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("exists", new EntityExistsResolver(entityService))
)
.type("DataJobInputOutput", typeWiring -> typeWiring
.dataFetcher("inputDatasets", new LoadableTypeBatchResolver<>(datasetType,
Expand Down Expand Up @@ -1342,6 +1350,7 @@ private void configureDataFlowResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("lineage", new EntityLineageResultResolver(siblingGraphService))
.dataFetcher("platform", new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((DataFlow) env.getSource()).getPlatform().getUrn()))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("dataPlatformInstance",
new LoadableTypeResolver<>(dataPlatformInstanceType,
(env) -> {
Expand All @@ -1361,6 +1370,7 @@ private void configureMLFeatureTableResolvers(final RuntimeWiring.Builder builde
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher("browsePaths", new EntityBrowsePathsResolver(this.mlFeatureTableType))
.dataFetcher("lineage", new EntityLineageResultResolver(siblingGraphService))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("platform",
new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((MLFeatureTable) env.getSource()).getPlatform().getUrn()))
Expand Down Expand Up @@ -1416,6 +1426,7 @@ private void configureMLFeatureTableResolvers(final RuntimeWiring.Builder builde
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher("browsePaths", new EntityBrowsePathsResolver(this.mlModelType))
.dataFetcher("lineage", new EntityLineageResultResolver(siblingGraphService))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("platform", new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((MLModel) env.getSource()).getPlatform().getUrn()))
.dataFetcher("dataPlatformInstance",
Expand Down Expand Up @@ -1446,6 +1457,7 @@ private void configureMLFeatureTableResolvers(final RuntimeWiring.Builder builde
.dataFetcher("platform", new LoadableTypeResolver<>(dataPlatformType,
(env) -> ((MLModelGroup) env.getSource()).getPlatform().getUrn())
)
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("dataPlatformInstance",
new LoadableTypeResolver<>(dataPlatformInstanceType,
(env) -> {
Expand All @@ -1457,6 +1469,7 @@ private void configureMLFeatureTableResolvers(final RuntimeWiring.Builder builde
.type("MLFeature", typeWiring -> typeWiring
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher("lineage", new EntityLineageResultResolver(siblingGraphService))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("dataPlatformInstance",
new LoadableTypeResolver<>(dataPlatformInstanceType,
(env) -> {
Expand All @@ -1468,6 +1481,7 @@ private void configureMLFeatureTableResolvers(final RuntimeWiring.Builder builde
.type("MLPrimaryKey", typeWiring -> typeWiring
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher("lineage", new EntityLineageResultResolver(siblingGraphService))
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("dataPlatformInstance",
new LoadableTypeResolver<>(dataPlatformInstanceType,
(env) -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.linkedin.datahub.graphql.resolvers.entity;

import com.linkedin.common.urn.Urn;
import com.linkedin.datahub.graphql.generated.Entity;
import com.linkedin.metadata.entity.EntityService;
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
Expand All @@ -22,15 +23,19 @@ public EntityExistsResolver(final EntityService entityService) {

@Override
public CompletableFuture<Boolean> get(final DataFetchingEnvironment environment) throws Exception {
final String entityUrnString = bindArgument(environment.getArgument("urn"), String.class);
String entityUrnString = bindArgument(environment.getArgument("urn"), String.class);
// resolver can be used as its own endpoint or when hydrating an entity
if (entityUrnString == null && environment.getSource() != null) {
entityUrnString = ((Entity) environment.getSource()).getUrn();
}
Objects.requireNonNull(entityUrnString, "Entity urn must not be null!");

Urn entityUrn = Urn.createFromString(entityUrnString);
final Urn entityUrn = Urn.createFromString(entityUrnString);
return CompletableFuture.supplyAsync(() -> {
try {
return _entityService.exists(entityUrn);
} catch (Exception e) {
throw new RuntimeException(String.format("Failed to check whether entity %s exists", entityUrnString));
throw new RuntimeException(String.format("Failed to check whether entity %s exists", entityUrn.toString()));
}
});
}
Expand Down
70 changes: 70 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,11 @@ type Dataset implements EntityWithRelationships & Entity & BrowsableEntity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

type FineGrainedLineage {
Expand Down Expand Up @@ -1585,6 +1590,11 @@ type GlossaryTerm implements Entity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -1717,6 +1727,11 @@ type GlossaryNode implements Entity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -2082,6 +2097,11 @@ type Container implements Entity {
Status metadata of the container
"""
status: Status

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -4215,6 +4235,11 @@ type Notebook implements Entity & BrowsableEntity {
The browse paths corresponding to the Notebook. If no Browse Paths have been generated before, this will be null.
"""
browsePaths: [BrowsePath!]

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -4525,6 +4550,11 @@ type Dashboard implements EntityWithRelationships & Entity & BrowsableEntity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -4820,6 +4850,11 @@ type Chart implements EntityWithRelationships & Entity & BrowsableEntity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -5167,6 +5202,11 @@ type DataFlow implements EntityWithRelationships & Entity & BrowsableEntity {
Standardized platform urn where the datflow is defined
"""
platform: DataPlatform!

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -5354,6 +5394,11 @@ type DataJob implements EntityWithRelationships & Entity & BrowsableEntity {
Privileges given to a user relevant to this entity
"""
privileges: EntityPrivileges

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -8191,6 +8236,11 @@ type MLModel implements EntityWithRelationships & Entity & BrowsableEntity {
An additional set of of read write properties
"""
editableProperties: MLModelEditableProperties

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

"""
Expand Down Expand Up @@ -8292,6 +8342,11 @@ type MLModelGroup implements EntityWithRelationships & Entity & BrowsableEntity
An additional set of of read write properties
"""
editableProperties: MLModelGroupEditableProperties

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

type MLModelGroupProperties {
Expand Down Expand Up @@ -8406,6 +8461,11 @@ type MLFeature implements EntityWithRelationships & Entity {
An additional set of of read write properties
"""
editableProperties: MLFeatureEditableProperties

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

type MLHyperParam {
Expand Down Expand Up @@ -8570,6 +8630,11 @@ type MLPrimaryKey implements EntityWithRelationships & Entity {
An additional set of of read write properties
"""
editableProperties: MLPrimaryKeyEditableProperties

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

type MLPrimaryKeyProperties {
Expand Down Expand Up @@ -8687,6 +8752,11 @@ type MLFeatureTable implements EntityWithRelationships & Entity & BrowsableEntit
An additional set of of read write properties
"""
editableProperties: MLFeatureTableEditableProperties

"""
Whether or not this entity exists on DataHub
"""
exists: Boolean
}

type MLFeatureTableEditableProperties {
Expand Down
9 changes: 9 additions & 0 deletions datahub-web-react/src/Mocks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export const dataset1 = {
},
},
lastIngested: null,
exists: true,
dataPlatformInstance: null,
platformNativeType: 'TABLE',
name: 'The Great Test Dataset',
Expand Down Expand Up @@ -258,6 +259,7 @@ export const dataset2 = {
canEditEmbed: false,
},
lastIngested: null,
exists: true,
dataPlatformInstance: null,
platformNativeType: 'TABLE',
name: 'Some Other Dataset',
Expand Down Expand Up @@ -350,6 +352,7 @@ export const dataset3 = {
canEditLineage: false,
canEditEmbed: false,
},
exists: true,
lastIngested: null,
dataPlatformInstance: null,
platformNativeType: 'STREAM',
Expand Down Expand Up @@ -827,6 +830,7 @@ export const container1 = {
type: EntityType.Container,
platform: dataPlatform,
lastIngested: null,
exists: true,
properties: {
name: 'database1',
externalUrl: null,
Expand All @@ -840,6 +844,7 @@ export const container2 = {
type: EntityType.Container,
platform: dataPlatform,
lastIngested: null,
exists: true,
properties: {
name: 'schema1',
externalUrl: null,
Expand Down Expand Up @@ -1136,6 +1141,7 @@ export const dataFlow1 = {
flowId: 'flowId1',
cluster: 'cluster1',
lastIngested: null,
exists: true,
properties: {
name: 'DataFlowInfoName',
description: 'DataFlowInfo1 Description',
Expand Down Expand Up @@ -1205,6 +1211,7 @@ export const dataJob1 = {
dataFlow: dataFlow1,
jobId: 'jobId1',
lastIngested: null,
exists: true,
ownership: {
__typename: 'Ownership',
owners: [
Expand Down Expand Up @@ -1359,6 +1366,7 @@ export const dataJob3 = {
dataFlow: dataFlow1,
jobId: 'jobId3',
lastIngested: null,
exists: true,
privileges: {
canEditLineage: false,
canEditEmbed: false,
Expand Down Expand Up @@ -1431,6 +1439,7 @@ export const mlModel = {
description: 'a ml trust model',
origin: 'PROD',
lastIngested: null,
exists: true,
platform: {
urn: 'urn:li:dataPlatform:kafka',
name: 'Kafka',
Expand Down
Loading