diff --git a/src/lib/components/csvImportBox.svelte b/src/lib/components/csvImportBox.svelte index 3eb45799f2..3be16f1f85 100644 --- a/src/lib/components/csvImportBox.svelte +++ b/src/lib/components/csvImportBox.svelte @@ -9,11 +9,13 @@ import { writable, type Writable } from 'svelte/store'; import { addNotification } from '$lib/stores/notifications'; import { Layout, Typography } from '@appwrite.io/pink-svelte'; + import { Modal, Code } from '$lib/components'; import { type Models, type Payload, Query } from '@appwrite.io/console'; type ImportItem = { status: string; table?: string; + errors?: string[]; }; type ImportItemsMap = Map; @@ -95,7 +97,10 @@ if (shouldSkip) return items; const next = new Map(items); - next.set(importData.$id, { status, table: tableName ?? undefined }); + const errors = Array.isArray((importData as any)?.errors) + ? ((importData as any)?.errors as string[]) + : existing?.errors; + next.set(importData.$id, { status, table: tableName ?? undefined, errors }); return next; }); @@ -160,6 +165,22 @@ $: isOpen = true; $: showCsvImportBox = $importItems.size > 0; + + let showDetails = false; + let selectedErrors: string[] = []; + + function openDetails(errors?: string[]) { + selectedErrors = errors ?? []; + showDetails = true; + } + + $: parsedErrors = (selectedErrors || []).map((e) => { + try { + return JSON.stringify(JSON.parse(e), null, 2); + } catch { + return typeof e === 'string' ? e : JSON.stringify(e, null, 2); + } + }); {#if showCsvImportBox} @@ -202,12 +223,40 @@ class:is-danger={value.status === 'failed'} style="--graph-size:{graphSize(value.status)}%"> + {#if value.status === 'failed' && value.errors?.length} +
+ + + There was an import issue. + + +
+ {/if} {/each} + + + + The import encountered errors. Review the details below. + +
+ +
+
+
{/if} diff --git a/src/lib/components/migrationBox.svelte b/src/lib/components/migrationBox.svelte index 52155f0e2f..0dd14c7c3d 100644 --- a/src/lib/components/migrationBox.svelte +++ b/src/lib/components/migrationBox.svelte @@ -11,6 +11,7 @@ {#if $showMigrationBox && migration} @@ -85,7 +95,29 @@ class:is-danger={migration.status === 'failed'} style="--graph-size:{percentage}%"> + {#if migration.status === 'failed' && migration.errors?.length} +
+ + + There was an import issue. + + +
+ {/if} + +
+ +
+
{/if}