mirror of
https://github.com/umami-software/umami.git
synced 2026-02-06 13:47:15 +01:00
Enable search for metrics.
This commit is contained in:
parent
bbd7c4b6ea
commit
b0bfd0b5ab
7 changed files with 74 additions and 30 deletions
|
|
@ -26,6 +26,8 @@ export interface WebsiteMetricsRequestQuery {
|
|||
language?: string;
|
||||
event?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
search?: string;
|
||||
}
|
||||
|
||||
const schema = {
|
||||
|
|
@ -47,6 +49,8 @@ const schema = {
|
|||
language: yup.string(),
|
||||
event: yup.string(),
|
||||
limit: yup.number(),
|
||||
offset: yup.number(),
|
||||
search: yup.string(),
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
@ -74,6 +78,8 @@ export default async (
|
|||
language,
|
||||
event,
|
||||
limit,
|
||||
offset,
|
||||
search,
|
||||
} = req.query;
|
||||
|
||||
if (req.method === 'GET') {
|
||||
|
|
@ -98,12 +104,19 @@ export default async (
|
|||
city,
|
||||
language,
|
||||
event,
|
||||
search,
|
||||
};
|
||||
|
||||
const column = FILTER_COLUMNS[type] || type;
|
||||
|
||||
if (SESSION_COLUMNS.includes(type)) {
|
||||
const data = await getSessionMetrics(websiteId, column, filters, limit);
|
||||
const data = await getSessionMetrics(
|
||||
websiteId,
|
||||
column,
|
||||
{ ...filters, search },
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
|
||||
if (type === 'language') {
|
||||
const combined = {};
|
||||
|
|
@ -125,7 +138,13 @@ export default async (
|
|||
}
|
||||
|
||||
if (EVENT_COLUMNS.includes(type)) {
|
||||
const data = await getPageviewMetrics(websiteId, column, filters, limit);
|
||||
const data = await getPageviewMetrics(
|
||||
websiteId,
|
||||
column,
|
||||
{ ...filters, search },
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
|
||||
return ok(res, data);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue