[alphabetical-sort] Ammended commit
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
Stefan Genov 2021-12-19 15:09:13 +02:00
parent 1b6d50860c
commit 0de59a0e94
2 changed files with 18 additions and 7 deletions

View File

@ -195,7 +195,7 @@ import NamespaceService from '@/services/namespace'
import EditLabels from '@/components/tasks/partials/editLabels.vue'
import {objectToSnakeCase} from '@/helpers/case'
import {getDefaultParams} from '../../tasks/mixins/taskList'
import {getDefaultParams} from '@/components/tasks/mixins/taskList'
// FIXME: merge with DEFAULT_PARAMS in taskList.js
const DEFAULT_PARAMS = {
@ -226,7 +226,7 @@ const DEFAULT_FILTERS = {
namespace: '',
}
const ALPHABETICAL_SORT = ['title']
export const ALPHABETICAL_SORT = 'title'
export default {
name: 'filters',
@ -505,7 +505,7 @@ export default {
this.params.sort_by = getDefaultParams().sort_by
this.sortAlphabetically = false
} else {
this.params.sort_by = ALPHABETICAL_SORT
this.params.sort_by = [ALPHABETICAL_SORT]
this.sortAlphabetically = true
}
this.change()

View File

@ -148,6 +148,7 @@ import {HAS_TASKS} from '@/store/mutation-types'
import Nothing from '@/components/misc/nothing.vue'
import Pagination from '@/components/misc/pagination.vue'
import Popup from '@/components/misc/popup'
import { ALPHABETICAL_SORT } from '@/components/list/partials/filters'
import draggable from 'vuedraggable'
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
@ -228,7 +229,7 @@ export default {
},
methods: {
isAlphabeticalSorting() {
return this.sorting.find( sortBy => sortBy === 'title' ) !== undefined
return this.sorting.find( sortBy => sortBy === ALPHABETICAL_SORT ) !== undefined
},
searchTasks() {
// Only search if the search term changed
@ -260,12 +261,22 @@ export default {
focusNewTaskInput() {
this.$refs.newTaskInput.$refs.newTaskInput.focus()
},
updateTaskList() {
updateTaskList( task ) {
if ( this.isAlphabeticalSorting() ) {
this.reloadTasksWithCurrentFilterAndSorting()
}
else {
const tasks = [
task,
...this.tasks,
]
this.tasks = tasks
}
this.$store.commit(HAS_TASKS, true)
this.reloadTasksWithCurrentFilterAndSorting()
},
reloadTasksWithCurrentFilterAndSorting(){
this.loadTasks(undefined, undefined, undefined, true)
this.loadTasks(1, undefined, undefined, true)
},
editTask(id) {
// Find the selected task and set it to the current object