diff --git a/src/components/input/SelectList.vue b/src/components/input/SelectList.vue new file mode 100644 index 000000000..808c3b540 --- /dev/null +++ b/src/components/input/SelectList.vue @@ -0,0 +1,63 @@ + + + \ No newline at end of file diff --git a/src/components/input/SelectNamespace.vue b/src/components/input/SelectNamespace.vue new file mode 100644 index 000000000..e6bbfc31d --- /dev/null +++ b/src/components/input/SelectNamespace.vue @@ -0,0 +1,63 @@ + + + \ No newline at end of file diff --git a/src/components/input/SelectUser.vue b/src/components/input/SelectUser.vue new file mode 100644 index 000000000..9594e81e8 --- /dev/null +++ b/src/components/input/SelectUser.vue @@ -0,0 +1,63 @@ + + + \ No newline at end of file diff --git a/src/components/list/partials/filters.vue b/src/components/list/partials/filters.vue index a17e22c3d..ccb7e4cf8 100644 --- a/src/components/list/partials/filters.vue +++ b/src/components/list/partials/filters.vue @@ -135,16 +135,10 @@
-
@@ -152,7 +146,10 @@
- +
@@ -161,32 +158,20 @@
-
-
@@ -214,10 +199,11 @@ import PrioritySelect from '@/components/tasks/partials/prioritySelect.vue' import PercentDoneSelect from '@/components/tasks/partials/percentDoneSelect.vue' import EditLabels from '@/components/tasks/partials/editLabels.vue' import Fancycheckbox from '@/components/input/fancycheckbox.vue' -import Multiselect from '@/components/input/multiselect.vue' +import SelectUser from '@/components/input/SelectUser.vue' +import SelectList from '@/components/input/SelectList.vue' +import SelectNamespace from '@/components/input/SelectNamespace.vue' import {parseDateOrString} from '@/helpers/time/parseDateOrString' -import {includesById} from '@/helpers/utils' import {dateIsValid, formatISO} from '@/helpers/time/formatDate' import {objectToSnakeCase} from '@/helpers/case' @@ -298,12 +284,6 @@ const entities: Entities = reactive({ namespace: [], }) -const foundEntities: Omit = reactive({ - users: [], - lists: [], - namespace: [], -}) - onMounted(() => { filters.value.requireAllFilters = params.value.filter_concat === 'and' }) @@ -579,31 +559,9 @@ function setPercentDoneFilter() { setSingleValueFilter('percent_done', 'percentDone', 'usePercentDone') } -async function find(kind: Omit, query: string) { - if (query === '') { - foundEntities[kind] = [] - return - } +async function changeMultiselectFilter(kind: EntityType, filterName) { + await nextTick() - const response = await services[kind].getAll({}, {s: query}) - - // Filter users from the results who are already assigned - foundEntities[kind] = response.filter(({id}) => !includesById(entities[kind], id)) -} - -function add(kind, filterName) { - nextTick(() => { - changeMultiselectFilter(kind, filterName) - }) -} - -function remove(kind, filterName) { - nextTick(() => { - changeMultiselectFilter(kind, filterName) - }) -} - -function changeMultiselectFilter(kind: EntityType, filterName) { if (entities[kind].length === 0) { removePropertyFromFilter(filterName) change() diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index e9000d4bb..4778a27d0 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -6,7 +6,7 @@ export function findById(array : T[], id : stri return array.find(({id: currentId}) => currentId === id) } -export function includesById(array: [], id: string | number) { +export function includesById(array: any[], id: string | number) { return array.some(({id: currentId}) => currentId === id) }