1 parent
cc490f8d4a
commit
7639a54c50
8 files changed
+135
-2
No files matched your search
@@ -15,6 +15,7 @@ import SplitHandle from '@/components/SplitHandle.vue'
|
||||
import { useSplitPane } from '@/composables/useSplitPane.ts'
|
||||
import FileUpload from '@/components/FileUpload.vue'
|
||||
import PriorityMenu from '@/components/PriorityMenu.vue'
|
||||
import IssueType from '@/components/IssueType.vue'
|
||||
|
||||
interface Props {
|
||||
ckey: string
|
||||
@@ -22,6 +23,7 @@ interface Props {
|
||||
|
||||
const emit = defineEmits<{
|
||||
statusChanged: [issue: Issue]
|
||||
typeChanged: [issue: Issue]
|
||||
assigneeChanged: [issue: Issue]
|
||||
priorityChanged: [issue: Issue]
|
||||
titleChanged: [issue: Issue]
|
||||
@@ -77,6 +79,16 @@ const onContentChanged = async (content: string) => {
|
||||
if (updated) issue.value = updated
|
||||
}
|
||||
|
||||
const onTypeChanged = async (type: Issue['type']) => {
|
||||
if (!issue.value) return
|
||||
|
||||
const updated = await issueStore.update(issue.value.id, { type })
|
||||
if (updated) {
|
||||
issue.value = updated
|
||||
emit('typeChanged', updated)
|
||||
}
|
||||
}
|
||||
|
||||
const onStatusChanged = async (status: Issue['status']) => {
|
||||
if (!issue.value) return
|
||||
|
||||
@@ -128,6 +140,9 @@ defineExpose({
|
||||
<div class="text-medium-emphasis">Status:</div>
|
||||
<status-menu :value="issue.status" @changed="onStatusChanged" />
|
||||
|
||||
<div class="text-medium-emphasis">Type:</div>
|
||||
<issue-type :value="issue.type" :compact="false" @changed="onTypeChanged" />
|
||||
|
||||
<div class="text-medium-emphasis">Priority:</div>
|
||||
<priority-menu :value="issue.priority" :compact="false" @changed="onPriorityChanged" />
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useIssueTypeStore } from '@/stores/issue-type.ts'
|
||||
import type { Issue } from '@/api/issue.api.ts'
|
||||
|
||||
interface Props {
|
||||
value?: string
|
||||
compact?: boolean
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), { compact: true })
|
||||
const emit = defineEmits<{ changed: [value: Issue['type']] }>()
|
||||
|
||||
const issueTypeStore = useIssueTypeStore()
|
||||
|
||||
const icons: Record<string, string> = {
|
||||
BUG: 'mdi-bug-outline',
|
||||
TASK: 'mdi-checkbox-outline',
|
||||
FEATURE: 'mdi-bookmark-outline',
|
||||
}
|
||||
const defaultIcon = 'mdi-star-outline'
|
||||
|
||||
const iconOf = (alias?: string) => (alias && icons[alias]) || defaultIcon
|
||||
|
||||
const current = computed(() => issueTypeStore.issueTypes?.find((el) => el.alias === props.value))
|
||||
const currentIcon = computed(() => iconOf(props.value))
|
||||
const currentColor = computed(() => current.value?.color ?? 'primary')
|
||||
const currentName = computed(() => current.value?.name ?? props.value ?? '')
|
||||
|
||||
const availableTypes = computed(() => issueTypeStore.issueTypes?.filter((el) => el.alias !== props.value))
|
||||
|
||||
const select = (value: unknown) => {
|
||||
if (Array.isArray(value)) {
|
||||
emit('changed', value[0])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<v-menu>
|
||||
<template v-slot:activator="{ props: activatorProps }">
|
||||
<v-btn
|
||||
v-if="props.compact"
|
||||
density="compact"
|
||||
:icon="currentIcon"
|
||||
:color="currentColor"
|
||||
:title="currentName"
|
||||
variant="text"
|
||||
v-bind="activatorProps"
|
||||
/>
|
||||
|
||||
<v-btn v-else density="compact" class="px-1" variant="text" v-bind="activatorProps">
|
||||
<div class="d-flex align-center ga-1">
|
||||
<v-icon :color="currentColor" :icon="currentIcon" />
|
||||
<span>{{ currentName }}</span>
|
||||
</div>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-list border class="mt-1" select-strategy="single-leaf" density="compact" @update:selected="select">
|
||||
<v-list-item v-for="el in availableTypes" :key="el.alias" :value="el.alias">
|
||||
<div class="d-flex justify-start align-center ga-1">
|
||||
<v-icon size="small" :icon="iconOf(el.alias)" :color="el.color" />
|
||||
<div>{{ el.name }}</div>
|
||||
</div>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
@@ -5,6 +5,7 @@ import { useIssueStore } from '@/stores/issue.ts'
|
||||
import type { Issue } from '@/api/issue.api.ts'
|
||||
import AssigneeMenu from '@/components/AssigneeMenu.vue'
|
||||
import { useIssueListOptions } from '@/composables/useIssueListOptions.ts'
|
||||
import IssueType from '@/components/IssueType.vue'
|
||||
|
||||
interface Props {
|
||||
issue: Issue
|
||||
@@ -14,6 +15,7 @@ interface Props {
|
||||
const { issue, selected } = defineProps<Props>()
|
||||
const emit = defineEmits<{
|
||||
statusChanged: [issue: Issue]
|
||||
typeChanged: [issue: Issue]
|
||||
priorityChanged: [issue: Issue]
|
||||
assigneeChanged: [issue: Issue]
|
||||
toggleSelect: [id: number]
|
||||
@@ -27,6 +29,11 @@ const onStatusChanged = async (status: Issue['status']) => {
|
||||
if (updated) emit('statusChanged', updated)
|
||||
}
|
||||
|
||||
const onTypeChanged = async (type: Issue['type']) => {
|
||||
const updated = await issueStore.update(issue.id, { type })
|
||||
if (updated) emit('typeChanged', updated)
|
||||
}
|
||||
|
||||
const onPriorityChanged = async (priority: Issue['priority']) => {
|
||||
const updated = await issueStore.update(issue.id, { priority })
|
||||
if (updated) emit('priorityChanged', updated)
|
||||
@@ -49,7 +56,11 @@ const onAssigneeChanged = async (assignee: string) => {
|
||||
icon="mdi-alert-box"
|
||||
color="error"
|
||||
/>
|
||||
<div v-if="visible.title" class="flex-shrink-0" :class="{ 'text-decoration-line-through': issue.status === 'DONE' }">
|
||||
<div
|
||||
v-if="visible.title"
|
||||
class="flex-shrink-0"
|
||||
:class="{ 'text-decoration-line-through': issue.status === 'DONE' }"
|
||||
>
|
||||
{{ issue.title }}
|
||||
</div>
|
||||
<div
|
||||
@@ -72,6 +83,7 @@ const onAssigneeChanged = async (assignee: string) => {
|
||||
:model-value="selected"
|
||||
@update:model-value="emit('toggleSelect', issue.id)"
|
||||
/>
|
||||
<issue-type :value="issue.type" @changed="onTypeChanged" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user