mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 15:47:13 +01:00
Updated filtering logic.
This commit is contained in:
parent
6ee9bb07da
commit
810b0639c8
14 changed files with 97 additions and 83 deletions
|
|
@ -16,7 +16,7 @@ import {
|
|||
} from 'react-basics';
|
||||
import { useMessages, useFilters, useFormat, useLocale, useWebsiteValues } from 'components/hooks';
|
||||
import { OPERATORS } from 'lib/constants';
|
||||
import { operatorEquals } from 'lib/params';
|
||||
import { isEqualsOperator } from 'lib/params';
|
||||
import styles from './FieldFilterEditForm.module.css';
|
||||
|
||||
export interface FieldFilterFormProps {
|
||||
|
|
@ -50,7 +50,7 @@ export default function FieldFilterEditForm({
|
|||
const [operator, setOperator] = useState(defaultOperator);
|
||||
const [value, setValue] = useState(defaultValue);
|
||||
const [showMenu, setShowMenu] = useState(false);
|
||||
const isEquals = operatorEquals(operator);
|
||||
const isEquals = isEqualsOperator(operator);
|
||||
const [search, setSearch] = useState('');
|
||||
const [selected, setSelected] = useState(isEquals ? value : '');
|
||||
const { filters } = useFilters();
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import ParameterList from '../[reportId]/ParameterList';
|
|||
import PopupForm from '../[reportId]/PopupForm';
|
||||
import { ReportContext } from './Report';
|
||||
import FieldFilterEditForm from '../[reportId]/FieldFilterEditForm';
|
||||
import { operatorEquals } from 'lib/params';
|
||||
import { isSearchOperator } from 'lib/params';
|
||||
import styles from './FilterParameters.module.css';
|
||||
|
||||
export function FilterParameters() {
|
||||
|
|
@ -69,7 +69,7 @@ export function FilterParameters() {
|
|||
{filters.map(
|
||||
({ name, operator, value }: { name: string; operator: string; value: string }) => {
|
||||
const label = fields.find(f => f.name === name)?.label;
|
||||
const isEquals = operatorEquals(operator);
|
||||
const isSearch = isSearchOperator(operator);
|
||||
|
||||
return (
|
||||
<ParameterList.Item key={name} onRemove={() => handleRemove(name)}>
|
||||
|
|
@ -79,7 +79,7 @@ export function FilterParameters() {
|
|||
name={name}
|
||||
label={label}
|
||||
operator={operator}
|
||||
value={isEquals ? formatValue(value, name) : value}
|
||||
value={isSearch ? value : formatValue(value, name)}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
</ParameterList.Item>
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ export default function WebsiteExpandedView({
|
|||
const {
|
||||
router,
|
||||
renderUrl,
|
||||
pathname,
|
||||
query: { view },
|
||||
} = useNavigation();
|
||||
|
||||
|
|
@ -122,7 +121,12 @@ export default function WebsiteExpandedView({
|
|||
return (
|
||||
<div className={styles.layout}>
|
||||
<div className={styles.menu}>
|
||||
<LinkButton href={pathname} className={styles.back} variant="quiet" scroll={false}>
|
||||
<LinkButton
|
||||
href={renderUrl({ view: undefined })}
|
||||
className={styles.back}
|
||||
variant="quiet"
|
||||
scroll={false}
|
||||
>
|
||||
<Icon rotate={dir === 'rtl' ? 0 : 180}>
|
||||
<Icons.ArrowRight />
|
||||
</Icon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue