chore: define default filters and params at one location (#721)
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/721 Reviewed-by: konrad <k@knt.li> Co-authored-by: dpschen <dpschen@noreply.kolaente.de> Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
This commit is contained in:
parent
077fe264f0
commit
b5df941e39
2 changed files with 42 additions and 34 deletions
|
@ -190,19 +190,8 @@ import ListService from '@/services/list'
|
||||||
import NamespaceService from '@/services/namespace'
|
import NamespaceService from '@/services/namespace'
|
||||||
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
||||||
|
|
||||||
export default {
|
// FIXME: merge with DEFAULT_PARAMS in taskList.js
|
||||||
name: 'filters',
|
const DEFAULT_PARAMS = {
|
||||||
components: {
|
|
||||||
EditLabels,
|
|
||||||
PrioritySelect,
|
|
||||||
Fancycheckbox,
|
|
||||||
flatPickr,
|
|
||||||
PercentDoneSelect,
|
|
||||||
Multiselect,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
params: {
|
|
||||||
sort_by: [],
|
sort_by: [],
|
||||||
order_by: [],
|
order_by: [],
|
||||||
filter_by: [],
|
filter_by: [],
|
||||||
|
@ -211,8 +200,9 @@ export default {
|
||||||
filter_include_nulls: true,
|
filter_include_nulls: true,
|
||||||
filter_concat: 'or',
|
filter_concat: 'or',
|
||||||
s: '',
|
s: '',
|
||||||
},
|
}
|
||||||
filters: {
|
|
||||||
|
const DEFAULT_FILTERS = {
|
||||||
done: false,
|
done: false,
|
||||||
dueDate: '',
|
dueDate: '',
|
||||||
requireAllFilters: false,
|
requireAllFilters: false,
|
||||||
|
@ -227,7 +217,22 @@ export default {
|
||||||
labels: '',
|
labels: '',
|
||||||
list_id: '',
|
list_id: '',
|
||||||
namespace: '',
|
namespace: '',
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'filters',
|
||||||
|
components: {
|
||||||
|
EditLabels,
|
||||||
|
PrioritySelect,
|
||||||
|
Fancycheckbox,
|
||||||
|
flatPickr,
|
||||||
|
PercentDoneSelect,
|
||||||
|
Multiselect,
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
params: DEFAULT_PARAMS,
|
||||||
|
filters: DEFAULT_FILTERS,
|
||||||
|
|
||||||
usersService: UserService,
|
usersService: UserService,
|
||||||
foundusers: [],
|
foundusers: [],
|
||||||
|
|
|
@ -2,6 +2,16 @@ import TaskCollectionService from '../../../services/taskCollection'
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
|
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
|
||||||
|
|
||||||
|
// FIXME: merge with DEFAULT_PARAMS in filters.vue
|
||||||
|
const DEFAULT_PARAMS = {
|
||||||
|
sort_by: ['position', 'id'],
|
||||||
|
order_by: ['asc', 'desc'],
|
||||||
|
filter_by: ['done'],
|
||||||
|
filter_value: ['false'],
|
||||||
|
filter_comparator: ['equals'],
|
||||||
|
filter_concat: 'and',
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This mixin provides a base set of methods and properties to get tasks on a list.
|
* This mixin provides a base set of methods and properties to get tasks on a list.
|
||||||
*/
|
*/
|
||||||
|
@ -20,14 +30,7 @@ export default {
|
||||||
searchTerm: '',
|
searchTerm: '',
|
||||||
|
|
||||||
showTaskFilter: false,
|
showTaskFilter: false,
|
||||||
params: {
|
params: DEFAULT_PARAMS,
|
||||||
sort_by: ['position', 'id'],
|
|
||||||
order_by: ['asc', 'desc'],
|
|
||||||
filter_by: ['done'],
|
|
||||||
filter_value: ['false'],
|
|
||||||
filter_comparator: ['equals'],
|
|
||||||
filter_concat: 'and',
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue