mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
Refactored filter parameters.
This commit is contained in:
parent
1a839d1cae
commit
cff2d00536
13 changed files with 291 additions and 123 deletions
|
|
@ -3,8 +3,6 @@ import { createPortal } from 'react-dom';
|
|||
import { REPORT_PARAMETERS } from 'lib/constants';
|
||||
import PopupForm from './PopupForm';
|
||||
import FieldSelectForm from './FieldSelectForm';
|
||||
import FieldAggregateForm from './FieldAggregateForm';
|
||||
import FieldFilterEditForm from './FieldFilterEditForm';
|
||||
|
||||
export function FieldAddForm({
|
||||
fields = [],
|
||||
|
|
@ -17,7 +15,11 @@ export function FieldAddForm({
|
|||
onAdd: (group: string, value: string) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const [selected, setSelected] = useState<{ name: string; type: string; value: string }>();
|
||||
const [selected, setSelected] = useState<{
|
||||
name: string;
|
||||
type: string;
|
||||
value: string;
|
||||
}>();
|
||||
|
||||
const handleSelect = (value: any) => {
|
||||
const { type } = value;
|
||||
|
|
@ -39,12 +41,6 @@ export function FieldAddForm({
|
|||
return createPortal(
|
||||
<PopupForm>
|
||||
{!selected && <FieldSelectForm fields={fields} onSelect={handleSelect} />}
|
||||
{selected && group === REPORT_PARAMETERS.fields && (
|
||||
<FieldAggregateForm {...selected} onSelect={handleSave} />
|
||||
)}
|
||||
{selected && group === REPORT_PARAMETERS.filters && (
|
||||
<FieldFilterEditForm {...selected} onChange={handleSave} />
|
||||
)}
|
||||
</PopupForm>,
|
||||
document.body,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue