Skip to content

Commit

Permalink
feat(ui): add loading spin to access management table
Browse files Browse the repository at this point in the history
  • Loading branch information
filipe-caetano-ovo committed Mar 4, 2024
1 parent d987707 commit aeb9a86
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { GetDatasetQuery, useGetExternalRolesQuery } from '../../../../../../gra
import { useGetMeQuery } from '../../../../../../graphql/me.generated';
import { handleAccessRoles } from './utils';
import AccessManagerDescription from './AccessManagerDescription';
import { SpinProps } from 'antd/es/spin';
import { LoadingOutlined } from '@ant-design/icons';

const StyledTable = styled(Table)`
overflow: inherit;
Expand Down Expand Up @@ -59,7 +61,7 @@ const AccessButton = styled(Button)`
export default function AccessManagement() {
const { data: loggedInUser } = useGetMeQuery({ fetchPolicy: 'cache-first' });
const baseEntity = useBaseEntity<GetDatasetQuery>();
const { data: externalRoles } = useGetExternalRolesQuery({
const { data: externalRoles, loading: isLoading } = useGetExternalRolesQuery({
variables: { urn: baseEntity?.dataset?.urn as string },
skip: !baseEntity?.dataset?.urn,
});
Expand Down Expand Up @@ -108,8 +110,12 @@ export default function AccessManagement() {
hidden: true,
},
];

const spinProps: SpinProps = { indicator: <LoadingOutlined style={{ fontSize: 28 }} spin /> }
return (
<StyledTable dataSource={handleAccessRoles(externalRoles, loggedInUser)} columns={columns} pagination={false} />
);
<StyledTable
loading={isLoading ? spinProps : false}
dataSource={handleAccessRoles(externalRoles, loggedInUser)}
columns={columns} pagination={false}
/>
)
}

0 comments on commit aeb9a86

Please sign in to comment.