[alphabetical-sort] Ammended commit
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
1b6d50860c
commit
0de59a0e94
|
@ -195,7 +195,7 @@ import NamespaceService from '@/services/namespace'
|
||||||
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
import EditLabels from '@/components/tasks/partials/editLabels.vue'
|
||||||
|
|
||||||
import {objectToSnakeCase} from '@/helpers/case'
|
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
|
// FIXME: merge with DEFAULT_PARAMS in taskList.js
|
||||||
const DEFAULT_PARAMS = {
|
const DEFAULT_PARAMS = {
|
||||||
|
@ -226,7 +226,7 @@ const DEFAULT_FILTERS = {
|
||||||
namespace: '',
|
namespace: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
const ALPHABETICAL_SORT = ['title']
|
export const ALPHABETICAL_SORT = 'title'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'filters',
|
name: 'filters',
|
||||||
|
@ -505,7 +505,7 @@ export default {
|
||||||
this.params.sort_by = getDefaultParams().sort_by
|
this.params.sort_by = getDefaultParams().sort_by
|
||||||
this.sortAlphabetically = false
|
this.sortAlphabetically = false
|
||||||
} else {
|
} else {
|
||||||
this.params.sort_by = ALPHABETICAL_SORT
|
this.params.sort_by = [ALPHABETICAL_SORT]
|
||||||
this.sortAlphabetically = true
|
this.sortAlphabetically = true
|
||||||
}
|
}
|
||||||
this.change()
|
this.change()
|
||||||
|
|
|
@ -148,6 +148,7 @@ import {HAS_TASKS} from '@/store/mutation-types'
|
||||||
import Nothing from '@/components/misc/nothing.vue'
|
import Nothing from '@/components/misc/nothing.vue'
|
||||||
import Pagination from '@/components/misc/pagination.vue'
|
import Pagination from '@/components/misc/pagination.vue'
|
||||||
import Popup from '@/components/misc/popup'
|
import Popup from '@/components/misc/popup'
|
||||||
|
import { ALPHABETICAL_SORT } from '@/components/list/partials/filters'
|
||||||
|
|
||||||
import draggable from 'vuedraggable'
|
import draggable from 'vuedraggable'
|
||||||
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
|
import {calculateItemPosition} from '../../../helpers/calculateItemPosition'
|
||||||
|
@ -228,7 +229,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
isAlphabeticalSorting() {
|
isAlphabeticalSorting() {
|
||||||
return this.sorting.find( sortBy => sortBy === 'title' ) !== undefined
|
return this.sorting.find( sortBy => sortBy === ALPHABETICAL_SORT ) !== undefined
|
||||||
},
|
},
|
||||||
searchTasks() {
|
searchTasks() {
|
||||||
// Only search if the search term changed
|
// Only search if the search term changed
|
||||||
|
@ -260,12 +261,22 @@ export default {
|
||||||
focusNewTaskInput() {
|
focusNewTaskInput() {
|
||||||
this.$refs.newTaskInput.$refs.newTaskInput.focus()
|
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.$store.commit(HAS_TASKS, true)
|
||||||
this.reloadTasksWithCurrentFilterAndSorting()
|
|
||||||
},
|
},
|
||||||
reloadTasksWithCurrentFilterAndSorting(){
|
reloadTasksWithCurrentFilterAndSorting(){
|
||||||
this.loadTasks(undefined, undefined, undefined, true)
|
this.loadTasks(1, undefined, undefined, true)
|
||||||
},
|
},
|
||||||
editTask(id) {
|
editTask(id) {
|
||||||
// Find the selected task and set it to the current object
|
// Find the selected task and set it to the current object
|
||||||
|
|
Reference in New Issue