mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
upload ndjson to web app
This commit is contained in:
1
packages/types/extensions.d.ts
vendored
1
packages/types/extensions.d.ts
vendored
@@ -3,6 +3,7 @@ import { EngineDriver } from './engines';
|
||||
export interface FileFormatDefinition {
|
||||
storageType: string;
|
||||
extension: string;
|
||||
extensions?: string[];
|
||||
name: string;
|
||||
readerFunc?: string;
|
||||
writerFunc?: string;
|
||||
|
||||
@@ -57,7 +57,7 @@ function openElectronJsonLinesFile(filePath, parsed) {
|
||||
openNewTab({
|
||||
title: parsed.name,
|
||||
tooltip: filePath,
|
||||
icon: 'img sql-file',
|
||||
icon: 'img archive',
|
||||
tabComponent: 'ArchiveFileTab',
|
||||
props: {
|
||||
jslid: `file://${filePath}`,
|
||||
|
||||
@@ -7,6 +7,7 @@ import { findFileFormat } from '../plugins/fileformats';
|
||||
import { showModal } from '../modals/modalTools';
|
||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||
import openNewTab from './openNewTab';
|
||||
|
||||
let uploadListener;
|
||||
|
||||
@@ -53,8 +54,21 @@ export default function uploadFiles(files) {
|
||||
|
||||
fileData.shortName = file.name;
|
||||
|
||||
if (file.name.endsWith('.jsonl') || file.name.endsWith('.ndjson')) {
|
||||
openNewTab({
|
||||
title: fileData.shortName,
|
||||
icon: 'img archive',
|
||||
tabComponent: 'ArchiveFileTab',
|
||||
props: {
|
||||
jslid: `file://${fileData.filePath}`,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
for (const format of ext.fileFormats) {
|
||||
if (file.name.endsWith('.' + format.extension)) {
|
||||
// || format.extensions?.find(ext => file.name.endsWith('.' + ext))
|
||||
fileData.shortName = file.name.slice(0, -format.extension.length - 1);
|
||||
fileData.storageType = format.storageType;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user