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

Bring Alchemy UI to OSS #12481

Merged
merged 16 commits into from
Jan 30, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private Constants() {}
public static final String CONTRACTS_SCHEMA_FILE = "contract.graphql";
public static final String CONNECTIONS_SCHEMA_FILE = "connection.graphql";
public static final String VERSION_SCHEMA_FILE = "versioning.graphql";
public static final String QUERY_SCHEMA_FILE = "query.graphql";
public static final String BROWSE_PATH_DELIMITER = "/";
public static final String BROWSE_PATH_V2_DELIMITER = "␟";
public static final String VERSION_STAMP_FIELD_NAME = "versionStamp";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
import com.linkedin.datahub.graphql.resolvers.mutate.RemoveTagResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.RemoveTermResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateDescriptionResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateDisplayPropertiesResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateNameResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateParentNodeResolver;
import com.linkedin.datahub.graphql.resolvers.mutate.UpdateUserSettingResolver;
Expand Down Expand Up @@ -297,6 +298,7 @@
import com.linkedin.datahub.graphql.resolvers.settings.user.UpdateCorpUserViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.settings.view.GlobalViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.settings.view.UpdateGlobalViewsSettingsResolver;
import com.linkedin.datahub.graphql.resolvers.siblings.SiblingsSearchResolver;
import com.linkedin.datahub.graphql.resolvers.step.BatchGetStepStatesResolver;
import com.linkedin.datahub.graphql.resolvers.step.BatchUpdateStepStatesResolver;
import com.linkedin.datahub.graphql.resolvers.structuredproperties.CreateStructuredPropertyResolver;
Expand All @@ -314,6 +316,7 @@
import com.linkedin.datahub.graphql.resolvers.test.UpdateTestResolver;
import com.linkedin.datahub.graphql.resolvers.timeline.GetSchemaBlameResolver;
import com.linkedin.datahub.graphql.resolvers.timeline.GetSchemaVersionListResolver;
import com.linkedin.datahub.graphql.resolvers.timeline.GetTimelineResolver;
import com.linkedin.datahub.graphql.resolvers.type.AspectInterfaceTypeResolver;
import com.linkedin.datahub.graphql.resolvers.type.EntityInterfaceTypeResolver;
import com.linkedin.datahub.graphql.resolvers.type.HyperParameterValueTypeResolver;
Expand Down Expand Up @@ -376,6 +379,7 @@
import com.linkedin.datahub.graphql.types.notebook.NotebookType;
import com.linkedin.datahub.graphql.types.ownership.OwnershipType;
import com.linkedin.datahub.graphql.types.policy.DataHubPolicyType;
import com.linkedin.datahub.graphql.types.post.PostType;
import com.linkedin.datahub.graphql.types.query.QueryType;
import com.linkedin.datahub.graphql.types.restricted.RestrictedType;
import com.linkedin.datahub.graphql.types.role.DataHubRoleType;
Expand All @@ -389,6 +393,7 @@
import com.linkedin.entity.client.EntityClient;
import com.linkedin.entity.client.SystemEntityClient;
import com.linkedin.metadata.client.UsageStatsJavaClient;
import com.linkedin.metadata.config.ChromeExtensionConfiguration;
import com.linkedin.metadata.config.DataHubConfiguration;
import com.linkedin.metadata.config.IngestionConfiguration;
import com.linkedin.metadata.config.TestsConfiguration;
Expand Down Expand Up @@ -496,6 +501,7 @@ public class GmsGraphQLEngine {
private final TestsConfiguration testsConfiguration;
private final DataHubConfiguration datahubConfiguration;
private final ViewsConfiguration viewsConfiguration;
private final ChromeExtensionConfiguration chromeExtensionConfiguration;

private final DatasetType datasetType;

Expand Down Expand Up @@ -540,6 +546,7 @@ public class GmsGraphQLEngine {
private final FormType formType;
private final IncidentType incidentType;
private final RestrictedType restrictedType;
private final PostType postType;
private final DataProcessInstanceType dataProcessInstanceType;
private final VersionSetType versionSetType;

Expand Down Expand Up @@ -620,6 +627,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
this.datahubConfiguration = args.datahubConfiguration;
this.viewsConfiguration = args.viewsConfiguration;
this.featureFlags = args.featureFlags;
this.chromeExtensionConfiguration = args.chromeExtensionConfiguration;

this.datasetType = new DatasetType(entityClient);
this.roleType = new RoleType(entityClient);
Expand Down Expand Up @@ -662,6 +670,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
this.formType = new FormType(entityClient);
this.incidentType = new IncidentType(entityClient);
this.restrictedType = new RestrictedType(entityClient, restrictedService);
this.postType = new PostType(entityClient);
this.dataProcessInstanceType = new DataProcessInstanceType(entityClient, featureFlags);
this.versionSetType = new VersionSetType(entityClient);

Expand Down Expand Up @@ -713,6 +722,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
entityTypeType,
formType,
incidentType,
postType,
versionSetType,
restrictedType,
businessAttributeType,
Expand Down Expand Up @@ -873,7 +883,8 @@ public GraphQLEngine.Builder builder() {
.addSchema(fileBasedSchema(INCIDENTS_SCHEMA_FILE))
.addSchema(fileBasedSchema(CONTRACTS_SCHEMA_FILE))
.addSchema(fileBasedSchema(COMMON_SCHEMA_FILE))
.addSchema(fileBasedSchema(VERSION_SCHEMA_FILE));
.addSchema(fileBasedSchema(VERSION_SCHEMA_FILE))
.addSchema(fileBasedSchema(QUERY_SCHEMA_FILE));

for (GmsGraphQLPlugin plugin : this.graphQLPlugins) {
List<String> pluginSchemaFiles = plugin.getSchemaFiles();
Expand Down Expand Up @@ -1002,7 +1013,8 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
this.testsConfiguration,
this.datahubConfiguration,
this.viewsConfiguration,
this.featureFlags))
this.featureFlags,
this.chromeExtensionConfiguration))
.dataFetcher("me", new MeResolver(this.entityClient, featureFlags))
.dataFetcher("search", new SearchResolver(this.entityClient))
.dataFetcher(
Expand Down Expand Up @@ -1088,6 +1100,7 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher(
"executionRequest", new GetIngestionExecutionRequestResolver(this.entityClient))
.dataFetcher("getSchemaBlame", new GetSchemaBlameResolver(this.timelineService))
.dataFetcher("getTimeline", new GetTimelineResolver(this.timelineService))
.dataFetcher(
"getSchemaVersionList", new GetSchemaVersionListResolver(this.timelineService))
.dataFetcher("test", getResolver(testType))
Expand Down Expand Up @@ -1352,6 +1365,9 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
"createOwnershipType", new CreateOwnershipTypeResolver(this.ownershipTypeService))
.dataFetcher(
"updateOwnershipType", new UpdateOwnershipTypeResolver(this.ownershipTypeService))
.dataFetcher(
"updateDisplayProperties",
new UpdateDisplayPropertiesResolver(this.entityService))
.dataFetcher(
"deleteOwnershipType", new DeleteOwnershipTypeResolver(this.ownershipTypeService))
.dataFetcher("submitFormPrompt", new SubmitFormPromptResolver(this.formService))
Expand Down Expand Up @@ -1735,7 +1751,10 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("exists", new EntityExistsResolver(entityService))
.dataFetcher("runs", new EntityRunsResolver(entityClient))
.dataFetcher("privileges", new EntityPrivilegesResolver(entityClient))
.dataFetcher("parentContainers", new ParentContainersResolver(entityClient)))
.dataFetcher("parentContainers", new ParentContainersResolver(entityClient))
.dataFetcher(
"siblingsSearch",
new SiblingsSearchResolver(this.entityClient, this.viewService)))
.type(
"Owner",
typeWiring ->
Expand Down Expand Up @@ -1768,6 +1787,13 @@ private void configureDatasetResolvers(final RuntimeWiring.Builder builder) {
datasetType,
(env) ->
((ForeignKeyConstraint) env.getSource()).getForeignDataset().getUrn())))
.type(
"Deprecation",
typeWiring ->
typeWiring.dataFetcher(
"replacement",
new EntityTypeResolver(
entityTypes, (env) -> ((Deprecation) env.getSource()).getReplacement())))
.type(
"SiblingProperties",
typeWiring ->
Expand Down Expand Up @@ -1878,10 +1904,16 @@ private void configureSchemaFieldResolvers(final RuntimeWiring.Builder builder)
builder.type(
"SchemaFieldEntity",
typeWiring ->
typeWiring.dataFetcher(
"parent",
new EntityTypeResolver(
entityTypes, (env) -> ((SchemaFieldEntity) env.getSource()).getParent())));
typeWiring
.dataFetcher(
"parent",
new EntityTypeResolver(
entityTypes, (env) -> ((SchemaFieldEntity) env.getSource()).getParent()))
.dataFetcher("relationships", new EntityRelationshipsResultResolver(graphClient))
.dataFetcher(
"lineage",
new EntityLineageResultResolver(
siblingGraphService, restrictedService, this.authorizationConfiguration)));
}

private void configureEntityPathResolvers(final RuntimeWiring.Builder builder) {
Expand Down Expand Up @@ -1935,10 +1967,12 @@ private void configureCorpUserResolvers(final RuntimeWiring.Builder builder) {
new LoadableTypeBatchResolver<>(
dataPlatformType,
(env) ->
((CorpUserEditableProperties) env.getSource())
.getPlatforms().stream()
.map(DataPlatform::getUrn)
.collect(Collectors.toList()))));
((CorpUserEditableProperties) env.getSource()).getPlatforms() != null
? ((CorpUserEditableProperties) env.getSource())
.getPlatforms().stream()
.map(DataPlatform::getUrn)
.collect(Collectors.toList())
: ImmutableList.of())));
}

/**
Expand Down Expand Up @@ -3065,11 +3099,20 @@ private void configureQueryEntityResolvers(final RuntimeWiring.Builder builder)
.type(
"QuerySubject",
typeWiring ->
typeWiring.dataFetcher(
"dataset",
new LoadableTypeResolver<>(
datasetType,
(env) -> ((QuerySubject) env.getSource()).getDataset().getUrn())));
typeWiring
.dataFetcher(
"dataset",
new LoadableTypeResolver<>(
datasetType,
(env) -> ((QuerySubject) env.getSource()).getDataset().getUrn()))
.dataFetcher(
"schemaField",
new LoadableTypeResolver<>(
schemaFieldType,
(env) ->
((QuerySubject) env.getSource()).getSchemaField() != null
? ((QuerySubject) env.getSource()).getSchemaField().getUrn()
: null)));
}

private void configureOwnershipTypeResolver(final RuntimeWiring.Builder builder) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.linkedin.entity.client.EntityClient;
import com.linkedin.entity.client.SystemEntityClient;
import com.linkedin.metadata.client.UsageStatsJavaClient;
import com.linkedin.metadata.config.ChromeExtensionConfiguration;
import com.linkedin.metadata.config.DataHubConfiguration;
import com.linkedin.metadata.config.IngestionConfiguration;
import com.linkedin.metadata.config.TestsConfiguration;
Expand Down Expand Up @@ -87,6 +88,7 @@ public class GmsGraphQLEngineArgs {
int graphQLQueryDepthLimit;
boolean graphQLQueryIntrospectionEnabled;
BusinessAttributeService businessAttributeService;
ChromeExtensionConfiguration chromeExtensionConfiguration;
ConnectionService connectionService;
AssertionService assertionService;
EntityVersioningService entityVersioningService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,5 +375,21 @@ public static boolean isViewDatasetUsageAuthorized(
new EntitySpec(resourceUrn.getEntityType(), resourceUrn.toString()));
}

public static boolean isViewDatasetProfileAuthorized(
final QueryContext context, final Urn resourceUrn) {
return AuthUtil.isAuthorized(
context.getOperationContext(),
PoliciesConfig.VIEW_DATASET_PROFILE_PRIVILEGE,
new EntitySpec(resourceUrn.getEntityType(), resourceUrn.toString()));
}

public static boolean isViewDatasetOperationsAuthorized(
final QueryContext context, final Urn resourceUrn) {
return AuthUtil.isAuthorized(
context.getOperationContext(),
PoliciesConfig.VIEW_DATASET_OPERATIONS_PRIVILEGE,
new EntitySpec(resourceUrn.getEntityType(), resourceUrn.toString()));
}

private AuthorizationUtils() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.linkedin.datahub.graphql.generated.AnalyticsConfig;
import com.linkedin.datahub.graphql.generated.AppConfig;
import com.linkedin.datahub.graphql.generated.AuthConfig;
import com.linkedin.datahub.graphql.generated.ChromeExtensionConfig;
import com.linkedin.datahub.graphql.generated.EntityProfileConfig;
import com.linkedin.datahub.graphql.generated.EntityProfilesConfig;
import com.linkedin.datahub.graphql.generated.EntityType;
Expand All @@ -23,6 +24,7 @@
import com.linkedin.datahub.graphql.generated.TestsConfig;
import com.linkedin.datahub.graphql.generated.ViewsConfig;
import com.linkedin.datahub.graphql.generated.VisualConfig;
import com.linkedin.metadata.config.ChromeExtensionConfiguration;
import com.linkedin.metadata.config.DataHubConfiguration;
import com.linkedin.metadata.config.IngestionConfiguration;
import com.linkedin.metadata.config.TestsConfiguration;
Expand Down Expand Up @@ -50,6 +52,7 @@ public class AppConfigResolver implements DataFetcher<CompletableFuture<AppConfi
private final DataHubConfiguration _datahubConfiguration;
private final ViewsConfiguration _viewsConfiguration;
private final FeatureFlags _featureFlags;
private final ChromeExtensionConfiguration _chromeExtensionConfiguration;

public AppConfigResolver(
final GitVersion gitVersion,
Expand All @@ -63,7 +66,8 @@ public AppConfigResolver(
final TestsConfiguration testsConfiguration,
final DataHubConfiguration datahubConfiguration,
final ViewsConfiguration viewsConfiguration,
final FeatureFlags featureFlags) {
final FeatureFlags featureFlags,
final ChromeExtensionConfiguration chromeExtensionConfiguration) {
_gitVersion = gitVersion;
_isAnalyticsEnabled = isAnalyticsEnabled;
_ingestionConfiguration = ingestionConfiguration;
Expand All @@ -76,6 +80,7 @@ public AppConfigResolver(
_datahubConfiguration = datahubConfiguration;
_viewsConfiguration = viewsConfiguration;
_featureFlags = featureFlags;
_chromeExtensionConfiguration = chromeExtensionConfiguration;
}

@Override
Expand Down Expand Up @@ -187,13 +192,27 @@ public CompletableFuture<AppConfig> get(final DataFetchingEnvironment environmen
.setPlatformBrowseV2(_featureFlags.isPlatformBrowseV2())
.setDataContractsEnabled(_featureFlags.isDataContractsEnabled())
.setEditableDatasetNameEnabled(_featureFlags.isEditableDatasetNameEnabled())
.setThemeV2Enabled(_featureFlags.isThemeV2Enabled())
.setThemeV2Default(_featureFlags.isThemeV2Default())
.setThemeV2Toggleable(_featureFlags.isThemeV2Toggleable())
.setLineageGraphV2(_featureFlags.isLineageGraphV2())
.setShowSeparateSiblings(_featureFlags.isShowSeparateSiblings())
.setShowManageStructuredProperties(_featureFlags.isShowManageStructuredProperties())
.setSchemaFieldCLLEnabled(_featureFlags.isSchemaFieldCLLEnabled())
.setHideDbtSourceInLineage(_featureFlags.isHideDbtSourceInLineage())
.setSchemaFieldLineageIgnoreStatus(_featureFlags.isSchemaFieldLineageIgnoreStatus())
.setShowNavBarRedesign(_featureFlags.isShowNavBarRedesign())
.setShowAutoCompleteResults(_featureFlags.isShowAutoCompleteResults())
.setEntityVersioningEnabled(_featureFlags.isEntityVersioning())
.build();

appConfig.setFeatureFlags(featureFlagsConfig);

final ChromeExtensionConfig chromeExtensionConfig = new ChromeExtensionConfig();
chromeExtensionConfig.setEnabled(_chromeExtensionConfiguration.isEnabled());
chromeExtensionConfig.setLineageEnabled(_chromeExtensionConfiguration.isLineageEnabled());
appConfig.setChromeExtensionConfig(chromeExtensionConfig);

return CompletableFuture.completedFuture(appConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ private static void updateDeprecation(
// Note is required field in GMS. Set to empty string if not provided.
deprecation.setNote(EMPTY_STRING);
}

try {
deprecation.setReplacement(
input.getReplacement() != null ? Urn.createFromString(input.getReplacement()) : null,
SetMode.REMOVE_IF_NULL);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
try {
deprecation.setActor(Urn.createFromString(context.getActorUrn()));
} catch (URISyntaxException e) {
Expand Down
Loading
Loading