mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 18:26:20 +01:00
Report parameters.
This commit is contained in:
parent
b10b490088
commit
e7fef80d79
@ -25,8 +25,8 @@ export function ReportHeader({ icon }) {
|
|||||||
if (!report.id) {
|
if (!report.id) {
|
||||||
create(report, {
|
create(report, {
|
||||||
onSuccess: async ({ id }) => {
|
onSuccess: async ({ id }) => {
|
||||||
router.push(`/reports/${id}`, null, { shallow: true });
|
|
||||||
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
||||||
|
router.push(`/reports/${id}`, null, { shallow: true });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,6 +5,7 @@ import { ReportContext } from 'components/pages/reports/Report';
|
|||||||
import NoData from 'components/common/NoData';
|
import NoData from 'components/common/NoData';
|
||||||
import styles from './EventDataParameters.module.css';
|
import styles from './EventDataParameters.module.css';
|
||||||
import { DATA_TYPES } from 'lib/constants';
|
import { DATA_TYPES } from 'lib/constants';
|
||||||
|
import BaseParameters from '../BaseParameters';
|
||||||
|
|
||||||
function useFields(websiteId, startDate, endDate) {
|
function useFields(websiteId, startDate, endDate) {
|
||||||
const { get, useQuery } = useApi();
|
const { get, useQuery } = useApi();
|
||||||
@ -31,16 +32,9 @@ export function EventDataParameters() {
|
|||||||
runReport(values);
|
runReport(values);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!websiteId || !dateRange) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return <Loading icon="dots" />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form ref={ref} values={parameters} error={error} onSubmit={handleSubmit}>
|
<Form ref={ref} values={parameters} error={error} onSubmit={handleSubmit}>
|
||||||
|
<BaseParameters />
|
||||||
<FormRow label={formatMessage(labels.fields)}>
|
<FormRow label={formatMessage(labels.fields)}>
|
||||||
<div className={styles.fields}>
|
<div className={styles.fields}>
|
||||||
{!data?.length && <NoData />}
|
{!data?.length && <NoData />}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { useContext, useRef, useState } from 'react';
|
import { useContext, useRef } from 'react';
|
||||||
import { useMessages } from 'hooks';
|
import { useMessages } from 'hooks';
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
|
@ -61,7 +61,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||||||
return forbidden(res);
|
return forbidden(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { url, referrer, name: eventName, data: dynamicData, title: pageTitle } = payload;
|
const { url, referrer, name: eventName, data: eventData, title: pageTitle } = payload;
|
||||||
|
|
||||||
await useSession(req, res);
|
await useSession(req, res);
|
||||||
|
|
||||||
@ -96,18 +96,18 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
|||||||
referrerDomain,
|
referrerDomain,
|
||||||
pageTitle,
|
pageTitle,
|
||||||
eventName,
|
eventName,
|
||||||
eventData: dynamicData,
|
eventData,
|
||||||
...session,
|
...session,
|
||||||
sessionId: session.id,
|
sessionId: session.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === COLLECTION_TYPE.identify) {
|
if (type === COLLECTION_TYPE.identify) {
|
||||||
if (!dynamicData) {
|
if (!eventData) {
|
||||||
return badRequest(res, 'Data required.');
|
return badRequest(res, 'Data required.');
|
||||||
}
|
}
|
||||||
|
|
||||||
await saveSessionData({ ...session, sessionData: dynamicData, sessionId: session.id });
|
await saveSessionData({ ...session, sessionData: eventData, sessionId: session.id });
|
||||||
}
|
}
|
||||||
|
|
||||||
const token = createToken(session, secret());
|
const token = createToken(session, secret());
|
||||||
@ -153,7 +153,7 @@ async function hasBlockedIp(req: NextApiRequestCollect) {
|
|||||||
|
|
||||||
const clientIp = getIpAddress(req);
|
const clientIp = getIpAddress(req);
|
||||||
|
|
||||||
const blocked = ips.find(ip => {
|
return ips.find(ip => {
|
||||||
if (ip === clientIp) return true;
|
if (ip === clientIp) return true;
|
||||||
|
|
||||||
// CIDR notation
|
// CIDR notation
|
||||||
@ -166,7 +166,5 @@ async function hasBlockedIp(req: NextApiRequestCollect) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return blocked;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user