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) {
|
||||
create(report, {
|
||||
onSuccess: async ({ id }) => {
|
||||
router.push(`/reports/${id}`, null, { shallow: true });
|
||||
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
||||
router.push(`/reports/${id}`, null, { shallow: true });
|
||||
},
|
||||
});
|
||||
} else {
|
||||
|
@ -5,6 +5,7 @@ import { ReportContext } from 'components/pages/reports/Report';
|
||||
import NoData from 'components/common/NoData';
|
||||
import styles from './EventDataParameters.module.css';
|
||||
import { DATA_TYPES } from 'lib/constants';
|
||||
import BaseParameters from '../BaseParameters';
|
||||
|
||||
function useFields(websiteId, startDate, endDate) {
|
||||
const { get, useQuery } = useApi();
|
||||
@ -31,16 +32,9 @@ export function EventDataParameters() {
|
||||
runReport(values);
|
||||
};
|
||||
|
||||
if (!websiteId || !dateRange) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return <Loading icon="dots" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Form ref={ref} values={parameters} error={error} onSubmit={handleSubmit}>
|
||||
<BaseParameters />
|
||||
<FormRow label={formatMessage(labels.fields)}>
|
||||
<div className={styles.fields}>
|
||||
{!data?.length && <NoData />}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useContext, useRef, useState } from 'react';
|
||||
import { useContext, useRef } from 'react';
|
||||
import { useMessages } from 'hooks';
|
||||
import {
|
||||
Icon,
|
||||
|
@ -61,7 +61,7 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
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);
|
||||
|
||||
@ -96,18 +96,18 @@ export default async (req: NextApiRequestCollect, res: NextApiResponse) => {
|
||||
referrerDomain,
|
||||
pageTitle,
|
||||
eventName,
|
||||
eventData: dynamicData,
|
||||
eventData,
|
||||
...session,
|
||||
sessionId: session.id,
|
||||
});
|
||||
}
|
||||
|
||||
if (type === COLLECTION_TYPE.identify) {
|
||||
if (!dynamicData) {
|
||||
if (!eventData) {
|
||||
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());
|
||||
@ -153,7 +153,7 @@ async function hasBlockedIp(req: NextApiRequestCollect) {
|
||||
|
||||
const clientIp = getIpAddress(req);
|
||||
|
||||
const blocked = ips.find(ip => {
|
||||
return ips.find(ip => {
|
||||
if (ip === clientIp) return true;
|
||||
|
||||
// CIDR notation
|
||||
@ -166,7 +166,5 @@ async function hasBlockedIp(req: NextApiRequestCollect) {
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
return blocked;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user