diff --git a/src/models/bucket.js b/src/models/bucket.js index 16f4eebd..a18086b1 100644 --- a/src/models/bucket.js +++ b/src/models/bucket.js @@ -20,6 +20,7 @@ export default class BucketModel extends AbstractModel { listId: 0, limit: 0, tasks: [], + isDoneBucket: false, createdBy: null, created: null, diff --git a/src/store/modules/kanban.js b/src/store/modules/kanban.js index 132a7b49..4f59449c 100644 --- a/src/store/modules/kanban.js +++ b/src/store/modules/kanban.js @@ -8,6 +8,12 @@ import TaskCollectionService from '@/services/taskCollection' const tasksPerBucket = 25 +const addTaskToBucketAndSort = (state, task) => { + const bi = filterObject(state.buckets, b => b.id === task.bucketId) + state.buckets[bi].tasks.push(task) + state.buckets[bi].tasks.sort((a, b) => a.position > b.position ? 1 : -1) +} + /** * This store is intended to hold the currently active kanban view. * It should hold only the current buckets. @@ -64,16 +70,38 @@ export default { return } + let found = false + + const findAndUpdate = b => { + for (const t in state.buckets[b].tasks) { + if (state.buckets[b].tasks[t].id === task.id) { + const bucket = state.buckets[b] + bucket.tasks[t] = task + + if (bucket.id !== task.bucketId) { + bucket.tasks.splice(t, 1) + addTaskToBucketAndSort(state, task) + } + + Vue.set(state.buckets, b, bucket) + found = true + return + } + } + } + for (const b in state.buckets) { if (state.buckets[b].id === task.bucketId) { - for (const t in state.buckets[b].tasks) { - if (state.buckets[b].tasks[t].id === task.id) { - const bucket = state.buckets[b] - bucket.tasks[t] = task - Vue.set(state.buckets, b, bucket) - return - } + findAndUpdate(b) + if (found) { + return } + } + } + + for (const b in state.buckets) { + findAndUpdate(b) + if (found) { return } } diff --git a/src/styles/theme/theme.scss b/src/styles/theme/theme.scss index 31ee5169..684a6863 100644 --- a/src/styles/theme/theme.scss +++ b/src/styles/theme/theme.scss @@ -79,6 +79,9 @@ button.table { .icon { padding-right: .5rem; + } + + .icon:not(.has-text-success) { color: $grey-300 !important; } diff --git a/src/views/list/views/Kanban.vue b/src/views/list/views/Kanban.vue index b07e35dc..1a484c0a 100644 --- a/src/views/list/views/Kanban.vue +++ b/src/views/list/views/Kanban.vue @@ -19,6 +19,13 @@