diff --git a/package.json b/package.json index a2e1778fe3..c0ce9a91f4 100644 --- a/package.json +++ b/package.json @@ -99,5 +99,5 @@ "svelte-preprocess" ] }, - "packageManager": "pnpm@10.20.0" + "packageManager": "pnpm@10.18.3" } diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index dea8860b55..cd9e75aeb2 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -153,6 +153,7 @@ export enum Click { DatabaseTableDelete = 'click_table_delete', DatabaseDatabaseDelete = 'click_database_delete', DatabaseImportCsv = 'click_database_import_csv', + DatabaseExportCsv = 'click_database_export_csv', DomainCreateClick = 'click_domain_create', DomainDeleteClick = 'click_domain_delete', DomainRetryDomainVerificationClick = 'click_domain_retry_domain_verification', @@ -277,6 +278,7 @@ export enum Submit { DatabaseDelete = 'submit_database_delete', DatabaseUpdateName = 'submit_database_update_name', DatabaseImportCsv = 'submit_database_import_csv', + DatabaseExportCsv = 'submit_database_export_csv', DatabaseBackupDelete = 'submit_database_backup_delete', ColumnCreate = 'submit_column_create', diff --git a/src/lib/components/csvExportBox.svelte b/src/lib/components/csvExportBox.svelte new file mode 100644 index 0000000000..2aa87b3b58 --- /dev/null +++ b/src/lib/components/csvExportBox.svelte @@ -0,0 +1,292 @@ + + +{#if showCsvExportBox} + +
+
+

+ + Exporting rows ({exportItems.size}) + +

+ + +
+ +
+ {#each [...exportItems.entries()] as [key, value] (key)} +
+
    +
  • +
    +
    + + {@html text(value.status, value.table)} + + {#if value.status === 'failed' && value.errors && value.errors.length > 0} + + {/if} +
    +
    +
    +
    +
  • +
+
+ {/each} +
+
+
+{/if} + + + {#if selectedErrors.length > 0} + { + try { + return JSON.parse(err); + } catch { + return err; + } + }), + null, + 2 + )} + lang="json" + hideHeader /> + {/if} + + + diff --git a/src/lib/components/index.ts b/src/lib/components/index.ts index df9a3ceeaf..09b4d248c3 100644 --- a/src/lib/components/index.ts +++ b/src/lib/components/index.ts @@ -13,6 +13,7 @@ export { default as Copy } from './copy.svelte'; export { default as CopyInput } from './copyInput.svelte'; export { default as UploadBox } from './uploadBox.svelte'; export { default as BackupRestoreBox } from './backupRestoreBox.svelte'; +export { default as CsvExportBox } from './csvExportBox.svelte'; export { default as List } from './list.svelte'; export { default as ListItem } from './listItem.svelte'; export { default as Empty } from './empty.svelte'; diff --git a/src/lib/elements/forms/inputCheckbox.svelte b/src/lib/elements/forms/inputCheckbox.svelte index 9ccb04f532..ef4c5f4150 100644 --- a/src/lib/elements/forms/inputCheckbox.svelte +++ b/src/lib/elements/forms/inputCheckbox.svelte @@ -12,6 +12,7 @@ indeterminate?: boolean; size?: 's' | 'm'; description?: string; + truncate?: boolean; } export let id: string = ''; @@ -22,6 +23,7 @@ export let element: HTMLInputElement | undefined = undefined; export let size: $$Props['size'] = 's'; export let description = ''; + export let truncate: boolean = false; let error: string; const handleInvalid = (event: Event) => { @@ -50,6 +52,7 @@ {label} {required} {description} + {truncate} on:invalid={handleInvalid} on:click on:change /> diff --git a/src/routes/(console)/project-[region]-[project]/+layout.svelte b/src/routes/(console)/project-[region]-[project]/+layout.svelte index eeeff2dd77..a2e8a1d585 100644 --- a/src/routes/(console)/project-[region]-[project]/+layout.svelte +++ b/src/routes/(console)/project-[region]-[project]/+layout.svelte @@ -1,5 +1,5 @@ @@ -172,17 +190,10 @@ justifyContent="flex-end" style="padding-right: 40px;"> - + justifyContent="flex-end" + gap="s"> {#if !$isSmallViewport} + secondary + class="small-button-dimensions" + disabled={!(hasColumns && hasValidColumns) || disableButton} + on:click={() => (showImportCSV = true)}> + + + + Import CSV + + + + + + Export CSV + + + {!$expandTabs ? 'Expand' : 'Collapse'} + {/if} @@ -383,6 +431,7 @@ :global(.rotating) { animation: rotate 1s linear infinite; + animation-direction: reverse; } @keyframes rotate { diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte new file mode 100644 index 0000000000..8858a90959 --- /dev/null +++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/export/+page.svelte @@ -0,0 +1,248 @@ + + + +
+ +
+ + + + + + + + + + + {#each visibleColumns as column (column.key)} +
+ +
+ {/each} +
+ + {#if hasMoreColumns} +
+ +
+ {/if} +
+
+ +
+ + + + + + + Define how to separate values in the exported file. + + + + + + + + +
+ +
+ + {#if localTags.length > 0} + + { + removeLocalFilter(e.detail); + }} /> + + {/if} +
+
+
+
+
+ + + + + + +
+ +