mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-22 09:57:00 +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 { 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 { ROLES } from 'lib/constants';
|
||||
|
||||
export function ReportsHeader() {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { renderTeamUrl } = useTeamUrl();
|
||||
const { user } = useLogin();
|
||||
const canEdit = user.role !== ROLES.viewOnly;
|
||||
|
||||
return (
|
||||
<PageHeader title={formatMessage(labels.reports)}>
|
||||
<LinkButton href={renderTeamUrl('/reports/create')} variant="primary">
|
||||
<Icon>
|
||||
<Icons.Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createReport)}</Text>
|
||||
</LinkButton>
|
||||
{canEdit && (
|
||||
<LinkButton href={renderTeamUrl('/reports/create')} variant="primary">
|
||||
<Icon>
|
||||
<Icons.Plus />
|
||||
</Icon>
|
||||
<Text>{formatMessage(labels.createReport)}</Text>
|
||||
</LinkButton>
|
||||
)}
|
||||
</PageHeader>
|
||||
);
|
||||
}
|
||||
|
@ -13,12 +13,15 @@ export function TeamWebsitesTable({
|
||||
allowEdit?: boolean;
|
||||
}) {
|
||||
const { user } = useLogin();
|
||||
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
return (
|
||||
<GridTable data={data}>
|
||||
<GridColumn name="name" label={formatMessage(labels.name)} />
|
||||
<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">
|
||||
{row => {
|
||||
const { id: websiteId } = row;
|
||||
|
@ -26,6 +26,7 @@ export const labels = defineMessages({
|
||||
myWebsites: { id: 'label.my-websites', defaultMessage: 'My websites' },
|
||||
teamWebsites: { id: 'label.team-websites', defaultMessage: 'Team websites' },
|
||||
created: { id: 'label.created', defaultMessage: 'Created' },
|
||||
createdBy: { id: 'label.created-by', defaultMessage: 'Created By' },
|
||||
edit: { id: 'label.edit', defaultMessage: 'Edit' },
|
||||
name: { id: 'label.name', defaultMessage: 'Name' },
|
||||
member: { id: 'label.member', defaultMessage: 'Member' },
|
||||
|
@ -62,6 +62,7 @@ export default async (
|
||||
|
||||
const data: any = {
|
||||
id: uuid(),
|
||||
createdBy: userId,
|
||||
name,
|
||||
domain,
|
||||
shareId,
|
||||
|
@ -87,7 +87,7 @@ export async function getTeamWebsites(
|
||||
teamId,
|
||||
},
|
||||
include: {
|
||||
user: {
|
||||
createUser: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
|
Loading…
Reference in New Issue
Block a user