import sql dump

This commit is contained in:
Jan Prochazka 2022-04-18 19:59:19 +02:00
parent 2c25669bc7
commit ed0d63d135
3 changed files with 15 additions and 7 deletions

View File

@ -29,6 +29,7 @@
import { getDatabaseList, useUsedApps } from '../utility/metadataLoaders';
import { getLocalStorage } from '../utility/storageCache';
import { apiCall } from '../utility/api';
import ImportDatabaseDumpModal from '../modals/ImportDatabaseDumpModal.svelte';
export let data;
export let passProps;
@ -58,6 +59,12 @@
}
};
const handleSqlRestore = () => {
showModal(ImportDatabaseDumpModal, {
connection: data,
});
};
const getContextMenu = () => {
const driver = $extensions.drivers.find(x => x.engine == data.engine);
const config = getCurrentConfig();
@ -158,6 +165,8 @@
{ divider: true },
getDatabaseMenuItems(data, data.defaultDatabase, $extensions, $currentDatabase, $apps),
],
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleSqlRestore, text: 'Restore/import SQL dump' },
];
};

View File

@ -9,7 +9,7 @@
export let onConfirm;
const handleSubmit = async e => {
const handleSubmit = e => {
onConfirm(e.detail.url);
closeCurrentModal();
};

View File

@ -1,13 +1,11 @@
<script lang="ts">
import { onMount } from 'svelte';
import { onMount, tick } from 'svelte';
import FormStyledButton from '../buttons/FormStyledButton.svelte';
import UploadButton from '../buttons/UploadButton.svelte';
import FormProvider from '../forms/FormProvider.svelte';
import FormSubmit from '../forms/FormSubmit.svelte';
import FormTextField from '../forms/FormTextField.svelte';
import ElectronFilesInput from '../impexp/ElectronFilesInput.svelte';
import { importSqlDump } from '../utility/exportFileTools';
import getElectron from '../utility/getElectron';
import { setUploadListener } from '../utility/uploadFiles';
@ -23,7 +21,6 @@
const handleSubmit = async values => {
const { value } = values;
closeCurrentModal();
// onConfirm(value);
importSqlDump(inputFile, connection);
};
@ -42,13 +39,15 @@
};
});
const handleAddUrl = () =>
const handleAddUrl = () => {
showModal(ChangeDownloadUrlModal, {
onConfirm: url => {
onConfirm: async url => {
await tick();
inputLabel = url;
inputFile = url;
},
});
};
const handleBrowse = async () => {
const electron = getElectron();