diff --git a/frontend/apps/main/src/components/filter/FilterGroupBuilder.vue b/frontend/apps/main/src/components/filter/FilterGroupBuilder.vue index fde2b34c..b0129771 100644 --- a/frontend/apps/main/src/components/filter/FilterGroupBuilder.vue +++ b/frontend/apps/main/src/components/filter/FilterGroupBuilder.vue @@ -13,7 +13,13 @@ /> - @@ -33,6 +39,7 @@ import { normalizeToTwoLevel, isStrictTwoLevel } from '@/components/filter/filterTree' +import { MAX_FILTER_GROUPS } from '@/constants/filterConfig' // vee-validate's componentField carries onInput/onChange listeners; without this they fall // through to the root div and bubbled keystrokes overwrite the whole filters value. @@ -63,6 +70,7 @@ const updateGroup = (index, group) => { } const addGroup = () => { + if (modelValue.value.rules.length >= MAX_FILTER_GROUPS) return modelValue.value = { ...modelValue.value, rules: [...modelValue.value.rules, createGroup()] } } diff --git a/frontend/apps/main/src/constants/filterConfig.js b/frontend/apps/main/src/constants/filterConfig.js index 3f924707..428cde51 100644 --- a/frontend/apps/main/src/constants/filterConfig.js +++ b/frontend/apps/main/src/constants/filterConfig.js @@ -3,6 +3,9 @@ export const LOGIC = { OR: 'OR' } +// Mirrors dbutil.MaxFilterGroups on the backend. +export const MAX_FILTER_GROUPS = 10 + export const FIELD_TYPE = { SELECT: 'select', TAG: 'tag',