Browse Source

Merge pull request #7704 from nocodb/fix/export-issue

fix(nc-gui): export issue
pull/7706/head
Raju Udava 7 months ago committed by GitHub
parent
commit
782c282ae2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      packages/nc-gui/components/smartsheet/sidebar/toolbar/ExportCache.vue
  2. 7
      packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue
  3. 7
      packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue

5
packages/nc-gui/components/smartsheet/sidebar/toolbar/ExportCache.vue

@ -1,4 +1,5 @@
<script setup lang="ts">
import { saveAs } from 'file-saver'
import { iconMap, message, useApi, useI18n } from '#imports'
const { t } = useI18n()
@ -6,8 +7,6 @@ const { t } = useI18n()
const { api } = useApi()
async function exportCache() {
const FileSaver = await import('file-saver')
try {
const data = await api.utils.cacheGet()
if (!data) {
@ -20,7 +19,7 @@ async function exportCache() {
type: 'text/plain;charset=utf-8',
})
FileSaver.saveAs(blob, 'cache_exported.json')
saveAs(blob, 'cache_exported.json')
// Exported Cache Successfully
message.info(t('msg.info.exportedCache'))

7
packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue

@ -1,6 +1,8 @@
<script setup lang="ts">
import type { RequestParams } from 'nocodb-sdk'
import { ExportTypes } from 'nocodb-sdk'
import { saveAs } from 'file-saver'
import * as XLSX from 'xlsx'
import {
ActiveViewInj,
FieldsInj,
@ -40,9 +42,6 @@ const exportFile = async (exportType: ExportTypes) => {
isExportingType.value = exportType
const XLSX = await import('xlsx')
const FileSaver = await import('file-saver')
try {
while (!isNaN(offset) && offset > -1) {
let res
@ -80,7 +79,7 @@ const exportFile = async (exportType: ExportTypes) => {
} else if (exportType === ExportTypes.CSV) {
const blob = new Blob([data], { type: 'text/plain;charset=utf-8' })
FileSaver.saveAs(blob, `${meta.value?.title}_exported_${c++}.csv`)
saveAs(blob, `${meta.value?.title}_exported_${c++}.csv`)
}
offset = +headers['nc-export-offset']

7
packages/nc-gui/components/smartsheet/toolbar/MoreActions.vue

@ -1,6 +1,8 @@
<script lang="ts" setup>
import type { RequestParams } from 'nocodb-sdk'
import { ExportTypes } from 'nocodb-sdk'
import { saveAs } from 'file-saver'
import * as XLSX from 'xlsx'
import {
ActiveViewInj,
FieldsInj,
@ -55,9 +57,6 @@ const exportFile = async (exportType: ExportTypes) => {
let c = 1
const responseType = exportType === ExportTypes.EXCEL ? 'base64' : 'blob'
const XLSX = await import('xlsx')
const FileSaver = await import('file-saver')
try {
while (!isNaN(offset) && offset > -1) {
let res
@ -87,7 +86,7 @@ const exportFile = async (exportType: ExportTypes) => {
XLSX.writeFile(workbook, `${meta.value?.title}_exported_${c++}.xlsx`)
} else if (exportType === ExportTypes.CSV) {
const blob = new Blob([data], { type: 'text/plain;charset=utf-8' })
FileSaver.saveAs(blob, `${meta.value?.title}_exported_${c++}.csv`)
saveAs(blob, `${meta.value?.title}_exported_${c++}.csv`)
}
offset = +headers['nc-export-offset']
if (offset > -1) {

Loading…
Cancel
Save