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 16e9109d664..573586fb6ce 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 @@ -67,9 +67,12 @@ describe('Teams flow should work properly', () => { }); it('Add user to created team', () => { + interceptURL('GET', '/api/v1/users*', 'getUsers'); + //Click on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); + verifyResponseStatusCode('@getUsers', 200); //Clicking on users tab cy.get('[data-testid="Users"]') .should('exist') @@ -140,9 +143,12 @@ describe('Teams flow should work properly', () => { }); it('Join team should work properly', () => { + interceptURL('GET', '/api/v1/users*', 'getUsers'); //Click on created team cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click(); + verifyResponseStatusCode('@getUsers', 200); + //Click on join teams button cy.get('[data-testid="join-teams"]').should('be.visible').click(); 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 f5fd0d88195..210a0eaa033 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 @@ -163,6 +163,7 @@ const TeamDetailsV1 = ({ TitleBreadcrumbProps['titleLinks'] >([]); const [addAttribute, setAddAttribute] = useState(); + const [loading, setLoading] = useState(false); const [selectedEntity, setEntity] = useState<{ attribute: 'defaultRoles' | 'policies'; record: EntityReference; @@ -491,6 +492,7 @@ const TeamDetailsV1 = ({ }; const fetchPermissions = async () => { + setLoading(true); try { const perms = await getEntityPermission( ResourceEntity.TEAM, @@ -502,6 +504,8 @@ const TeamDetailsV1 = ({ error as AxiosError, jsonData['api-error-messages']['fetch-user-permission-error'] ); + } finally { + setLoading(false); } }; @@ -859,6 +863,10 @@ const TeamDetailsV1 = ({ const viewPermission = entityPermissions.ViewAll || entityPermissions.ViewBasic; + if (loading) { + return ; + } + return viewPermission ? (