From 360332c40e501a7846ce18bc39fbe9510db16d6e Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:32:52 +0000 Subject: [PATCH] feat(nc-gui): add separator option in csv export extension --- .../nc-gui/extensions/data-exporter/index.vue | 213 +++++++++++------- 1 file changed, 135 insertions(+), 78 deletions(-) diff --git a/packages/nc-gui/extensions/data-exporter/index.vue b/packages/nc-gui/extensions/data-exporter/index.vue index 8c0d803fd7..855658a031 100644 --- a/packages/nc-gui/extensions/data-exporter/index.vue +++ b/packages/nc-gui/extensions/data-exporter/index.vue @@ -7,6 +7,25 @@ const jobStatusTooltip = { [JobStatus.FAILED]: 'Export failed', } as Record +const delimiters = [ + { + label: 'Comma (,)', + value: ',', + }, + { + label: 'Semicolon (;)', + value: ';', + }, + { + label: 'Tab (\\t)', + value: '\\t', + }, + { + label: 'Pipe (|)', + value: '|', + }, +] + const { $api, $poller } = useNuxtApp() const { appInfo } = useGlobal() @@ -60,7 +79,10 @@ const exportedFiles = computed(() => { const exportPayload = ref<{ tableId?: string viewId?: string -}>({}) + delimiter?: string +}>({ + delimiter: ',', +}) const tableList = computed(() => { return tables.value.map((table) => { @@ -123,7 +145,10 @@ async function exportDataAsync() { isExporting.value = true - const jobData = await $api.export.data(exportPayload.value.viewId, 'csv', { extension_id: extension.value.id }) + const jobData = await $api.export.data(exportPayload.value.viewId, 'csv', { + extension_id: extension.value.id, + delimiter: exportPayload.value.delimiter, + }) jobList.value.unshift(jobData) $poller.subscribe( @@ -255,51 +280,133 @@ onMounted(async () => { 'bg-nc-bg-gray-extralight': fullscreen, }" > -
+
- + + + +
+
+ +
+ + + {{ table.label }} + + +
+
+
+
+ + + + +
+
+ +
+ + + {{ view.label }} + + +
+
+
+
+ + + {{ isExporting ? 'Generating' : 'Export' }} + +
+
+ +
+ - +
-
- -
- - {{ table.label }} + + {{ delimiter.label }} @@ -307,56 +414,6 @@ onMounted(async () => { - - - - -
-
- -
- - - {{ view.label }} - - -
-
-
-
- - - {{ isExporting ? 'Generating' : 'Export' }} -