mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 11:06:02 +00:00
removed MS excel support, moved to plugin
This commit is contained in:
@@ -1,53 +1,3 @@
|
||||
import { usePlugins } from '../plugins/PluginsProvider';
|
||||
import axios from './axios';
|
||||
import { FormSchemaSelect } from './forms';
|
||||
|
||||
const excelFormat = {
|
||||
storageType: 'excel',
|
||||
extension: 'xlsx',
|
||||
name: 'MS Excel',
|
||||
readerFunc: 'excelSheetReader',
|
||||
writerFunc: 'excelSheetWriter',
|
||||
|
||||
addFilesToSourceList: async (file, newSources, newValues) => {
|
||||
const resp = await axios.get(`files/analyse-excel?filePath=${encodeURIComponent(file.full)}`);
|
||||
const sheetNames = resp.data;
|
||||
for (const sheetName of sheetNames) {
|
||||
newSources.push(sheetName);
|
||||
newValues[`sourceFile_${sheetName}`] = {
|
||||
fileName: file.full,
|
||||
sheetName,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
args: [
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'singleFile',
|
||||
label: 'Create single file',
|
||||
direction: 'target',
|
||||
},
|
||||
],
|
||||
|
||||
getDefaultOutputName: (sourceName, values) => {
|
||||
if (values.target_excel_singleFile) {
|
||||
return sourceName;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getOutputParams: (sourceName, values) => {
|
||||
if (values.target_excel_singleFile) {
|
||||
return {
|
||||
sheetName: values[`targetName_${sourceName}`] || sourceName,
|
||||
fileName: 'data.xlsx',
|
||||
};
|
||||
}
|
||||
return null;
|
||||
},
|
||||
};
|
||||
|
||||
const jsonlFormat = {
|
||||
storageType: 'jsonl',
|
||||
extension: 'jsonl',
|
||||
@@ -58,7 +8,7 @@ const jsonlFormat = {
|
||||
|
||||
/** @returns {import('dbgate-types').FileFormatDefinition[]} */
|
||||
export function buildFileFormats(plugins) {
|
||||
const res = [excelFormat, jsonlFormat];
|
||||
const res = [ jsonlFormat];
|
||||
for (const { content } of plugins) {
|
||||
const { fileFormats } = content;
|
||||
if (fileFormats) res.push(...fileFormats);
|
||||
|
||||
Reference in New Issue
Block a user