From d340efa6645fcedfbe7b794fb8a95bc6a5f63e8b Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Tue, 21 Nov 2023 16:46:17 +0530 Subject: [PATCH] ui: only allow updating displayName for domain and data product (#14050) * ui: only allow updating displayName for domain and data product * change title edit name to edit display name --- .../resources/ui/cypress/common/DomainUtils.js | 16 ++-------------- .../DataProductsDetailsPage.component.tsx | 6 ++---- .../DomainDetailsPage.component.tsx | 6 ++---- 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js index b17eff038c6..7ad16e9efd5 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.js @@ -62,16 +62,6 @@ const checkDisplayName = (displayName) => { }); }; -const checkName = (name) => { - cy.get('[data-testid="entity-header-name"]') - .scrollIntoView() - .should('exist') - .and('be.visible') - .within(() => { - cy.contains(name); - }); -}; - const updateOwner = (newOwner) => { interceptURL('PATCH', `/api/v1/domains/*`, 'patchOwner'); interceptURL('GET', '/api/v1/users?limit=25&isBot=false', 'getUsers'); @@ -290,7 +280,7 @@ export const deleteDomain = (domainObj) => { cy.get('[data-testid="delete-modal"] .ant-modal-title').should( 'contain', - `Delete ${domainObj.updatedName}` + `Delete ${domainObj.name}` ); cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM); @@ -371,15 +361,13 @@ export const renameDomain = (domainObj) => { cy.get('[data-testid="manage-button"]').click(); cy.get('[data-testid="rename-button-details-container"]').click(); - cy.get('#name').should('not.be.disabled').clear(); + cy.get('#name').should('be.disabled'); cy.get('#displayName').should('not.be.disabled').clear(); - cy.get('#name').type(domainObj.updatedName); cy.get('#displayName').type(domainObj.updatedDisplayName); cy.get('[data-testid="save-button"]').click(); verifyResponseStatusCode('@patchName&DisplayName', 200); - checkName(domainObj.updatedName); checkDisplayName(domainObj.updatedDisplayName); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx index 2d144865290..f23d7e664e9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataProducts/DataProductsDetailsPage/DataProductsDetailsPage.component.tsx @@ -312,12 +312,11 @@ const DataProductsDetailsPage = ({ const onNameSave = (obj: { name: string; displayName: string }) => { if (dataProduct) { - const { name, displayName } = obj; + const { displayName } = obj; let updatedDetails = cloneDeep(dataProduct); updatedDetails = { ...dataProduct, - name: name?.trim() || dataProduct.name, displayName: displayName?.trim(), }; @@ -548,10 +547,9 @@ const DataProductsDetailsPage = ({ setIsNameEditing(false)} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetailsPage/DomainDetailsPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetailsPage/DomainDetailsPage.component.tsx index d815a72fd85..4d0af1fe966 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetailsPage/DomainDetailsPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Domain/DomainDetailsPage/DomainDetailsPage.component.tsx @@ -300,12 +300,11 @@ const DomainDetailsPage = ({ }, []); const onNameSave = (obj: { name: string; displayName: string }) => { - const { name, displayName } = obj; + const { displayName } = obj; let updatedDetails = cloneDeep(domain); updatedDetails = { ...domain, - name: name?.trim() || domain.name, displayName: displayName?.trim(), }; @@ -650,10 +649,9 @@ const DomainDetailsPage = ({ /> )} setIsNameEditing(false)}