mirror of
https://github.com/kremalicious/umami.git
synced 2024-06-30 13:41:50 +02:00
Fixed filter parameters.
This commit is contained in:
parent
b1d3970ea7
commit
81a810bd73
|
@ -97,7 +97,7 @@
|
||||||
"node-fetch": "^3.2.8",
|
"node-fetch": "^3.2.8",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-basics": "^0.102.0",
|
"react-basics": "^0.105.0",
|
||||||
"react-beautiful-dnd": "^13.1.0",
|
"react-beautiful-dnd": "^13.1.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-error-boundary": "^4.0.4",
|
"react-error-boundary": "^4.0.4",
|
||||||
|
|
|
@ -7,7 +7,7 @@ import FieldAggregateForm from './FieldAggregateForm';
|
||||||
import FieldFilterForm from './FieldFilterForm';
|
import FieldFilterForm from './FieldFilterForm';
|
||||||
import styles from './FieldAddForm.module.css';
|
import styles from './FieldAddForm.module.css';
|
||||||
|
|
||||||
export function FieldAddForm({ fields = [], group, element, onAdd, onClose }) {
|
export function FieldAddForm({ fields = [], group, onAdd, onClose }) {
|
||||||
const [selected, setSelected] = useState();
|
const [selected, setSelected] = useState();
|
||||||
|
|
||||||
const handleSelect = value => {
|
const handleSelect = value => {
|
||||||
|
@ -28,7 +28,7 @@ export function FieldAddForm({ fields = [], group, element, onAdd, onClose }) {
|
||||||
};
|
};
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<PopupForm className={styles.popup} element={element} onClose={onClose}>
|
<PopupForm className={styles.popup}>
|
||||||
{!selected && <FieldSelectForm fields={fields} onSelect={handleSelect} />}
|
{!selected && <FieldSelectForm fields={fields} onSelect={handleSelect} />}
|
||||||
{selected && group === REPORT_PARAMETERS.fields && (
|
{selected && group === REPORT_PARAMETERS.fields && (
|
||||||
<FieldAggregateForm {...selected} onSelect={handleSave} />
|
<FieldAggregateForm {...selected} onSelect={handleSave} />
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
|
import { Loading } from 'react-basics';
|
||||||
|
import { subDays } from 'date-fns';
|
||||||
import FieldSelectForm from './FieldSelectForm';
|
import FieldSelectForm from './FieldSelectForm';
|
||||||
import FieldFilterForm from './FieldFilterForm';
|
import FieldFilterForm from './FieldFilterForm';
|
||||||
import { useApi, useDateRange } from 'components/hooks';
|
import { useApi } from 'components/hooks';
|
||||||
import { Loading } from 'react-basics';
|
|
||||||
|
|
||||||
function useValues(websiteId, type) {
|
function useValues(websiteId, type) {
|
||||||
|
const now = Date.now();
|
||||||
const { get, useQuery } = useApi();
|
const { get, useQuery } = useApi();
|
||||||
const [dateRange] = useDateRange(websiteId);
|
|
||||||
const { startDate, endDate } = dateRange;
|
|
||||||
const { data, error, isLoading } = useQuery(
|
const { data, error, isLoading } = useQuery(
|
||||||
['websites:values', websiteId, type],
|
['websites:values', websiteId, type],
|
||||||
() =>
|
() =>
|
||||||
get(`/websites/${websiteId}/values`, {
|
get(`/websites/${websiteId}/values`, {
|
||||||
type,
|
type,
|
||||||
startAt: +startDate,
|
startAt: +subDays(now, 90),
|
||||||
endAt: +endDate,
|
endAt: now,
|
||||||
}),
|
}),
|
||||||
{ enabled: !!(websiteId && type) },
|
{ enabled: !!(websiteId && type) },
|
||||||
);
|
);
|
||||||
|
|
|
@ -74,7 +74,7 @@ export function EventDataParameters() {
|
||||||
<Icons.Plus />
|
<Icons.Plus />
|
||||||
</Icon>
|
</Icon>
|
||||||
<Popup position="bottom" alignment="start">
|
<Popup position="bottom" alignment="start">
|
||||||
{(close, element) => {
|
{close => {
|
||||||
return (
|
return (
|
||||||
<FieldAddForm
|
<FieldAddForm
|
||||||
fields={data.map(({ eventKey, eventDataType }) => ({
|
fields={data.map(({ eventKey, eventDataType }) => ({
|
||||||
|
@ -82,7 +82,6 @@ export function EventDataParameters() {
|
||||||
type: DATA_TYPES[eventDataType],
|
type: DATA_TYPES[eventDataType],
|
||||||
}))}
|
}))}
|
||||||
group={group}
|
group={group}
|
||||||
element={element}
|
|
||||||
onAdd={handleAdd}
|
onAdd={handleAdd}
|
||||||
onClose={close}
|
onClose={close}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -52,14 +52,10 @@ export function FunnelParameters() {
|
||||||
<Icon>
|
<Icon>
|
||||||
<Icons.Plus />
|
<Icons.Plus />
|
||||||
</Icon>
|
</Icon>
|
||||||
<Popup position="bottom" alignment="start">
|
<Popup position="right" alignment="start">
|
||||||
{(close, element) => {
|
<PopupForm>
|
||||||
return (
|
<UrlAddForm onAdd={handleAddUrl} />
|
||||||
<PopupForm element={element} onClose={close}>
|
</PopupForm>
|
||||||
<UrlAddForm onAdd={handleAddUrl} />
|
|
||||||
</PopupForm>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Popup>
|
</Popup>
|
||||||
</PopupTrigger>
|
</PopupTrigger>
|
||||||
);
|
);
|
||||||
|
|
|
@ -81,26 +81,22 @@ export function InsightsParameters() {
|
||||||
</Icon>
|
</Icon>
|
||||||
</TooltipPopup>
|
</TooltipPopup>
|
||||||
<Popup position="bottom" alignment="start" className={styles.popup}>
|
<Popup position="bottom" alignment="start" className={styles.popup}>
|
||||||
{close => {
|
<PopupForm>
|
||||||
return (
|
{id === 'fields' && (
|
||||||
<PopupForm onClose={close}>
|
<FieldSelectForm
|
||||||
{id === 'fields' && (
|
items={fieldOptions}
|
||||||
<FieldSelectForm
|
onSelect={handleAdd.bind(null, id)}
|
||||||
items={fieldOptions}
|
showType={false}
|
||||||
onSelect={handleAdd.bind(null, id)}
|
/>
|
||||||
showType={false}
|
)}
|
||||||
/>
|
{id === 'filters' && (
|
||||||
)}
|
<FilterSelectForm
|
||||||
{id === 'filters' && (
|
websiteId={websiteId}
|
||||||
<FilterSelectForm
|
items={fieldOptions}
|
||||||
websiteId={websiteId}
|
onSelect={handleAdd.bind(null, id)}
|
||||||
items={fieldOptions}
|
/>
|
||||||
onSelect={handleAdd.bind(null, id)}
|
)}
|
||||||
/>
|
</PopupForm>
|
||||||
)}
|
|
||||||
</PopupForm>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
</Popup>
|
</Popup>
|
||||||
</PopupTrigger>
|
</PopupTrigger>
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 1320px;
|
max-width: 1320px;
|
||||||
min-height: calc(100vh - 60px);
|
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ async function relationalQuery(websiteId: string, column: string, startDate: Dat
|
||||||
on session.session_id = website_event.session_id
|
on session.session_id = website_event.session_id
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
and website_event.created_at between {{startDate}} and {{endDate}}
|
and website_event.created_at between {{startDate}} and {{endDate}}
|
||||||
|
limit 100
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
websiteId,
|
websiteId,
|
||||||
|
@ -40,6 +41,7 @@ async function clickhouseQuery(websiteId: string, column: string, startDate: Dat
|
||||||
from website_event
|
from website_event
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
|
limit 100
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
websiteId,
|
websiteId,
|
||||||
|
|
|
@ -7557,10 +7557,10 @@ rc@^1.2.7:
|
||||||
minimist "^1.2.0"
|
minimist "^1.2.0"
|
||||||
strip-json-comments "~2.0.1"
|
strip-json-comments "~2.0.1"
|
||||||
|
|
||||||
react-basics@^0.102.0:
|
react-basics@^0.105.0:
|
||||||
version "0.102.0"
|
version "0.105.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.102.0.tgz#61dbc837963facb2d409044046eb55f7c689411e"
|
resolved "https://registry.yarnpkg.com/react-basics/-/react-basics-0.105.0.tgz#94eda703b3c0728e817b6e9d086e5d1c6c68f25c"
|
||||||
integrity sha512-MhLHgjVnOwdm1YX1Lwkyg37kPCTOk+b3NXWGORlh4dJThq/qq/s0lF09yqEq09Gye5yyTDbeNDPXlkXIPtadog==
|
integrity sha512-iKYtfB0A2vsmO+X4jaX64XdmHE836w8TG2jFQ0pi5Qp0ktL0lAL9/q0IrWUjNr86hi0apg46aeJWxY+qQO+T1g==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@react-spring/web" "^9.7.3"
|
"@react-spring/web" "^9.7.3"
|
||||||
classnames "^2.3.1"
|
classnames "^2.3.1"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user