mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-26 04:20:52 +01:00
Fixed issue with removing team members.
This commit is contained in:
parent
096484ebe4
commit
1351e6f14a
@ -23,7 +23,7 @@ export function ReportsTable({ data = [], showDomain }) {
|
|||||||
</GridColumn>
|
</GridColumn>
|
||||||
{showDomain && (
|
{showDomain && (
|
||||||
<GridColumn name="domain" label={formatMessage(labels.domain)}>
|
<GridColumn name="domain" label={formatMessage(labels.domain)}>
|
||||||
{row => row.website.domain}
|
{row => row?.website?.domain}
|
||||||
</GridColumn>
|
</GridColumn>
|
||||||
)}
|
)}
|
||||||
<GridColumn name="action" label="" alignment="end">
|
<GridColumn name="action" label="" alignment="end">
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { Icon, LoadingButton, InlineEditField, useToasts } from 'react-basics';
|
import { Icon, LoadingButton, InlineEditField, useToasts, Loading } from 'react-basics';
|
||||||
import PageHeader from 'components/layout/PageHeader';
|
import PageHeader from 'components/layout/PageHeader';
|
||||||
import { useMessages, useApi } from 'components/hooks';
|
import { useMessages, useApi } from 'components/hooks';
|
||||||
import { ReportContext } from './Report';
|
import { ReportContext } from './Report';
|
||||||
import styles from './ReportHeader.module.css';
|
import styles from './ReportHeader.module.css';
|
||||||
import reportStyles from './Report.module.css';
|
import reportStyles from './Report.module.css';
|
||||||
|
import { REPORT_TYPES } from 'lib/constants';
|
||||||
|
|
||||||
export function ReportHeader({ icon }) {
|
export function ReportHeader({ icon }) {
|
||||||
const { report, updateReport } = useContext(ReportContext);
|
const { report, updateReport } = useContext(ReportContext);
|
||||||
@ -49,19 +50,30 @@ export function ReportHeader({ icon }) {
|
|||||||
|
|
||||||
const Title = () => {
|
const Title = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.header}>
|
||||||
<Icon size="lg">{icon}</Icon>
|
<div className={styles.type}>
|
||||||
<InlineEditField
|
{formatMessage(
|
||||||
key={name}
|
labels[Object.keys(REPORT_TYPES).find(key => REPORT_TYPES[key] === report?.type)],
|
||||||
name="name"
|
)}
|
||||||
value={name}
|
</div>
|
||||||
placeholder={defaultName}
|
<div className={styles.title}>
|
||||||
onCommit={handleNameChange}
|
<Icon size="lg">{icon}</Icon>
|
||||||
/>
|
<InlineEditField
|
||||||
</>
|
key={name}
|
||||||
|
name="name"
|
||||||
|
value={name}
|
||||||
|
placeholder={defaultName}
|
||||||
|
onCommit={handleNameChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!report) {
|
||||||
|
return <Loading />;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={reportStyles.header}>
|
<div className={reportStyles.header}>
|
||||||
<PageHeader title={<Title />}>
|
<PageHeader title={<Title />}>
|
||||||
|
@ -1,3 +1,20 @@
|
|||||||
.description {
|
.description {
|
||||||
color: var(--font-color300);
|
color: var(--font-color300);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.type {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--base600);
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
||||||
|
@ -19,6 +19,7 @@ export function RetentionParameters() {
|
|||||||
const handleSubmit = (data, e) => {
|
const handleSubmit = (data, e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
if (!queryDisabled) {
|
if (!queryDisabled) {
|
||||||
runReport(data);
|
runReport(data);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { Button, Form, FormButtons, SubmitButton } from 'react-basics';
|
import { Button, Form, FormButtons, SubmitButton } from 'react-basics';
|
||||||
import useApi from 'components/hooks/useApi';
|
import useApi from 'components/hooks/useApi';
|
||||||
import useMessages from 'components/hooks/useMessages';
|
import useMessages from 'components/hooks/useMessages';
|
||||||
|
import { setValue } from 'store/cache';
|
||||||
|
|
||||||
export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose }) {
|
export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose }) {
|
||||||
const { formatMessage, labels, messages, FormattedMessage } = useMessages();
|
const { formatMessage, labels, messages, FormattedMessage } = useMessages();
|
||||||
@ -12,6 +13,7 @@ export function TeamLeaveForm({ teamId, userId, teamName, onSave, onClose }) {
|
|||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
|
setValue('team:members', Date.now());
|
||||||
onSave();
|
onSave();
|
||||||
onClose();
|
onClose();
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@ export function TeamMembers({ teamId, readOnly }) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<DataTable queryResult={queryResult}>
|
<DataTable queryResult={queryResult}>
|
||||||
{({ data }) => <TeamMembersTable data={data} readOnly={readOnly} />}
|
{({ data }) => <TeamMembersTable data={data} teamId={teamId} readOnly={readOnly} />}
|
||||||
</DataTable>
|
</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 useMessages from 'components/hooks/useMessages';
|
||||||
import useUser from 'components/hooks/useUser';
|
import useUser from 'components/hooks/useUser';
|
||||||
import { ROLES } from 'lib/constants';
|
import { ROLES } from 'lib/constants';
|
||||||
@ -7,6 +7,7 @@ import TeamMemberRemoveButton from './TeamMemberRemoveButton';
|
|||||||
export function TeamMembersTable({ data = [], teamId, readOnly }) {
|
export function TeamMembersTable({ data = [], teamId, readOnly }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { user } = useUser();
|
const { user } = useUser();
|
||||||
|
const breakpoint = useBreakpoint();
|
||||||
|
|
||||||
const roles = {
|
const roles = {
|
||||||
[ROLES.teamOwner]: formatMessage(labels.teamOwner),
|
[ROLES.teamOwner]: formatMessage(labels.teamOwner),
|
||||||
@ -14,7 +15,7 @@ export function TeamMembersTable({ data = [], teamId, readOnly }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GridTable data={data}>
|
<GridTable data={data} cardMode={['xs', 'sm', 'md'].includes(breakpoint)}>
|
||||||
<GridColumn name="username" label={formatMessage(labels.username)} />
|
<GridColumn name="username" label={formatMessage(labels.username)} />
|
||||||
<GridColumn name="role" label={formatMessage(labels.role)}>
|
<GridColumn name="role" label={formatMessage(labels.role)}>
|
||||||
{row => roles[row?.teamUser?.[0]?.role]}
|
{row => roles[row?.teamUser?.[0]?.role]}
|
||||||
|
@ -33,7 +33,7 @@ export function TeamWebsiteAddForm({ teamId, onSave, onClose }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isLoading && !hasData && <Loading />}
|
{isLoading && !hasData && <Loading icon="dots" position="center" />}
|
||||||
{!isLoading && !hasData && <Empty />}
|
{!isLoading && !hasData && <Empty />}
|
||||||
{hasData && (
|
{hasData && (
|
||||||
<Form onSubmit={handleSubmit} error={error}>
|
<Form onSubmit={handleSubmit} error={error}>
|
||||||
|
@ -5,7 +5,7 @@ import useMessages from 'components/hooks/useMessages';
|
|||||||
export function WebsiteSelect({ websiteId, onSelect }) {
|
export function WebsiteSelect({ websiteId, onSelect }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { get, useQuery } = useApi();
|
const { get, useQuery } = useApi();
|
||||||
const { data } = useQuery(['websites:me'], () => get('/me/websites'));
|
const { data } = useQuery(['websites:me'], () => get('/me/websites', { pageSize: 100 }));
|
||||||
|
|
||||||
const renderValue = value => {
|
const renderValue = value => {
|
||||||
return data?.data?.find(({ id }) => id === value)?.name;
|
return data?.data?.find(({ id }) => id === value)?.name;
|
||||||
|
@ -3,7 +3,7 @@ import React, { ReactNode } from 'react';
|
|||||||
import styles from './PageHeader.module.css';
|
import styles from './PageHeader.module.css';
|
||||||
|
|
||||||
export interface PageHeaderProps {
|
export interface PageHeaderProps {
|
||||||
title?: string;
|
title?: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user