You've already forked agentic-coding-workflow
feat(web): workspace selector on issue/requirement detail
This commit is contained in:
@@ -85,6 +85,17 @@
|
||||
</p>
|
||||
</NCard>
|
||||
|
||||
<!-- Workspace card -->
|
||||
<NCard title="工作区">
|
||||
<NSelect
|
||||
:value="data.requirement.workspace_id"
|
||||
:options="workspaceOptions"
|
||||
placeholder="未关联"
|
||||
clearable
|
||||
@update:value="onWorkspaceChange"
|
||||
/>
|
||||
</NCard>
|
||||
|
||||
<!-- Linked Issues -->
|
||||
<NCard title="关联 Issue">
|
||||
<NList
|
||||
@@ -129,7 +140,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useDialog } from 'naive-ui'
|
||||
import {
|
||||
@@ -137,6 +148,7 @@ import {
|
||||
NButton,
|
||||
NTag,
|
||||
NSpin,
|
||||
NSelect,
|
||||
NList,
|
||||
NListItem,
|
||||
NThing,
|
||||
@@ -145,6 +157,7 @@ import {
|
||||
import AppShell from '@/layouts/AppShell.vue'
|
||||
import { projectsApi } from '@/api/projects'
|
||||
import { useRequirementsStore } from '@/stores/requirements'
|
||||
import { useWorkspacesStore } from '@/stores/workspaces'
|
||||
import type { Phase, RequirementDetail } from '@/api/projects'
|
||||
|
||||
const PHASES: Phase[] = ['planning', 'auditing', 'implementing', 'reviewing', 'done']
|
||||
@@ -161,6 +174,7 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
const dialog = useDialog()
|
||||
const store = useRequirementsStore()
|
||||
const wsStore = useWorkspacesStore()
|
||||
|
||||
const slug = route.params.slug as string
|
||||
const number = Number(route.params.number)
|
||||
@@ -169,15 +183,30 @@ const loading = ref(false)
|
||||
const toggling = ref(false)
|
||||
const data = ref<RequirementDetail | null>(null)
|
||||
|
||||
const workspaceOptions = computed(() =>
|
||||
wsStore.list.map((w) => ({ label: `${w.name} (${w.slug})`, value: w.id })),
|
||||
)
|
||||
|
||||
async function fetchData() {
|
||||
loading.value = true
|
||||
try {
|
||||
data.value = await projectsApi.getRequirement(slug, number)
|
||||
const [detail] = await Promise.all([
|
||||
projectsApi.getRequirement(slug, number),
|
||||
wsStore.fetchByProject(slug),
|
||||
])
|
||||
data.value = detail
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onWorkspaceChange(v: string | null) {
|
||||
if (!data.value) return
|
||||
await projectsApi.updateRequirement(slug, number, { workspace_id: v })
|
||||
// Re-fetch to keep data.requirement and data.issues consistent (mirrors onPhaseClick)
|
||||
data.value = await projectsApi.getRequirement(slug, number)
|
||||
}
|
||||
|
||||
function onPhaseClick(target: Phase) {
|
||||
if (!data.value || data.value.requirement.phase === target) return
|
||||
const targetLabel = PHASE_LABELS[target]
|
||||
|
||||
Reference in New Issue
Block a user