Merge remote-tracking branch 'origin/dev' into dev
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 2m0s
Build and Push Docker Images / build-frontend (push) Successful in 1m13s
Build and Push Docker Images / build-website (push) Successful in 20s
Build and Push Docker Images / build-docs (push) Successful in 16s
All checks were successful
Build and Push Docker Images / build-backend (push) Successful in 2m0s
Build and Push Docker Images / build-frontend (push) Successful in 1m13s
Build and Push Docker Images / build-website (push) Successful in 20s
Build and Push Docker Images / build-docs (push) Successful in 16s
This commit is contained in:
@@ -54,11 +54,20 @@ export type TenantImportResult = {
|
||||
tenantId: number
|
||||
tables: { table: string; rows: number }[]
|
||||
files: { restored: number; skipped: number }
|
||||
importId?: string
|
||||
exportId?: string
|
||||
status?: string
|
||||
filename?: string
|
||||
filesDone?: number
|
||||
filesTotal?: number
|
||||
error?: string | null
|
||||
}
|
||||
|
||||
export type TenantExportJob = {
|
||||
exportId: string
|
||||
importId?: string
|
||||
tenantId?: number
|
||||
operation?: "export" | "import" | string
|
||||
status: "queued" | "running" | "ready" | "failed" | string
|
||||
filename: string
|
||||
fileSize?: number | null
|
||||
|
||||
@@ -18,6 +18,12 @@ const tenantExportProgress = ref<null | {
|
||||
filesTotal: number
|
||||
filename: string
|
||||
}>(null)
|
||||
const tenantImportProgress = ref<null | {
|
||||
status: string
|
||||
filesDone: number
|
||||
filesTotal: number
|
||||
filename: string
|
||||
}>(null)
|
||||
const creatingUser = ref(false)
|
||||
const createUserModalOpen = ref(false)
|
||||
const createdUserPassword = ref("")
|
||||
@@ -169,6 +175,7 @@ const importTenantExport = async (event: Event) => {
|
||||
if (!file || importingTenant.value) return
|
||||
|
||||
importingTenant.value = true
|
||||
tenantImportProgress.value = null
|
||||
lastImportResult.value = null
|
||||
|
||||
try {
|
||||
@@ -188,6 +195,44 @@ const importTenantExport = async (event: Event) => {
|
||||
})
|
||||
}
|
||||
|
||||
const importJobId = result.importId || result.exportId
|
||||
if (importJobId) {
|
||||
let job = result
|
||||
|
||||
tenantImportProgress.value = {
|
||||
status: job.status,
|
||||
filesDone: job.filesDone || 0,
|
||||
filesTotal: job.filesTotal || 0,
|
||||
filename: job.filename || file.name,
|
||||
}
|
||||
|
||||
while (!["ready", "failed"].includes(job.status)) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 1500))
|
||||
job = await admin.getTenantExport(importJobId)
|
||||
tenantImportProgress.value = {
|
||||
status: job.status,
|
||||
filesDone: job.filesDone || 0,
|
||||
filesTotal: job.filesTotal || 0,
|
||||
filename: job.filename || file.name,
|
||||
}
|
||||
}
|
||||
|
||||
if (job.status === "failed") {
|
||||
throw new Error(job.error || "Import konnte nicht abgeschlossen werden.")
|
||||
}
|
||||
|
||||
await fetchTenant()
|
||||
await auth.fetchMe()
|
||||
await auth.switchTenant(String(job.tenantId || targetTenantId))
|
||||
|
||||
toast.add({
|
||||
title: "Mandantenimport abgeschlossen",
|
||||
description: job.filename || file.name,
|
||||
color: "green",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const rowCount = (result.tables || []).reduce((sum, table) => sum + table.rows, 0)
|
||||
|
||||
lastImportResult.value = {
|
||||
@@ -396,6 +441,17 @@ onMounted(async () => {
|
||||
>
|
||||
Export importieren
|
||||
</UButton>
|
||||
<div v-if="tenantImportProgress" class="mt-4 space-y-2">
|
||||
<UProgress
|
||||
:model-value="tenantImportProgress.filesTotal ? Math.round((tenantImportProgress.filesDone / tenantImportProgress.filesTotal) * 100) : undefined"
|
||||
/>
|
||||
<p class="text-xs text-gray-500">
|
||||
{{ tenantImportProgress.status === 'ready' ? 'Import abgeschlossen' : 'Import wird verarbeitet' }}
|
||||
<span v-if="tenantImportProgress.filesTotal">
|
||||
· {{ tenantImportProgress.filesDone }} / {{ tenantImportProgress.filesTotal }} Schritte
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user