Add project soft-delete with workspace archival
- Add delete button (×) to sidebar project list, shown on hover - Soft-delete: mark projects as deleted in DB instead of hard delete - Move workspace files to /app/data/deleted/ folder on deletion - Filter deleted projects from list query - Auto-select next project after deleting current one - Also includes agent prompt improvements for reverse proxy paths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,15 @@ defineProps<{
|
||||
const emit = defineEmits<{
|
||||
select: [id: string]
|
||||
create: []
|
||||
delete: [id: string]
|
||||
}>()
|
||||
|
||||
function onDelete(e: Event, id: string) {
|
||||
e.stopPropagation()
|
||||
if (confirm('确定删除这个项目?')) {
|
||||
emit('delete', id)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -26,7 +34,10 @@ const emit = defineEmits<{
|
||||
:class="{ active: project.id === selectedId }"
|
||||
@click="emit('select', project.id)"
|
||||
>
|
||||
<span class="project-name">{{ project.name }}</span>
|
||||
<div class="project-row">
|
||||
<span class="project-name">{{ project.name }}</span>
|
||||
<button class="btn-delete" @click="onDelete($event, project.id)" title="删除项目">×</button>
|
||||
</div>
|
||||
<span class="project-time">{{ new Date(project.updated_at).toLocaleDateString() }}</span>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -96,9 +107,46 @@ const emit = defineEmits<{
|
||||
border-left: 3px solid var(--accent);
|
||||
}
|
||||
|
||||
.project-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.project-name {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
display: none;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
font-size: 16px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
border-radius: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
background: var(--error, #e74c3c);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.project-item:hover .btn-delete {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.project-time {
|
||||
|
||||
Reference in New Issue
Block a user