mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-16 10:08:08 +00:00
Fix(UI): Loader not shown while fetching permissions on teams page (#7882)
* Fixed issue with no permissions placeholder showing before the data is displayed on teams page * Fixed failing cypress tests for teams page
This commit is contained in:
parent
ba37fda0f1
commit
1e00d0d487
@ -67,9 +67,12 @@ describe('Teams flow should work properly', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Add user to created team', () => {
|
it('Add user to created team', () => {
|
||||||
|
interceptURL('GET', '/api/v1/users*', 'getUsers');
|
||||||
|
|
||||||
//Click on created team
|
//Click on created team
|
||||||
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
|
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
|
||||||
|
|
||||||
|
verifyResponseStatusCode('@getUsers', 200);
|
||||||
//Clicking on users tab
|
//Clicking on users tab
|
||||||
cy.get('[data-testid="Users"]')
|
cy.get('[data-testid="Users"]')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@ -140,9 +143,12 @@ describe('Teams flow should work properly', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Join team should work properly', () => {
|
it('Join team should work properly', () => {
|
||||||
|
interceptURL('GET', '/api/v1/users*', 'getUsers');
|
||||||
//Click on created team
|
//Click on created team
|
||||||
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
|
cy.get('table').find('.ant-table-row').contains(TEAM_DETAILS.name).click();
|
||||||
|
|
||||||
|
verifyResponseStatusCode('@getUsers', 200);
|
||||||
|
|
||||||
//Click on join teams button
|
//Click on join teams button
|
||||||
cy.get('[data-testid="join-teams"]').should('be.visible').click();
|
cy.get('[data-testid="join-teams"]').should('be.visible').click();
|
||||||
|
|
||||||
|
|||||||
@ -163,6 +163,7 @@ const TeamDetailsV1 = ({
|
|||||||
TitleBreadcrumbProps['titleLinks']
|
TitleBreadcrumbProps['titleLinks']
|
||||||
>([]);
|
>([]);
|
||||||
const [addAttribute, setAddAttribute] = useState<AddAttribute>();
|
const [addAttribute, setAddAttribute] = useState<AddAttribute>();
|
||||||
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [selectedEntity, setEntity] = useState<{
|
const [selectedEntity, setEntity] = useState<{
|
||||||
attribute: 'defaultRoles' | 'policies';
|
attribute: 'defaultRoles' | 'policies';
|
||||||
record: EntityReference;
|
record: EntityReference;
|
||||||
@ -491,6 +492,7 @@ const TeamDetailsV1 = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fetchPermissions = async () => {
|
const fetchPermissions = async () => {
|
||||||
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
const perms = await getEntityPermission(
|
const perms = await getEntityPermission(
|
||||||
ResourceEntity.TEAM,
|
ResourceEntity.TEAM,
|
||||||
@ -502,6 +504,8 @@ const TeamDetailsV1 = ({
|
|||||||
error as AxiosError,
|
error as AxiosError,
|
||||||
jsonData['api-error-messages']['fetch-user-permission-error']
|
jsonData['api-error-messages']['fetch-user-permission-error']
|
||||||
);
|
);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -859,6 +863,10 @@ const TeamDetailsV1 = ({
|
|||||||
const viewPermission =
|
const viewPermission =
|
||||||
entityPermissions.ViewAll || entityPermissions.ViewBasic;
|
entityPermissions.ViewAll || entityPermissions.ViewBasic;
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return <Loader />;
|
||||||
|
}
|
||||||
|
|
||||||
return viewPermission ? (
|
return viewPermission ? (
|
||||||
<div
|
<div
|
||||||
className="tw-h-full tw-flex tw-flex-col tw-flex-grow"
|
className="tw-h-full tw-flex tw-flex-col tw-flex-grow"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user