feat(kanban): save done bucket with project instead of bucket
This commit is contained in:
parent
f6d1db3595
commit
3373b5fc45
@ -8,7 +8,6 @@ export interface IBucket extends IAbstract {
|
|||||||
projectId: number
|
projectId: number
|
||||||
limit: number
|
limit: number
|
||||||
tasks: ITask[]
|
tasks: ITask[]
|
||||||
isDoneBucket: boolean
|
|
||||||
position: number
|
position: number
|
||||||
count: number
|
count: number
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ export interface IProject extends IAbstract {
|
|||||||
position: number
|
position: number
|
||||||
backgroundBlurHash: string
|
backgroundBlurHash: string
|
||||||
parentProjectId: number
|
parentProjectId: number
|
||||||
|
doneBucketId: number
|
||||||
|
|
||||||
created: Date
|
created: Date
|
||||||
updated: Date
|
updated: Date
|
||||||
|
@ -12,7 +12,6 @@ export default class BucketModel extends AbstractModel<IBucket> implements IBuck
|
|||||||
projectId = ''
|
projectId = ''
|
||||||
limit = 0
|
limit = 0
|
||||||
tasks: ITask[] = []
|
tasks: ITask[] = []
|
||||||
isDoneBucket = false
|
|
||||||
position = 0
|
position = 0
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ export default class ProjectModel extends AbstractModel<IProject> implements IPr
|
|||||||
position = 0
|
position = 0
|
||||||
backgroundBlurHash = ''
|
backgroundBlurHash = ''
|
||||||
parentProjectId = 0
|
parentProjectId = 0
|
||||||
|
doneBucketId = 0
|
||||||
|
|
||||||
created: Date = null
|
created: Date = null
|
||||||
updated: Date = null
|
updated: Date = null
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
>
|
>
|
||||||
<div class="bucket-header" @click="() => unCollapseBucket(bucket)">
|
<div class="bucket-header" @click="() => unCollapseBucket(bucket)">
|
||||||
<span
|
<span
|
||||||
v-if="bucket.isDoneBucket"
|
v-if="project.doneBucketId === bucket.id"
|
||||||
class="icon is-small has-text-success mr-2"
|
class="icon is-small has-text-success mr-2"
|
||||||
v-tooltip="$t('project.kanban.doneBucketHint')"
|
v-tooltip="$t('project.kanban.doneBucketHint')"
|
||||||
>
|
>
|
||||||
@ -98,7 +98,7 @@
|
|||||||
@click.stop="toggleDoneBucket(bucket)"
|
@click.stop="toggleDoneBucket(bucket)"
|
||||||
v-tooltip="$t('project.kanban.doneBucketHintExtended')"
|
v-tooltip="$t('project.kanban.doneBucketHintExtended')"
|
||||||
>
|
>
|
||||||
<span class="icon is-small" :class="{'has-text-success': bucket.isDoneBucket}">
|
<span class="icon is-small" :class="{'has-text-success': bucket.id === project.doneBucketId}">
|
||||||
<icon icon="check-double"/>
|
<icon icon="check-double"/>
|
||||||
</span>
|
</span>
|
||||||
{{ $t('project.kanban.doneBucket') }}
|
{{ $t('project.kanban.doneBucket') }}
|
||||||
@ -251,6 +251,7 @@ import {calculateItemPosition} from '@/helpers/calculateItemPosition'
|
|||||||
|
|
||||||
import {isSavedFilter} from '@/services/savedFilter'
|
import {isSavedFilter} from '@/services/savedFilter'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
import {useProjectStore} from '@/stores/projects'
|
||||||
|
|
||||||
const DRAG_OPTIONS = {
|
const DRAG_OPTIONS = {
|
||||||
// sortable options
|
// sortable options
|
||||||
@ -268,6 +269,7 @@ const {t} = useI18n({useScope: 'global'})
|
|||||||
const baseStore = useBaseStore()
|
const baseStore = useBaseStore()
|
||||||
const kanbanStore = useKanbanStore()
|
const kanbanStore = useKanbanStore()
|
||||||
const taskStore = useTaskStore()
|
const taskStore = useTaskStore()
|
||||||
|
const projectStore = useProjectStore()
|
||||||
|
|
||||||
const taskContainerRefs = ref<{[id: IBucket['id']]: HTMLElement}>({})
|
const taskContainerRefs = ref<{[id: IBucket['id']]: HTMLElement}>({})
|
||||||
|
|
||||||
@ -422,10 +424,9 @@ async function updateTaskPosition(e) {
|
|||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
oldBucket !== undefined && // This shouldn't actually be `undefined`, but let's play it safe.
|
oldBucket !== undefined && // This shouldn't actually be `undefined`, but let's play it safe.
|
||||||
newBucket.id !== oldBucket.id &&
|
newBucket.id !== oldBucket.id
|
||||||
newBucket.isDoneBucket !== oldBucket.isDoneBucket
|
|
||||||
) {
|
) {
|
||||||
newTask.done = newBucket.isDoneBucket
|
newTask.done = project.value.doneBucketId === newBucket.id
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
oldBucket !== undefined && // This shouldn't actually be `undefined`, but let's play it safe.
|
oldBucket !== undefined && // This shouldn't actually be `undefined`, but let's play it safe.
|
||||||
@ -597,9 +598,13 @@ function dragstart(bucket: IBucket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function toggleDoneBucket(bucket: IBucket) {
|
async function toggleDoneBucket(bucket: IBucket) {
|
||||||
await kanbanStore.updateBucket({
|
const doneBucketId = project.value.doneBucketId === bucket.id
|
||||||
...bucket,
|
? 0
|
||||||
isDoneBucket: !bucket.isDoneBucket,
|
: bucket.id
|
||||||
|
|
||||||
|
await projectStore.updateProject({
|
||||||
|
...project.value,
|
||||||
|
doneBucketId,
|
||||||
})
|
})
|
||||||
success({message: t('project.kanban.doneBucketSavedSuccess')})
|
success({message: t('project.kanban.doneBucketSavedSuccess')})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user