From e16d28a668e7914e2d373c455edf7755cbdb919c Mon Sep 17 00:00:00 2001 From: Harsh Mahajan <127186841+HarshMN2345@users.noreply.github.com> Date: Mon, 8 Sep 2025 12:13:29 +0530 Subject: [PATCH] initial ui --- src/lib/components/csvImportBox.svelte | 66 +++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/src/lib/components/csvImportBox.svelte b/src/lib/components/csvImportBox.svelte index 8ff2838ab..488d3e434 100644 --- a/src/lib/components/csvImportBox.svelte +++ b/src/lib/components/csvImportBox.svelte @@ -9,6 +9,8 @@ import { writable, type Writable } from 'svelte/store'; import { addNotification } from '$lib/stores/notifications'; import { Layout, Typography } from '@appwrite.io/pink-svelte'; + import Modal from '$lib/components/modal.svelte'; + import Code from '$lib/components/code.svelte'; import { type Models, type Payload, Query } from '@appwrite.io/console'; // re-render the key for sheet UI. @@ -18,6 +20,7 @@ type ImportItem = { status: string; table?: string; + errors?: any[]; }; type ImportItemsMap = Map; @@ -103,7 +106,11 @@ if (shouldSkip) return items; const next = new Map(items); - next.set(importData.$id, { status, table: tableName ?? undefined }); + next.set(importData.$id, { + status, + table: tableName ?? undefined, + errors: importData.errors || [] + }); return next; }); @@ -168,8 +175,24 @@ }); }); + let showDetails = false; + let selectedErrors: any[] = []; + $: isOpen = true; $: showCsvImportBox = $importItems.size > 0; + + $: parsedErrors = (selectedErrors || []).map((e) => { + try { + return JSON.stringify(JSON.parse(e as unknown as string), null, 2); + } catch { + return typeof e === 'string' ? (e as string) : JSON.stringify(e, null, 2); + } + }); + + function openDetails(errors: any[]) { + selectedErrors = errors; + showDetails = true; + } {#if showCsvImportBox} @@ -213,6 +236,20 @@ 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} @@ -220,6 +257,21 @@ {/each} + + +
+ +
+
+ + + +
{/if} @@ -265,4 +317,16 @@ background-color: var(--bgcolor-error); } } + + .wrapped-code-block-for-multi-line { + max-inline-size: 800px; + } + + .modal-footer-nowrap { + white-space: nowrap; + } + + .error-message-nowrap { + white-space: nowrap; + }