mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
excel import fix
This commit is contained in:
parent
c7aaf06506
commit
36c792f44e
@ -22,7 +22,7 @@
|
|||||||
for (const file of getAsArray(files)) {
|
for (const file of getAsArray(files)) {
|
||||||
const format = findFileFormat(extensions, storage);
|
const format = findFileFormat(extensions, storage);
|
||||||
if (format) {
|
if (format) {
|
||||||
await (format.addFileToSourceList || addFileToSourceListDefault)(file, newSources, newValues);
|
await (format.addFileToSourceList || addFileToSourceListDefault)(file, newSources, newValues, apiCall);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newValues['sourceList'] = [...(values.sourceList || []).filter(x => !newSources.includes(x)), ...newSources];
|
newValues['sourceList'] = [...(values.sourceList || []).filter(x => !newSources.includes(x)), ...newSources];
|
||||||
@ -58,6 +58,7 @@
|
|||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import { findFileFormat } from '../plugins/fileformats';
|
import { findFileFormat } from '../plugins/fileformats';
|
||||||
import { extensions } from '../stores';
|
import { extensions } from '../stores';
|
||||||
|
import { apiCall } from '../utility/api';
|
||||||
import getAsArray from '../utility/getAsArray';
|
import getAsArray from '../utility/getAsArray';
|
||||||
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useConnectionInfo, useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import { setUploadListener } from '../utility/uploadFiles';
|
import { setUploadListener } from '../utility/uploadFiles';
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
<script lang="ts" context="module">
|
<script lang="ts" context="module">
|
||||||
const dbgateEnv = {
|
|
||||||
apiCall,
|
|
||||||
};
|
|
||||||
|
|
||||||
async function loadPlugins(pluginsDict, installedPlugins) {
|
async function loadPlugins(pluginsDict, installedPlugins) {
|
||||||
window['DBGATE_TOOLS'] = dbgateTools;
|
window['DBGATE_TOOLS'] = dbgateTools;
|
||||||
|
|
||||||
@ -20,7 +16,6 @@
|
|||||||
const module = eval(`${resp}; plugin`);
|
const module = eval(`${resp}; plugin`);
|
||||||
console.log('Loaded plugin', module);
|
console.log('Loaded plugin', module);
|
||||||
const moduleContent = module.__esModule ? module.default : module;
|
const moduleContent = module.__esModule ? module.default : module;
|
||||||
if (moduleContent.initialize) moduleContent.initialize(dbgateEnv);
|
|
||||||
newPlugins[installed.name] = moduleContent;
|
newPlugins[installed.name] = moduleContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
let dbgateEnv;
|
|
||||||
|
|
||||||
function initialize(dbgateEnv) {
|
|
||||||
dbgateEnv = dbgateEnv;
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileFormat = {
|
const fileFormat = {
|
||||||
packageName: 'dbgate-plugin-excel',
|
packageName: 'dbgate-plugin-excel',
|
||||||
// file format identifier
|
// file format identifier
|
||||||
@ -17,8 +11,8 @@ const fileFormat = {
|
|||||||
// function name from backend, which contains writer factory, postfixed by package name
|
// function name from backend, which contains writer factory, postfixed by package name
|
||||||
writerFunc: 'writer@dbgate-plugin-excel',
|
writerFunc: 'writer@dbgate-plugin-excel',
|
||||||
|
|
||||||
addFileToSourceList: async ({ fileName }, newSources, newValues) => {
|
addFileToSourceList: async ({ fileName }, newSources, newValues, apiCall) => {
|
||||||
const resp = await dbgateEnv.apiCall('plugins/command', {
|
const resp = await apiCall('plugins/command', {
|
||||||
command: 'analyse',
|
command: 'analyse',
|
||||||
packageName: 'dbgate-plugin-excel',
|
packageName: 'dbgate-plugin-excel',
|
||||||
args: {
|
args: {
|
||||||
@ -85,5 +79,4 @@ export default {
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
initialize,
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user