mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 18:15:35 +01:00
Fixed issue with removing team members.
This commit is contained in:
parent
096484ebe4
commit
1351e6f14a
10 changed files with 51 additions and 18 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Button, Form, FormButtons, SubmitButton } from 'react-basics';
|
||||
import useApi from 'components/hooks/useApi';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import { setValue } from 'store/cache';
|
||||
|
||||
export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose }) {
|
||||
const { formatMessage, labels, messages, FormattedMessage } = useMessages();
|
||||
|
|
@ -12,6 +13,7 @@ export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose }) {
|
|||
{},
|
||||
{
|
||||
onSuccess: async () => {
|
||||
setValue('team:members', Date.now());
|
||||
onSave();
|
||||
onClose();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export function TeamMembers({ teamId, readOnly }) {
|
|||
return (
|
||||
<>
|
||||
<DataTable queryResult={queryResult}>
|
||||
{({ data }) => <TeamMembersTable data={data} readOnly={readOnly} />}
|
||||
{({ data }) => <TeamMembersTable data={data} teamId={teamId} readOnly={readOnly} />}
|
||||
</DataTable>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { GridColumn, GridTable } from 'react-basics';
|
||||
import { GridColumn, GridTable, useBreakpoint } from 'react-basics';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import useUser from 'components/hooks/useUser';
|
||||
import { ROLES } from 'lib/constants';
|
||||
|
|
@ -7,6 +7,7 @@ import TeamMemberRemoveButton from './TeamMemberRemoveButton';
|
|||
export function TeamMembersTable({ data = [], teamId, readOnly }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { user } = useUser();
|
||||
const breakpoint = useBreakpoint();
|
||||
|
||||
const roles = {
|
||||
[ROLES.teamOwner]: formatMessage(labels.teamOwner),
|
||||
|
|
@ -14,7 +15,7 @@ export function TeamMembersTable({ data = [], teamId, readOnly }) {
|
|||
};
|
||||
|
||||
return (
|
||||
<GridTable data={data}>
|
||||
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||
<GridColumn name="username" label={formatMessage(labels.username)} />
|
||||
<GridColumn name="role" label={formatMessage(labels.role)}>
|
||||
{row => roles[row?.teamUser?.[0]?.role]}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function TeamWebsiteAddForm({ teamId, onSave, onClose }) {
|
|||
|
||||
return (
|
||||
<>
|
||||
{isLoading && !hasData && <Loading />}
|
||||
{isLoading && !hasData && <Loading icon="dots" position="center" />}
|
||||
{!isLoading && !hasData && <Empty />}
|
||||
{hasData && (
|
||||
<Form onSubmit={handleSubmit} error={error}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue