fix frontend review followups and pin deploy image tags
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
<button
|
||||
class="sora-gallery-card-action"
|
||||
title="删除"
|
||||
@click.stop="handleDelete(item.id)"
|
||||
@click.stop="requestDelete(item.id)"
|
||||
>
|
||||
🗑
|
||||
</button>
|
||||
@@ -119,6 +119,16 @@
|
||||
@save="handleSaveFromPreview"
|
||||
@download="handleDownloadUrl"
|
||||
/>
|
||||
<ConfirmDialog
|
||||
:show="showDeleteConfirmDialog"
|
||||
:title="t('common.delete')"
|
||||
:message="t('sora.confirmDelete')"
|
||||
:confirm-text="t('common.delete')"
|
||||
:cancel-text="t('common.cancel')"
|
||||
danger
|
||||
@confirm="confirmDelete"
|
||||
@cancel="closeDeleteConfirmDialog"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -127,6 +137,7 @@ import { ref, computed, onMounted } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import soraAPI, { type SoraGeneration } from '@/api/sora'
|
||||
import { getPersistedPageSize } from '@/composables/usePersistedPageSize'
|
||||
import ConfirmDialog from '@/components/common/ConfirmDialog.vue'
|
||||
import SoraMediaPreview from './SoraMediaPreview.vue'
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -142,6 +153,8 @@ const hasMore = ref(true)
|
||||
const activeFilter = ref('all')
|
||||
const previewVisible = ref(false)
|
||||
const previewItem = ref<SoraGeneration | null>(null)
|
||||
const showDeleteConfirmDialog = ref(false)
|
||||
const pendingDeleteId = ref<number | null>(null)
|
||||
|
||||
const filters = computed(() => [
|
||||
{ value: 'all', label: t('sora.filterAll') },
|
||||
@@ -217,8 +230,17 @@ function openPreview(item: SoraGeneration) {
|
||||
previewVisible.value = true
|
||||
}
|
||||
|
||||
function closeDeleteConfirmDialog() {
|
||||
showDeleteConfirmDialog.value = false
|
||||
pendingDeleteId.value = null
|
||||
}
|
||||
|
||||
function requestDelete(id: number) {
|
||||
pendingDeleteId.value = id
|
||||
showDeleteConfirmDialog.value = true
|
||||
}
|
||||
|
||||
async function handleDelete(id: number) {
|
||||
if (!confirm(t('sora.confirmDelete'))) return
|
||||
try {
|
||||
await soraAPI.deleteGeneration(id)
|
||||
items.value = items.value.filter(i => i.id !== id)
|
||||
@@ -227,6 +249,13 @@ async function handleDelete(id: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmDelete() {
|
||||
const id = pendingDeleteId.value
|
||||
closeDeleteConfirmDialog()
|
||||
if (id == null) return
|
||||
await handleDelete(id)
|
||||
}
|
||||
|
||||
function handleDownload(item: SoraGeneration) {
|
||||
if (item.media_url) {
|
||||
window.open(item.media_url, '_blank')
|
||||
|
||||
Reference in New Issue
Block a user