Skip to content

Commit

Permalink
feat(ui): add loading spin to access management table (#9974)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipe-caetano-ovo authored Mar 5, 2024
1 parent 782d33d commit a0efb9d
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import styled from 'styled-components';
import { Button, Table } from 'antd';
import { SpinProps } from 'antd/es/spin';
import { LoadingOutlined } from '@ant-design/icons';
import { useBaseEntity } from '../../../EntityContext';
import { GetDatasetQuery, useGetExternalRolesQuery } from '../../../../../../graphql/dataset.generated';
import { useGetMeQuery } from '../../../../../../graphql/me.generated';
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 a0efb9d

Please sign in to comment.