From 7378a60452f9e02ea513287b0901932cbaeadff6 Mon Sep 17 00:00:00 2001 From: Jay Kadambi Date: Tue, 28 May 2024 16:04:57 -0500 Subject: [PATCH 1/3] Initial changes to allow editable dataset name --- .../resolvers/mutate/UpdateNameResolver.java | 36 +++++++++++++ .../types/dataset/mappers/DatasetMapper.java | 4 ++ .../mappers/DatasetUpdateInputMapper.java | 9 +++- .../src/main/resources/entity.graphql | 9 ++++ .../src/app/entity/dataset/DatasetEntity.tsx | 7 +-- .../profile/header/EntityHeader.tsx | 2 + datahub-web-react/src/graphql/browse.graphql | 1 + .../src/graphql/fragments.graphql | 1 + datahub-web-react/src/graphql/preview.graphql | 1 + datahub-web-react/src/graphql/search.graphql | 1 + .../dataset/EditableDatasetProperties.pdl | 9 ++++ .../com.linkedin.entity.aspects.snapshot.json | 15 ++++-- ...com.linkedin.entity.entities.snapshot.json | 53 ++++++++++++++++--- .../com.linkedin.entity.runs.snapshot.json | 15 ++++-- ...nkedin.operations.operations.snapshot.json | 15 ++++-- ...m.linkedin.platform.platform.snapshot.json | 53 ++++++++++++++++--- 16 files changed, 198 insertions(+), 33 deletions(-) diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/mutate/UpdateNameResolver.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/mutate/UpdateNameResolver.java index 6f9ceec34bbf26..cf709824f2b916 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/mutate/UpdateNameResolver.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/mutate/UpdateNameResolver.java @@ -4,9 +4,11 @@ import static com.linkedin.datahub.graphql.resolvers.mutate.MutationUtils.persistAspect; import com.linkedin.businessattribute.BusinessAttributeInfo; +import com.linkedin.common.AuditStamp; import com.linkedin.common.urn.CorpuserUrn; import com.linkedin.common.urn.Urn; import com.linkedin.common.urn.UrnUtils; +import com.linkedin.data.template.SetMode; import com.linkedin.datahub.graphql.QueryContext; import com.linkedin.datahub.graphql.authorization.AuthorizationUtils; import com.linkedin.datahub.graphql.exception.AuthorizationException; @@ -19,6 +21,7 @@ import com.linkedin.datahub.graphql.resolvers.mutate.util.DomainUtils; import com.linkedin.datahub.graphql.resolvers.mutate.util.GlossaryUtils; import com.linkedin.dataproduct.DataProductProperties; +import com.linkedin.dataset.EditableDatasetProperties; import com.linkedin.domain.DomainProperties; import com.linkedin.domain.Domains; import com.linkedin.entity.client.EntityClient; @@ -69,6 +72,8 @@ public CompletableFuture get(DataFetchingEnvironment environment) throw return updateDataProductName(targetUrn, input, context); case Constants.BUSINESS_ATTRIBUTE_ENTITY_NAME: return updateBusinessAttributeName(targetUrn, input, environment.getContext()); + case Constants.DATASET_ENTITY_NAME: + return updateDatasetName(targetUrn, input, environment.getContext()); default: throw new RuntimeException( String.format( @@ -233,6 +238,37 @@ private Boolean updateGroupName(Urn targetUrn, UpdateNameInput input, QueryConte "Unauthorized to perform this action. Please contact your DataHub administrator."); } + // udpates editable dataset properties aspect's name field + private Boolean updateDatasetName(Urn targetUrn, UpdateNameInput input, QueryContext context) { + if (AuthorizationUtils.canEditProperties(targetUrn, context)) { + try { + if (input.getName() != null) { + final EditableDatasetProperties editableDatasetProperties = + new EditableDatasetProperties(); + editableDatasetProperties.setName(input.getName()); + final AuditStamp auditStamp = new AuditStamp(); + Urn actor = UrnUtils.getUrn(context.getActorUrn()); + auditStamp.setActor(actor, SetMode.IGNORE_NULL); + auditStamp.setTime(System.currentTimeMillis()); + editableDatasetProperties.setLastModified(auditStamp); + persistAspect( + context.getOperationContext(), + targetUrn, + Constants.EDITABLE_DATASET_PROPERTIES_ASPECT_NAME, + editableDatasetProperties, + actor, + _entityService); + } + return true; + } catch (Exception e) { + throw new RuntimeException( + String.format("Failed to perform update against input %s", input), e); + } + } + throw new AuthorizationException( + "Unauthorized to perform this action. Please contact your DataHub administrator."); + } + private Boolean updateDataProductName( Urn targetUrn, UpdateNameInput input, QueryContext context) { try { diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java index 89d5aa8621bf08..a7b5f6de0c183d 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetMapper.java @@ -222,6 +222,7 @@ private void mapDatasetProperties( properties.setQualifiedName(gmsProperties.getQualifiedName()); dataset.setProperties(properties); dataset.setDescription(properties.getDescription()); + dataset.setName(properties.getName()); if (gmsProperties.getUri() != null) { dataset.setUri(gmsProperties.getUri().toString()); } @@ -248,6 +249,9 @@ private void mapEditableDatasetProperties(@Nonnull Dataset dataset, @Nonnull Dat new EditableDatasetProperties(dataMap); final DatasetEditableProperties editableProperties = new DatasetEditableProperties(); editableProperties.setDescription(editableDatasetProperties.getDescription()); + if (editableDatasetProperties.getName() != null) { + editableProperties.setName(editableDatasetProperties.getName()); + } dataset.setEditableProperties(editableProperties); } diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetUpdateInputMapper.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetUpdateInputMapper.java index 122298bcab6547..104dc0e1043413 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetUpdateInputMapper.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/dataset/mappers/DatasetUpdateInputMapper.java @@ -111,8 +111,13 @@ public Collection apply( if (datasetUpdateInput.getEditableProperties() != null) { final EditableDatasetProperties editableDatasetProperties = new EditableDatasetProperties(); - editableDatasetProperties.setDescription( - datasetUpdateInput.getEditableProperties().getDescription()); + if (datasetUpdateInput.getEditableProperties().getDescription() != null) { + editableDatasetProperties.setDescription( + datasetUpdateInput.getEditableProperties().getDescription()); + } + if (datasetUpdateInput.getEditableProperties().getName() != null) { + editableDatasetProperties.setName(datasetUpdateInput.getEditableProperties().getName()); + } editableDatasetProperties.setLastModified(auditStamp); editableDatasetProperties.setCreated(auditStamp); proposals.add( diff --git a/datahub-graphql-core/src/main/resources/entity.graphql b/datahub-graphql-core/src/main/resources/entity.graphql index de030f77b0b017..1044ee2054460a 100644 --- a/datahub-graphql-core/src/main/resources/entity.graphql +++ b/datahub-graphql-core/src/main/resources/entity.graphql @@ -3456,6 +3456,11 @@ type DatasetEditableProperties { Description of the Dataset """ description: String + + """ + Editable name of the Dataset + """ + name: String } """ @@ -4804,6 +4809,10 @@ input DatasetEditablePropertiesUpdate { Writable description aka documentation for a Dataset """ description: String! + """ + Editable name of the Dataset + """ + name: String } """ diff --git a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx index 0caafb5523a20a..fd1529b09905de 100644 --- a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx +++ b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx @@ -212,6 +212,7 @@ export class DatasetEntity implements Entity { }, ]} sidebarSections={this.getSidebarSections()} + isNameEditable={true} /> ); @@ -276,7 +277,7 @@ export class DatasetEntity implements Entity { return ( { return ( { }; displayName = (data: Dataset) => { - return data?.properties?.name || data.name || data.urn; + return data?.editableProperties?.name || data?.properties?.name || data.name || data.urn; }; platformLogoUrl = (data: Dataset) => { diff --git a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx index 09fa23dbc9f57c..575516bfacdc18 100644 --- a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx +++ b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx @@ -71,6 +71,8 @@ export function getCanEditName( return true; // TODO: add permissions for data products case EntityType.BusinessAttribute: return privileges?.manageBusinessAttributes; + case EntityType.Dataset: + return entityData?.privileges?.canEditProperties; default: return false; } diff --git a/datahub-web-react/src/graphql/browse.graphql b/datahub-web-react/src/graphql/browse.graphql index 62ae2168d857ac..dd4445947520fb 100644 --- a/datahub-web-react/src/graphql/browse.graphql +++ b/datahub-web-react/src/graphql/browse.graphql @@ -17,6 +17,7 @@ query getBrowseResults($input: BrowseInput!) { description } editableProperties { + name description } platform { diff --git a/datahub-web-react/src/graphql/fragments.graphql b/datahub-web-react/src/graphql/fragments.graphql index b28150a47b7530..549061c815deae 100644 --- a/datahub-web-react/src/graphql/fragments.graphql +++ b/datahub-web-react/src/graphql/fragments.graphql @@ -251,6 +251,7 @@ fragment nonRecursiveDatasetFields on Dataset { } } editableProperties { + name description } ownership { diff --git a/datahub-web-react/src/graphql/preview.graphql b/datahub-web-react/src/graphql/preview.graphql index 48482c64face9a..eff8a4c451b715 100644 --- a/datahub-web-react/src/graphql/preview.graphql +++ b/datahub-web-react/src/graphql/preview.graphql @@ -9,6 +9,7 @@ fragment entityPreview on Entity { ...platformFields } editableProperties { + name description } platformNativeType diff --git a/datahub-web-react/src/graphql/search.graphql b/datahub-web-react/src/graphql/search.graphql index b8dc84aea62a73..cfbde21b47c375 100644 --- a/datahub-web-react/src/graphql/search.graphql +++ b/datahub-web-react/src/graphql/search.graphql @@ -335,6 +335,7 @@ fragment nonSiblingsDatasetSearchFields on Dataset { ...dataPlatformInstanceFields } editableProperties { + name description } access { diff --git a/metadata-models/src/main/pegasus/com/linkedin/dataset/EditableDatasetProperties.pdl b/metadata-models/src/main/pegasus/com/linkedin/dataset/EditableDatasetProperties.pdl index 939231d2d4738d..48e0bfb26227fb 100644 --- a/metadata-models/src/main/pegasus/com/linkedin/dataset/EditableDatasetProperties.pdl +++ b/metadata-models/src/main/pegasus/com/linkedin/dataset/EditableDatasetProperties.pdl @@ -19,4 +19,13 @@ record EditableDatasetProperties includes ChangeAuditStamps { "fieldName": "editedDescription", } description: optional string + + /** + * Editable display name of the Dataset + */ + @Searchable = { + "fieldType": "TEXT_PARTIAL", + "fieldName": "editedName", + } + name: optional string } diff --git a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.aspects.snapshot.json b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.aspects.snapshot.json index 00b434d30356f9..eb81fe3ff8db39 100644 --- a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.aspects.snapshot.json +++ b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.aspects.snapshot.json @@ -843,10 +843,10 @@ "PRE" : "Designates pre-production fabrics", "PROD" : "Designates production fabrics", "QA" : "Designates quality assurance fabrics", + "RVW" : "Designates review fabrics", "STG" : "Designates staging fabrics", "TEST" : "Designates testing fabrics", - "UAT" : "Designates user acceptance testing fabrics", - "RVW" : "Designates review fabrics" + "UAT" : "Designates user acceptance testing fabrics" } }, { "type" : "record", @@ -2489,7 +2489,13 @@ }, { "name" : "lastModified", "type" : "com.linkedin.common.AuditStamp", - "doc" : "Audit stamp containing who last modified the status and when." + "doc" : "Audit stamp containing who last modified the status and when.", + "Searchable" : { + "/time" : { + "fieldName" : "statusLastModifiedAt", + "fieldType" : "COUNT" + } + } } ], "Aspect" : { "name" : "corpUserStatus" @@ -2861,8 +2867,9 @@ }, { "name" : "label", "type" : "string", - "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.", + "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.\n\nNote that this field is deprecated and is not surfaced in the UI.", "optional" : true, + "Deprecated" : true, "Searchable" : { "boostScore" : 0.2, "fieldName" : "fieldLabels", diff --git a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.entities.snapshot.json b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.entities.snapshot.json index ffbcdd1b2adb3b..7b9f08351ad687 100644 --- a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.entities.snapshot.json +++ b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.entities.snapshot.json @@ -843,10 +843,10 @@ "PRE" : "Designates pre-production fabrics", "PROD" : "Designates production fabrics", "QA" : "Designates quality assurance fabrics", + "RVW" : "Designates review fabrics", "STG" : "Designates staging fabrics", "TEST" : "Designates testing fabrics", - "UAT" : "Designates user acceptance testing fabrics", - "RVW" : "Designates review fabrics" + "UAT" : "Designates user acceptance testing fabrics" } }, { "type" : "record", @@ -2242,6 +2242,15 @@ "fieldName" : "editedDescription", "fieldType" : "TEXT" } + }, { + "name" : "name", + "type" : "string", + "doc" : "Editable display name of the Dataset", + "optional" : true, + "Searchable" : { + "fieldName" : "editedName", + "fieldType" : "TEXT_PARTIAL" + } } ], "Aspect" : { "name" : "editableDatasetProperties" @@ -2801,7 +2810,13 @@ }, { "name" : "lastModified", "type" : "com.linkedin.common.AuditStamp", - "doc" : "Audit stamp containing who last modified the status and when." + "doc" : "Audit stamp containing who last modified the status and when.", + "Searchable" : { + "/time" : { + "fieldName" : "statusLastModifiedAt", + "fieldType" : "COUNT" + } + } } ], "Aspect" : { "name" : "corpUserStatus" @@ -3249,8 +3264,9 @@ }, { "name" : "label", "type" : "string", - "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.", + "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.\n\nNote that this field is deprecated and is not surfaced in the UI.", "optional" : true, + "Deprecated" : true, "Searchable" : { "boostScore" : 0.2, "fieldName" : "fieldLabels", @@ -5344,7 +5360,12 @@ "items" : "com.linkedin.common.Urn" }, "doc" : "A specific set of users to apply the policy to (disjunctive)", - "optional" : true + "optional" : true, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } + } }, { "name" : "groups", "type" : { @@ -5352,7 +5373,12 @@ "items" : "com.linkedin.common.Urn" }, "doc" : "A specific set of groups to apply the policy to (disjunctive)", - "optional" : true + "optional" : true, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } + } }, { "name" : "resourceOwners", "type" : "boolean", @@ -5370,12 +5396,18 @@ "name" : "allUsers", "type" : "boolean", "doc" : "Whether the filter should apply to all users.", - "default" : false + "default" : false, + "Searchable" : { + "fieldType" : "BOOLEAN" + } }, { "name" : "allGroups", "type" : "boolean", "doc" : "Whether the filter should apply to all groups.", - "default" : false + "default" : false, + "Searchable" : { + "fieldType" : "BOOLEAN" + } }, { "name" : "roles", "type" : { @@ -5389,6 +5421,11 @@ "entityTypes" : [ "dataHubRole" ], "name" : "IsAssociatedWithRole" } + }, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } } } ] }, diff --git a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.runs.snapshot.json b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.runs.snapshot.json index 0139072b2ae153..e1c8d3007d59d1 100644 --- a/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.runs.snapshot.json +++ b/metadata-service/restli-api/src/main/snapshot/com.linkedin.entity.runs.snapshot.json @@ -585,10 +585,10 @@ "PRE" : "Designates pre-production fabrics", "PROD" : "Designates production fabrics", "QA" : "Designates quality assurance fabrics", + "RVW" : "Designates review fabrics", "STG" : "Designates staging fabrics", "TEST" : "Designates testing fabrics", - "UAT" : "Designates user acceptance testing fabrics", - "RVW" : "Designates review fabrics" + "UAT" : "Designates user acceptance testing fabrics" } }, { "type" : "record", @@ -2222,7 +2222,13 @@ }, { "name" : "lastModified", "type" : "com.linkedin.common.AuditStamp", - "doc" : "Audit stamp containing who last modified the status and when." + "doc" : "Audit stamp containing who last modified the status and when.", + "Searchable" : { + "/time" : { + "fieldName" : "statusLastModifiedAt", + "fieldType" : "COUNT" + } + } } ], "Aspect" : { "name" : "corpUserStatus" @@ -2594,8 +2600,9 @@ }, { "name" : "label", "type" : "string", - "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.", + "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.\n\nNote that this field is deprecated and is not surfaced in the UI.", "optional" : true, + "Deprecated" : true, "Searchable" : { "boostScore" : 0.2, "fieldName" : "fieldLabels", diff --git a/metadata-service/restli-api/src/main/snapshot/com.linkedin.operations.operations.snapshot.json b/metadata-service/restli-api/src/main/snapshot/com.linkedin.operations.operations.snapshot.json index 1caeed2570317e..8572ae2f079432 100644 --- a/metadata-service/restli-api/src/main/snapshot/com.linkedin.operations.operations.snapshot.json +++ b/metadata-service/restli-api/src/main/snapshot/com.linkedin.operations.operations.snapshot.json @@ -585,10 +585,10 @@ "PRE" : "Designates pre-production fabrics", "PROD" : "Designates production fabrics", "QA" : "Designates quality assurance fabrics", + "RVW" : "Designates review fabrics", "STG" : "Designates staging fabrics", "TEST" : "Designates testing fabrics", - "UAT" : "Designates user acceptance testing fabrics", - "RVW" : "Designates review fabrics" + "UAT" : "Designates user acceptance testing fabrics" } }, { "type" : "record", @@ -2216,7 +2216,13 @@ }, { "name" : "lastModified", "type" : "com.linkedin.common.AuditStamp", - "doc" : "Audit stamp containing who last modified the status and when." + "doc" : "Audit stamp containing who last modified the status and when.", + "Searchable" : { + "/time" : { + "fieldName" : "statusLastModifiedAt", + "fieldType" : "COUNT" + } + } } ], "Aspect" : { "name" : "corpUserStatus" @@ -2588,8 +2594,9 @@ }, { "name" : "label", "type" : "string", - "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.", + "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.\n\nNote that this field is deprecated and is not surfaced in the UI.", "optional" : true, + "Deprecated" : true, "Searchable" : { "boostScore" : 0.2, "fieldName" : "fieldLabels", diff --git a/metadata-service/restli-api/src/main/snapshot/com.linkedin.platform.platform.snapshot.json b/metadata-service/restli-api/src/main/snapshot/com.linkedin.platform.platform.snapshot.json index 1592333988b4ca..ab0b935d3969e5 100644 --- a/metadata-service/restli-api/src/main/snapshot/com.linkedin.platform.platform.snapshot.json +++ b/metadata-service/restli-api/src/main/snapshot/com.linkedin.platform.platform.snapshot.json @@ -843,10 +843,10 @@ "PRE" : "Designates pre-production fabrics", "PROD" : "Designates production fabrics", "QA" : "Designates quality assurance fabrics", + "RVW" : "Designates review fabrics", "STG" : "Designates staging fabrics", "TEST" : "Designates testing fabrics", - "UAT" : "Designates user acceptance testing fabrics", - "RVW" : "Designates review fabrics" + "UAT" : "Designates user acceptance testing fabrics" } }, { "type" : "record", @@ -2242,6 +2242,15 @@ "fieldName" : "editedDescription", "fieldType" : "TEXT" } + }, { + "name" : "name", + "type" : "string", + "doc" : "Editable display name of the Dataset", + "optional" : true, + "Searchable" : { + "fieldName" : "editedName", + "fieldType" : "TEXT_PARTIAL" + } } ], "Aspect" : { "name" : "editableDatasetProperties" @@ -2795,7 +2804,13 @@ }, { "name" : "lastModified", "type" : "com.linkedin.common.AuditStamp", - "doc" : "Audit stamp containing who last modified the status and when." + "doc" : "Audit stamp containing who last modified the status and when.", + "Searchable" : { + "/time" : { + "fieldName" : "statusLastModifiedAt", + "fieldType" : "COUNT" + } + } } ], "Aspect" : { "name" : "corpUserStatus" @@ -3243,8 +3258,9 @@ }, { "name" : "label", "type" : "string", - "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.", + "doc" : "Label of the field. Provides a more human-readable name for the field than field path. Some sources will\nprovide this metadata but not all sources have the concept of a label. If just one string is associated with\na field in a source, that is most likely a description.\n\nNote that this field is deprecated and is not surfaced in the UI.", "optional" : true, + "Deprecated" : true, "Searchable" : { "boostScore" : 0.2, "fieldName" : "fieldLabels", @@ -5338,7 +5354,12 @@ "items" : "com.linkedin.common.Urn" }, "doc" : "A specific set of users to apply the policy to (disjunctive)", - "optional" : true + "optional" : true, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } + } }, { "name" : "groups", "type" : { @@ -5346,7 +5367,12 @@ "items" : "com.linkedin.common.Urn" }, "doc" : "A specific set of groups to apply the policy to (disjunctive)", - "optional" : true + "optional" : true, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } + } }, { "name" : "resourceOwners", "type" : "boolean", @@ -5364,12 +5390,18 @@ "name" : "allUsers", "type" : "boolean", "doc" : "Whether the filter should apply to all users.", - "default" : false + "default" : false, + "Searchable" : { + "fieldType" : "BOOLEAN" + } }, { "name" : "allGroups", "type" : "boolean", "doc" : "Whether the filter should apply to all groups.", - "default" : false + "default" : false, + "Searchable" : { + "fieldType" : "BOOLEAN" + } }, { "name" : "roles", "type" : { @@ -5383,6 +5415,11 @@ "entityTypes" : [ "dataHubRole" ], "name" : "IsAssociatedWithRole" } + }, + "Searchable" : { + "/*" : { + "fieldType" : "URN" + } } } ] }, From 19b9f220b71e4ac0d4485ae08b7f58cba2065ea2 Mon Sep 17 00:00:00 2001 From: Jay Kadambi Date: Tue, 16 Jul 2024 20:21:09 -0500 Subject: [PATCH 2/3] Implement feature flag to enable editable dataset name --- .../linkedin/datahub/graphql/featureflags/FeatureFlags.java | 1 + .../datahub/graphql/resolvers/config/AppConfigResolver.java | 1 + datahub-graphql-core/src/main/resources/app.graphql | 5 +++++ .../shared/containers/profile/header/EntityHeader.tsx | 6 ++++-- datahub-web-react/src/app/useAppConfig.ts | 5 +++++ datahub-web-react/src/appConfigContext.tsx | 1 + datahub-web-react/src/graphql/app.graphql | 1 + 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/featureflags/FeatureFlags.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/featureflags/FeatureFlags.java index 2a9af37a06ad9e..faa51d9b671230 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/featureflags/FeatureFlags.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/featureflags/FeatureFlags.java @@ -21,4 +21,5 @@ public class FeatureFlags { private boolean schemaFieldEntityFetchEnabled = false; private boolean businessAttributeEntityEnabled = false; private boolean dataContractsEnabled = false; + private boolean editableDatasetNameEnabled = false; } diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/config/AppConfigResolver.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/config/AppConfigResolver.java index caa469003c22e2..743a4c24024548 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/config/AppConfigResolver.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/resolvers/config/AppConfigResolver.java @@ -186,6 +186,7 @@ public CompletableFuture get(final DataFetchingEnvironment environmen .setNestedDomainsEnabled(_featureFlags.isNestedDomainsEnabled()) .setPlatformBrowseV2(_featureFlags.isPlatformBrowseV2()) .setDataContractsEnabled(_featureFlags.isDataContractsEnabled()) + .setEditableDatasetNameEnabled(_featureFlags.isEditableDatasetNameEnabled()) .build(); appConfig.setFeatureFlags(featureFlagsConfig); diff --git a/datahub-graphql-core/src/main/resources/app.graphql b/datahub-graphql-core/src/main/resources/app.graphql index b3a965981c366a..9135242477e7ee 100644 --- a/datahub-graphql-core/src/main/resources/app.graphql +++ b/datahub-graphql-core/src/main/resources/app.graphql @@ -497,6 +497,11 @@ type FeatureFlagsConfig { Whether data contracts should be enabled """ dataContractsEnabled: Boolean! + + """ + Whether dataset names are editable + """ + editableDatasetNameEnabled: Boolean! } """ diff --git a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx index 575516bfacdc18..daab1ea836b24a 100644 --- a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx +++ b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx @@ -17,6 +17,7 @@ import { capitalizeFirstLetterOnly } from '../../../../../shared/textUtil'; import { useUserContext } from '../../../../../context/useUserContext'; import { useEntityRegistry } from '../../../../../useEntityRegistry'; import EntityHeaderLoadingSection from './EntityHeaderLoadingSection'; +import { useIsEditableDatasetNameEnabled } from '../../../../../useAppConfig'; const TitleWrapper = styled.div` display: flex; @@ -96,8 +97,9 @@ export const EntityHeader = ({ headerDropdownItems, headerActionItems, isNameEdi const entityName = entityData?.name; const subType = capitalizeFirstLetterOnly(entityData?.subTypes?.typeNames?.[0]) || undefined; + const isEditableDatasetNameEnabled = useIsEditableDatasetNameEnabled(); const canEditName = - isNameEditable && getCanEditName(entityType, entityData, me?.platformPrivileges as PlatformPrivileges); + isEditableDatasetNameEnabled && isNameEditable && getCanEditName(entityType, entityData, me?.platformPrivileges as PlatformPrivileges); const entityRegistry = useEntityRegistry(); return ( @@ -108,7 +110,7 @@ export const EntityHeader = ({ headerDropdownItems, headerActionItems, isNameEdi <> - + {entityData?.deprecation?.deprecated && ( Date: Thu, 8 Aug 2024 16:32:29 -0500 Subject: [PATCH 3/3] Fix yarn lint issues --- datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx | 2 +- .../entity/shared/containers/profile/header/EntityHeader.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx index 8756c0c3dcfbe7..21ae085832cb3f 100644 --- a/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx +++ b/datahub-web-react/src/app/entity/dataset/DatasetEntity.tsx @@ -220,7 +220,7 @@ export class DatasetEntity implements Entity { }, ]} sidebarSections={this.getSidebarSections()} - isNameEditable={true} + isNameEditable /> ); diff --git a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx index daab1ea836b24a..11335d0378760c 100644 --- a/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx +++ b/datahub-web-react/src/app/entity/shared/containers/profile/header/EntityHeader.tsx @@ -99,7 +99,9 @@ export const EntityHeader = ({ headerDropdownItems, headerActionItems, isNameEdi const isEditableDatasetNameEnabled = useIsEditableDatasetNameEnabled(); const canEditName = - isEditableDatasetNameEnabled && isNameEditable && getCanEditName(entityType, entityData, me?.platformPrivileges as PlatformPrivileges); + isEditableDatasetNameEnabled && + isNameEditable && + getCanEditName(entityType, entityData, me?.platformPrivileges as PlatformPrivileges); const entityRegistry = useEntityRegistry(); return (