mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 12:43:58 +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 {
|
export interface FileFormatDefinition {
|
||||||
storageType: string;
|
storageType: string;
|
||||||
extension: string;
|
extension: string;
|
||||||
|
extensions?: string[];
|
||||||
name: string;
|
name: string;
|
||||||
readerFunc?: string;
|
readerFunc?: string;
|
||||||
writerFunc?: string;
|
writerFunc?: string;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ function openElectronJsonLinesFile(filePath, parsed) {
|
|||||||
openNewTab({
|
openNewTab({
|
||||||
title: parsed.name,
|
title: parsed.name,
|
||||||
tooltip: filePath,
|
tooltip: filePath,
|
||||||
icon: 'img sql-file',
|
icon: 'img archive',
|
||||||
tabComponent: 'ArchiveFileTab',
|
tabComponent: 'ArchiveFileTab',
|
||||||
props: {
|
props: {
|
||||||
jslid: `file://${filePath}`,
|
jslid: `file://${filePath}`,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { findFileFormat } from '../plugins/fileformats';
|
|||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
||||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||||
|
import openNewTab from './openNewTab';
|
||||||
|
|
||||||
let uploadListener;
|
let uploadListener;
|
||||||
|
|
||||||
@@ -53,8 +54,21 @@ export default function uploadFiles(files) {
|
|||||||
|
|
||||||
fileData.shortName = file.name;
|
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) {
|
for (const format of ext.fileFormats) {
|
||||||
if (file.name.endsWith('.' + format.extension)) {
|
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.shortName = file.name.slice(0, -format.extension.length - 1);
|
||||||
fileData.storageType = format.storageType;
|
fileData.storageType = format.storageType;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user