mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 18:00:17 +01:00
Fix report create for view only, fix createdby on save and add column in team websites table
This commit is contained in:
parent
fd1b9ff7b4
commit
8fbd6871f7
@ -1,20 +1,25 @@
|
|||||||
import PageHeader from 'components/layout/PageHeader';
|
import PageHeader from 'components/layout/PageHeader';
|
||||||
import { Icon, Icons, Text } from 'react-basics';
|
import { Icon, Icons, Text } from 'react-basics';
|
||||||
import { useMessages, useTeamUrl } from 'components/hooks';
|
import { useLogin, useMessages, useTeamUrl } from 'components/hooks';
|
||||||
import LinkButton from 'components/common/LinkButton';
|
import LinkButton from 'components/common/LinkButton';
|
||||||
|
import { ROLES } from 'lib/constants';
|
||||||
|
|
||||||
export function ReportsHeader() {
|
export function ReportsHeader() {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { renderTeamUrl } = useTeamUrl();
|
const { renderTeamUrl } = useTeamUrl();
|
||||||
|
const { user } = useLogin();
|
||||||
|
const canEdit = user.role !== ROLES.viewOnly;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageHeader title={formatMessage(labels.reports)}>
|
<PageHeader title={formatMessage(labels.reports)}>
|
||||||
|
{canEdit && (
|
||||||
<LinkButton href={renderTeamUrl('/reports/create')} variant="primary">
|
<LinkButton href={renderTeamUrl('/reports/create')} variant="primary">
|
||||||
<Icon>
|
<Icon>
|
||||||
<Icons.Plus />
|
<Icons.Plus />
|
||||||
</Icon>
|
</Icon>
|
||||||
<Text>{formatMessage(labels.createReport)}</Text>
|
<Text>{formatMessage(labels.createReport)}</Text>
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
|
)}
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,15 @@ export function TeamWebsitesTable({
|
|||||||
allowEdit?: boolean;
|
allowEdit?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const { user } = useLogin();
|
const { user } = useLogin();
|
||||||
|
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GridTable data={data}>
|
<GridTable data={data}>
|
||||||
<GridColumn name="name" label={formatMessage(labels.name)} />
|
<GridColumn name="name" label={formatMessage(labels.name)} />
|
||||||
<GridColumn name="domain" label={formatMessage(labels.domain)} />
|
<GridColumn name="domain" label={formatMessage(labels.domain)} />
|
||||||
|
<GridColumn name="createdBy" label={formatMessage(labels.createdBy)}>
|
||||||
|
{row => row?.createUser?.username}
|
||||||
|
</GridColumn>
|
||||||
<GridColumn name="action" label=" " alignment="end">
|
<GridColumn name="action" label=" " alignment="end">
|
||||||
{row => {
|
{row => {
|
||||||
const { id: websiteId } = row;
|
const { id: websiteId } = row;
|
||||||
|
@ -26,6 +26,7 @@ export const labels = defineMessages({
|
|||||||
myWebsites: { id: 'label.my-websites', defaultMessage: 'My websites' },
|
myWebsites: { id: 'label.my-websites', defaultMessage: 'My websites' },
|
||||||
teamWebsites: { id: 'label.team-websites', defaultMessage: 'Team websites' },
|
teamWebsites: { id: 'label.team-websites', defaultMessage: 'Team websites' },
|
||||||
created: { id: 'label.created', defaultMessage: 'Created' },
|
created: { id: 'label.created', defaultMessage: 'Created' },
|
||||||
|
createdBy: { id: 'label.created-by', defaultMessage: 'Created By' },
|
||||||
edit: { id: 'label.edit', defaultMessage: 'Edit' },
|
edit: { id: 'label.edit', defaultMessage: 'Edit' },
|
||||||
name: { id: 'label.name', defaultMessage: 'Name' },
|
name: { id: 'label.name', defaultMessage: 'Name' },
|
||||||
member: { id: 'label.member', defaultMessage: 'Member' },
|
member: { id: 'label.member', defaultMessage: 'Member' },
|
||||||
|
@ -62,6 +62,7 @@ export default async (
|
|||||||
|
|
||||||
const data: any = {
|
const data: any = {
|
||||||
id: uuid(),
|
id: uuid(),
|
||||||
|
createdBy: userId,
|
||||||
name,
|
name,
|
||||||
domain,
|
domain,
|
||||||
shareId,
|
shareId,
|
||||||
|
@ -87,7 +87,7 @@ export async function getTeamWebsites(
|
|||||||
teamId,
|
teamId,
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
user: {
|
createUser: {
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
username: true,
|
username: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user