diff --git a/frontend/src/views/project/ProjectKanban.vue b/frontend/src/views/project/ProjectKanban.vue index 941a42e57b..48ea823596 100644 --- a/frontend/src/views/project/ProjectKanban.vue +++ b/frontend/src/views/project/ProjectKanban.vue @@ -82,14 +82,15 @@ >
@@ -98,6 +99,7 @@ :disabled="bucket.limit < 0" :icon="['far', 'save']" :shadow="false" + @click="setBucketLimit(bucket.id, true)" />
@@ -320,6 +322,7 @@ const taskStore = useTaskStore() const projectStore = useProjectStore() const taskContainerRefs = ref<{[id: IBucket['id']]: HTMLElement}>({}) +const bucketLimitInputRef = ref(null) const drag = ref(false) const dragBucket = ref(false) @@ -615,7 +618,7 @@ function updateBucketPosition(e: {newIndex: number}) { }) } -async function setBucketLimit(bucketId: IBucket['id'], limit: number) { +async function saveBucketLimit(bucketId: IBucket['id'], limit: number) { if (limit < 0) { return } @@ -627,6 +630,22 @@ async function setBucketLimit(bucketId: IBucket['id'], limit: number) { success({message: t('project.kanban.bucketLimitSavedSuccess')}) } +const setBucketLimitCancel = ref(null) + +async function setBucketLimit(bucketId: IBucket['id'], now: boolean = false) { + const limit = parseInt(bucketLimitInputRef.value?.value || '') + + if (setBucketLimitCancel.value !== null) { + clearTimeout(setBucketLimitCancel.value) + } + + if (now) { + return saveBucketLimit(bucketId, limit) + } + + setBucketLimitCancel.value = setTimeout(saveBucketLimit, 2500, bucketId, limit) +} + function shouldAcceptDrop(bucket: IBucket) { return ( // When dragging from a bucket who has its limit reached, dragging should still be possible