diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index 3d5c78bbad1..153c435b217 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -805,7 +805,7 @@ export const deleteCreatedProperty = (propertyName) => { .should('be.visible'); }; -export const updateOwner = () => { +export const updateOwner = (isAddingOwnerToTeam = false) => { cy.get('[data-testid="avatar"]').should('be.visible').click(); cy.get('[data-testid="user-name"]') .should('exist') @@ -822,12 +822,14 @@ export const updateOwner = () => { verifyResponseStatusCode('@getTeams', 200); - // Clicking on users tab - cy.get('button[data-testid="dropdown-tab"]') - .should('exist') - .should('be.visible') - .contains('Users') - .click(); + if (!isAddingOwnerToTeam) { + // Clicking on users tab + cy.get('button[data-testid="dropdown-tab"]') + .should('exist') + .should('be.visible') + .contains('Users') + .click(); + } cy.get('[data-testid="list-item"]') .first() diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js index 164e7b63b1e..f7d7c292c50 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Teams.spec.js @@ -74,7 +74,7 @@ describe('Teams flow should work properly', () => { cy.get(`[data-row-key="${TEAM_DETAILS.name}"]`) .contains(TEAM_DETAILS.name) .click(); - updateOwner(); + updateOwner(true); }); it('Add user to created team', () => { diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx index 5a929e8f4e8..719ea349534 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetailsV1.tsx @@ -1119,6 +1119,7 @@ const TeamDetailsV1 = ({ {extraInfo.map((info, index) => ( void; deleted?: boolean; + allowTeamOwner?: boolean; } const EditIcon = ({ iconClasses }: { iconClasses?: string }): JSX.Element => ( @@ -80,6 +81,7 @@ const EntitySummaryDetails = ({ removeTier, currentOwner, deleted = false, + allowTeamOwner = true, }: GetInfoElementsProps) => { let retVal = <>; const { t } = useTranslation(); @@ -360,6 +362,7 @@ const EntitySummaryDetails = ({ )} setShow(false)} removeOwner={removeOwner} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerWidget/OwnerWidgetWrapper.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerWidget/OwnerWidgetWrapper.component.tsx index a08cb5de983..85f565ffad3 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerWidget/OwnerWidgetWrapper.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/OwnerWidget/OwnerWidgetWrapper.component.tsx @@ -204,9 +204,9 @@ const OwnerWidgetWrapper = ({ } }, [searchText]); - const getOwnerGroup = () => { + const ownerGroupList = useMemo(() => { return allowTeamOwner ? ['Teams', 'Users'] : ['Users']; - }; + }, [allowTeamOwner]); const handleSearchOwnerDropdown = (text: string) => { setSearchText(text); @@ -237,9 +237,9 @@ const OwnerWidgetWrapper = ({ controlledSearchStr={searchText} dropDownList={listOwners} getTotalCountForGroup={handleTotalCountForGroup} - groupType="tab" + groupType={ownerGroupList.length > 1 ? 'tab' : 'label'} isLoading={isUserLoading} - listGroups={getOwnerGroup()} + listGroups={ownerGroupList} removeOwner={handleRemoveOwner} showSearchBar={isCurrentUserAdmin()} value={owner?.id || ''}