mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +01:00
Fix website reports route type error and pass teamId to board WebsiteSelect.
Remove invalid 3rd parameter from GET handler and parse report type from query params instead. Pass teamId to WebsiteSelect in BoardEditHeader so it shows team websites in team context. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
fed8d4c71a
commit
f595da612c
2 changed files with 10 additions and 7 deletions
|
|
@ -14,7 +14,7 @@ import { WebsiteSelect } from '@/components/input/WebsiteSelect';
|
||||||
export function BoardEditHeader() {
|
export function BoardEditHeader() {
|
||||||
const { board, updateBoard, saveBoard, isPending } = useBoard();
|
const { board, updateBoard, saveBoard, isPending } = useBoard();
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { router, renderUrl } = useNavigation();
|
const { teamId, router, renderUrl } = useNavigation();
|
||||||
const defaultName = formatMessage(labels.untitled);
|
const defaultName = formatMessage(labels.untitled);
|
||||||
|
|
||||||
const handleNameChange = (value: string) => {
|
const handleNameChange = (value: string) => {
|
||||||
|
|
@ -81,7 +81,11 @@ export function BoardEditHeader() {
|
||||||
</Row>
|
</Row>
|
||||||
<Row alignItems="center" gap="3">
|
<Row alignItems="center" gap="3">
|
||||||
<Text>{formatMessage(labels.website)}</Text>
|
<Text>{formatMessage(labels.website)}</Text>
|
||||||
<WebsiteSelect websiteId={board?.parameters?.websiteId} onChange={handleWebsiteChange} />
|
<WebsiteSelect
|
||||||
|
websiteId={board?.parameters?.websiteId}
|
||||||
|
teamId={teamId}
|
||||||
|
onChange={handleWebsiteChange}
|
||||||
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
</Column>
|
</Column>
|
||||||
<Column justifyContent="center" alignItems="flex-end">
|
<Column justifyContent="center" alignItems="flex-end">
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { parseRequest } from '@/lib/request';
|
import { parseRequest } from '@/lib/request';
|
||||||
import { json, unauthorized } from '@/lib/response';
|
import { json, unauthorized } from '@/lib/response';
|
||||||
import { filterParams, pagingParams } from '@/lib/schema';
|
import { pagingParams, reportTypeParam } from '@/lib/schema';
|
||||||
import { canViewWebsite } from '@/permissions';
|
import { canViewWebsite } from '@/permissions';
|
||||||
import { getReports } from '@/queries/prisma';
|
import { getReports } from '@/queries/prisma';
|
||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
request: Request,
|
request: Request,
|
||||||
{ params }: { params: Promise<{ websiteId: string }> },
|
{ params }: { params: Promise<{ websiteId: string }> },
|
||||||
filters: { type: string },
|
|
||||||
) {
|
) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
...filterParams,
|
type: reportTypeParam.optional(),
|
||||||
...pagingParams,
|
...pagingParams,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -22,7 +21,7 @@ export async function GET(
|
||||||
}
|
}
|
||||||
|
|
||||||
const { websiteId } = await params;
|
const { websiteId } = await params;
|
||||||
const { page, pageSize, search } = query;
|
const { type, page, pageSize, search } = query;
|
||||||
|
|
||||||
if (!(await canViewWebsite(auth, websiteId))) {
|
if (!(await canViewWebsite(auth, websiteId))) {
|
||||||
return unauthorized();
|
return unauthorized();
|
||||||
|
|
@ -32,7 +31,7 @@ export async function GET(
|
||||||
{
|
{
|
||||||
where: {
|
where: {
|
||||||
websiteId,
|
websiteId,
|
||||||
type: filters.type,
|
type,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue