Browse Source

fix(nc-gui): export import extension optimization

Ramesh Mane 5 days ago
parent
commit
2dbdbe5fb2
  1. 23
      packages/nc-gui/extensions/data-exporter/index.vue
  2. 33
      packages/nocodb-sdk/src/lib/import-export-data.ts

23
packages/nc-gui/extensions/data-exporter/index.vue

@ -1,31 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { SupportedExportCharset, type ViewType, ViewTypes, charsetOptions } from 'nocodb-sdk' import { SupportedExportCharset, type ViewType, ViewTypes, charsetOptions, csvColumnSeparatorOptions } from 'nocodb-sdk'
const jobStatusTooltip = { const jobStatusTooltip = {
[JobStatus.COMPLETED]: 'Export successful', [JobStatus.COMPLETED]: 'Export successful',
[JobStatus.FAILED]: 'Export failed', [JobStatus.FAILED]: 'Export failed',
} as Record<string, string> } as Record<string, string>
const delimiters = [
{
label: ',',
value: ',',
},
{
label: ';',
value: ';',
},
{
label: '|',
value: '|',
},
{
label: '<Tab>',
value: '\\t',
},
]
const { $api, $poller } = useNuxtApp() const { $api, $poller } = useNuxtApp()
const { appInfo } = useGlobal() const { appInfo } = useGlobal()
@ -308,7 +289,7 @@ onMounted(async () => {
dropdown-class-name="w-[180px]" dropdown-class-name="w-[180px]"
@change="saveChanges" @change="saveChanges"
> >
<a-select-option v-for="delimiter of delimiters" :key="delimiter.value" :value="delimiter.value"> <a-select-option v-for="delimiter of csvColumnSeparatorOptions" :key="delimiter.value" :value="delimiter.value">
<div class="w-full flex items-center gap-2"> <div class="w-full flex items-center gap-2">
<NcTooltip class="flex-1 truncate" show-on-truncate-only> <NcTooltip class="flex-1 truncate" show-on-truncate-only>
<template #title>{{ delimiter.label }}</template> <template #title>{{ delimiter.label }}</template>

33
packages/nocodb-sdk/src/lib/import-export-data.ts

@ -34,13 +34,6 @@ export enum SupportedExportCharset {
'iso-8859-3' = 'iso-8859-3', 'iso-8859-3' = 'iso-8859-3',
} }
export enum CsvColumnSeparator {
',' = ',',
';' = ';',
'|' = '|',
'tab' = '\t',
}
export const charsetOptions = [ export const charsetOptions = [
{ label: 'Unicode (UTF-8)', value: SupportedExportCharset['utf-8'] }, { label: 'Unicode (UTF-8)', value: SupportedExportCharset['utf-8'] },
{ label: 'Arabic (ISO-8859-6)', value: SupportedExportCharset['iso-8859-6'] }, { label: 'Arabic (ISO-8859-6)', value: SupportedExportCharset['iso-8859-6'] },
@ -133,3 +126,29 @@ export const charsetOptions = [
value: SupportedExportCharset['iso-8859-3'], value: SupportedExportCharset['iso-8859-3'],
}, },
]; ];
export enum CsvColumnSeparator {
',' = ',',
';' = ';',
'|' = '|',
'tab' = '\t',
}
export const csvColumnSeparatorOptions = [
{
label: ',',
value: CsvColumnSeparator[','],
},
{
label: ';',
value: CsvColumnSeparator[';'],
},
{
label: '|',
value: CsvColumnSeparator['|'],
},
{
label: '<Tab>',
value: CsvColumnSeparator['tab'],
},
];

Loading…
Cancel
Save