mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 14:46:01 +00:00
quick export WIP
This commit is contained in:
29
packages/web/src/utility/exportElectronFile.ts
Normal file
29
packages/web/src/utility/exportElectronFile.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import { get } from 'svelte/store';
|
||||
import newQuery from '../query/newQuery';
|
||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import getElectron from './getElectron';
|
||||
import { currentDatabase, extensions } from '../stores';
|
||||
import { getUploadListener } from './uploadFiles';
|
||||
import axiosInstance from '../utility/axiosInstance';
|
||||
import { getDatabaseFileLabel } from './getConnectionLabel';
|
||||
|
||||
function getFileFormatFilters(extensions) {
|
||||
return extensions.quickExports.map(x => ({ name: x.label, extensions: [x.extension] }));
|
||||
}
|
||||
|
||||
export async function exportElectronFile() {
|
||||
const electron = getElectron();
|
||||
const ext = get(extensions);
|
||||
const filters = getFileFormatFilters(ext);
|
||||
console.log('FLT', filters);
|
||||
electron.remote.dialog
|
||||
.showSaveDialog(electron.remote.getCurrentWindow(), {
|
||||
filters,
|
||||
})
|
||||
.then(filePaths => {
|
||||
console.log('filePaths ASYNC2', filePaths);
|
||||
const filePath = filePaths && filePaths[0];
|
||||
console.log('filePath', filePath);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user