mirror of
https://github.com/dbgate/dbgate
synced 2024-11-13 23:33:47 +00:00
removed ImportExportModal
This commit is contained in:
parent
fc6a43b4fe
commit
3357295d98
@ -65,7 +65,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { filterName } from 'dbgate-tools';
|
import { filterName } from 'dbgate-tools';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
|
|
||||||
import { getExtensions } from '../stores';
|
import { getExtensions } from '../stores';
|
||||||
|
@ -374,7 +374,6 @@
|
|||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
|
|
||||||
import _, { find } from 'lodash';
|
import _, { find } from 'lodash';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||||
import { getDefaultFileFormat } from '../plugins/fileformats';
|
import { getDefaultFileFormat } from '../plugins/fileformats';
|
||||||
|
@ -830,7 +830,6 @@
|
|||||||
import { filterName, generateDbPairingId, getAlterDatabaseScript, getConnectionLabel } from 'dbgate-tools';
|
import { filterName, generateDbPairingId, getAlterDatabaseScript, getConnectionLabel } from 'dbgate-tools';
|
||||||
import { getConnectionInfo, getDatabaseInfo } from '../utility/metadataLoaders';
|
import { getConnectionInfo, getDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import fullDisplayName from '../utility/fullDisplayName';
|
import fullDisplayName from '../utility/fullDisplayName';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import { findEngineDriver } from 'dbgate-tools';
|
import { findEngineDriver } from 'dbgate-tools';
|
||||||
import uuidv1 from 'uuid/v1';
|
import uuidv1 from 'uuid/v1';
|
||||||
|
@ -13,7 +13,6 @@ import registerCommand from './registerCommand';
|
|||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
import AboutModal from '../modals/AboutModal.svelte';
|
import AboutModal from '../modals/AboutModal.svelte';
|
||||||
import SettingsModal from '../settings/SettingsModal.svelte';
|
import SettingsModal from '../settings/SettingsModal.svelte';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
import SqlGeneratorModal from '../modals/SqlGeneratorModal.svelte';
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import newQuery, { newDiagram, newPerspective, newQueryDesign } from '../query/newQuery';
|
import newQuery, { newDiagram, newPerspective, newQueryDesign } from '../query/newQuery';
|
||||||
|
@ -122,8 +122,6 @@
|
|||||||
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import { extractShellConnection } from '../impexp/createImpExpScript';
|
import { extractShellConnection } from '../impexp/createImpExpScript';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
|
@ -45,9 +45,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
|
||||||
import { extensions } from '../stores';
|
|
||||||
import { apiCall, apiOff, apiOn } from '../utility/api';
|
import { apiCall, apiOff, apiOn } from '../utility/api';
|
||||||
|
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
@ -58,7 +55,6 @@
|
|||||||
import ChangeSetGrider from './ChangeSetGrider';
|
import ChangeSetGrider from './ChangeSetGrider';
|
||||||
|
|
||||||
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
import LoadingDataGridCore from './LoadingDataGridCore.svelte';
|
||||||
import RowsArrayGrider from './RowsArrayGrider';
|
|
||||||
import { openImportExportTab } from '../utility/importExportTools';
|
import { openImportExportTab } from '../utility/importExportTools';
|
||||||
|
|
||||||
export let jslid;
|
export let jslid;
|
||||||
|
@ -65,13 +65,10 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { getContext } from 'svelte';
|
|
||||||
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
import { registerQuickExportHandler } from '../buttons/ToolStripExportButton.svelte';
|
||||||
|
|
||||||
import registerCommand from '../commands/registerCommand';
|
import registerCommand from '../commands/registerCommand';
|
||||||
import { extractShellConnection } from '../impexp/createImpExpScript';
|
import { extractShellConnection } from '../impexp/createImpExpScript';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
|
||||||
import { apiCall } from '../utility/api';
|
import { apiCall } from '../utility/api';
|
||||||
|
|
||||||
import { registerMenu } from '../utility/contextMenu';
|
import { registerMenu } from '../utility/contextMenu';
|
||||||
|
@ -1,203 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import moment from 'moment';
|
|
||||||
import { writable } from 'svelte/store';
|
|
||||||
import HorizontalSplitter from '../elements/HorizontalSplitter.svelte';
|
|
||||||
import LargeButton from '../buttons/LargeButton.svelte';
|
|
||||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
|
||||||
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
|
||||||
|
|
||||||
import FormProvider from '../forms/FormProvider.svelte';
|
|
||||||
import FormTextField from '../forms/FormTextField.svelte';
|
|
||||||
import LargeFormButton from '../forms/LargeFormButton.svelte';
|
|
||||||
import FontIcon from '../icons/FontIcon.svelte';
|
|
||||||
import createImpExpScript from '../impexp/createImpExpScript';
|
|
||||||
import ImportExportConfigurator from '../impexp/ImportExportConfigurator.svelte';
|
|
||||||
import PreviewDataGrid from '../impexp/PreviewDataGrid.svelte';
|
|
||||||
import { getDefaultFileFormat } from '../plugins/fileformats';
|
|
||||||
import RunnerOutputFiles from '../query/RunnerOutputFiles.svelte';
|
|
||||||
import SocketMessageView from '../query/SocketMessageView.svelte';
|
|
||||||
import { currentArchive, currentDatabase, extensions, visibleWidgetSideBar, selectedWidget } from '../stores';
|
|
||||||
import { apiCall, apiOff, apiOn } from '../utility/api';
|
|
||||||
import createRef from '../utility/createRef';
|
|
||||||
import openNewTab from '../utility/openNewTab';
|
|
||||||
import useEffect from '../utility/useEffect';
|
|
||||||
import WidgetColumnBar from '../widgets/WidgetColumnBar.svelte';
|
|
||||||
import WidgetColumnBarItem from '../widgets/WidgetColumnBarItem.svelte';
|
|
||||||
import ModalBase from './ModalBase.svelte';
|
|
||||||
import { closeCurrentModal } from './modalTools';
|
|
||||||
|
|
||||||
let busy = false;
|
|
||||||
let executeNumber = 0;
|
|
||||||
let runnerId = null;
|
|
||||||
|
|
||||||
const previewReaderStore = writable(null);
|
|
||||||
|
|
||||||
export let initialValues;
|
|
||||||
export let uploadedFile = undefined;
|
|
||||||
export let openedFile = undefined;
|
|
||||||
export let importToCurrentTarget = false;
|
|
||||||
|
|
||||||
const refreshArchiveFolderRef = createRef(null);
|
|
||||||
|
|
||||||
function detectCurrentTarget() {
|
|
||||||
if (!importToCurrentTarget) return {};
|
|
||||||
|
|
||||||
if ($currentDatabase && $selectedWidget != 'archive') {
|
|
||||||
return {
|
|
||||||
targetStorageType: 'database',
|
|
||||||
targetConnectionId: $currentDatabase?.connection?._id,
|
|
||||||
targetDatabaseName: $currentDatabase?.name,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($currentArchive == 'default') {
|
|
||||||
return {
|
|
||||||
targetStorageType: 'archive',
|
|
||||||
targetArchiveFolder: `import-${moment().format('YYYY-MM-DD-hh-mm-ss')}`,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return {
|
|
||||||
targetStorageType: 'archive',
|
|
||||||
targetArchiveFolder: $currentArchive,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: effect = useEffect(() => registerRunnerDone(runnerId));
|
|
||||||
|
|
||||||
function registerRunnerDone(rid) {
|
|
||||||
if (rid) {
|
|
||||||
apiOn(`runner-done-${rid}`, handleRunnerDone);
|
|
||||||
return () => {
|
|
||||||
apiOff(`runner-done-${rid}`, handleRunnerDone);
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return () => {};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$: $effect;
|
|
||||||
|
|
||||||
const handleRunnerDone = () => {
|
|
||||||
busy = false;
|
|
||||||
if (refreshArchiveFolderRef.get()) {
|
|
||||||
apiCall('archive/refresh-folders', {});
|
|
||||||
apiCall('archive/refresh-files', { folder: refreshArchiveFolderRef.get() });
|
|
||||||
$currentArchive = refreshArchiveFolderRef.get();
|
|
||||||
$selectedWidget = 'archive';
|
|
||||||
$visibleWidgetSideBar = true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleGenerateScript = async e => {
|
|
||||||
closeCurrentModal();
|
|
||||||
const code = await createImpExpScript($extensions, e.detail, undefined, true);
|
|
||||||
openNewTab(
|
|
||||||
{
|
|
||||||
title: 'Shell #',
|
|
||||||
icon: 'img shell',
|
|
||||||
tabComponent: 'ShellTab',
|
|
||||||
},
|
|
||||||
{ editor: code }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleExecute = async e => {
|
|
||||||
if (busy) return;
|
|
||||||
const values = e.detail;
|
|
||||||
busy = true;
|
|
||||||
const script = await createImpExpScript($extensions, values);
|
|
||||||
executeNumber += 1;
|
|
||||||
let runid = runnerId;
|
|
||||||
const resp = await apiCall('runners/start', { script });
|
|
||||||
runid = resp.runid;
|
|
||||||
runnerId = runid;
|
|
||||||
|
|
||||||
if (values.targetStorageType == 'archive') {
|
|
||||||
refreshArchiveFolderRef.set(values.targetArchiveFolder);
|
|
||||||
} else {
|
|
||||||
refreshArchiveFolderRef.set(null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCancel = () => {
|
|
||||||
apiCall('runners/cancel', {
|
|
||||||
runid: runnerId,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<FormProvider
|
|
||||||
initialValues={{
|
|
||||||
sourceStorageType: 'database',
|
|
||||||
targetStorageType: getDefaultFileFormat($extensions).storageType,
|
|
||||||
targetArchiveFolder: $currentArchive,
|
|
||||||
sourceArchiveFolder: $currentArchive,
|
|
||||||
...detectCurrentTarget(),
|
|
||||||
...initialValues,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ModalBase {...$$restProps} fullScreen>
|
|
||||||
<svelte:fragment slot="header">
|
|
||||||
Import/Export
|
|
||||||
{#if busy}
|
|
||||||
<FontIcon icon="icon loading" />
|
|
||||||
{/if}
|
|
||||||
</svelte:fragment>
|
|
||||||
|
|
||||||
<HorizontalSplitter initialValue="70%">
|
|
||||||
<div class="content" slot="1">
|
|
||||||
<ImportExportConfigurator {uploadedFile} {openedFile} {previewReaderStore} />
|
|
||||||
|
|
||||||
{#if busy}
|
|
||||||
<LoadingInfo wrapper message="Processing import/export ..." />
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<svelte:fragment slot="2">
|
|
||||||
<WidgetColumnBar>
|
|
||||||
<WidgetColumnBarItem title="Output files" name="output" height="20%">
|
|
||||||
<RunnerOutputFiles {runnerId} {executeNumber} />
|
|
||||||
</WidgetColumnBarItem>
|
|
||||||
<WidgetColumnBarItem title="Messages" name="messages">
|
|
||||||
<SocketMessageView
|
|
||||||
eventName={runnerId ? `runner-info-${runnerId}` : null}
|
|
||||||
{executeNumber}
|
|
||||||
showNoMessagesAlert
|
|
||||||
/>
|
|
||||||
</WidgetColumnBarItem>
|
|
||||||
<WidgetColumnBarItem title="Preview" name="preview" skip={!$previewReaderStore}>
|
|
||||||
<PreviewDataGrid reader={$previewReaderStore} />
|
|
||||||
</WidgetColumnBarItem>
|
|
||||||
<WidgetColumnBarItem title="Advanced configuration" name="config" collapsed>
|
|
||||||
<FormTextField label="Schedule" name="schedule" />
|
|
||||||
<FormTextField label="Start variable index" name="startVariableIndex" />
|
|
||||||
</WidgetColumnBarItem>
|
|
||||||
</WidgetColumnBar>
|
|
||||||
</svelte:fragment>
|
|
||||||
</HorizontalSplitter>
|
|
||||||
|
|
||||||
<svelte:fragment slot="footer">
|
|
||||||
<div class="flex m-2">
|
|
||||||
{#if busy}
|
|
||||||
<LargeButton icon="icon stop" on:click={handleCancel}>Stop</LargeButton>
|
|
||||||
{:else}
|
|
||||||
<LargeFormButton on:click={handleExecute} icon="icon run">Run</LargeFormButton>
|
|
||||||
{/if}
|
|
||||||
<LargeFormButton icon="img sql-file" on:click={handleGenerateScript}>Generate script</LargeFormButton>
|
|
||||||
|
|
||||||
<LargeButton on:click={closeCurrentModal} icon="icon close">Close</LargeButton>
|
|
||||||
</div>
|
|
||||||
</svelte:fragment>
|
|
||||||
</ModalBase>
|
|
||||||
</FormProvider>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.content {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
overflow-y: auto;
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -47,8 +47,6 @@
|
|||||||
import { registerFileCommands } from '../commands/stdCommands';
|
import { registerFileCommands } from '../commands/stdCommands';
|
||||||
|
|
||||||
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
import VerticalSplitter from '../elements/VerticalSplitter.svelte';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import { showModal } from '../modals/modalTools';
|
|
||||||
import AceEditor from '../query/AceEditor.svelte';
|
import AceEditor from '../query/AceEditor.svelte';
|
||||||
import RunnerOutputPane from '../query/RunnerOutputPane.svelte';
|
import RunnerOutputPane from '../query/RunnerOutputPane.svelte';
|
||||||
import useEditorData from '../query/useEditorData';
|
import useEditorData from '../query/useEditorData';
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import { get } from 'svelte/store';
|
import { get } from 'svelte/store';
|
||||||
import newQuery from '../query/newQuery';
|
import newQuery from '../query/newQuery';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import getElectron from './getElectron';
|
import getElectron from './getElectron';
|
||||||
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
import { currentDatabase, extensions, getCurrentDatabase } from '../stores';
|
||||||
import { getUploadListener } from './uploadFiles';
|
import { getUploadListener } from './uploadFiles';
|
||||||
|
@ -5,7 +5,6 @@ import getElectron from './getElectron';
|
|||||||
import resolveApi, { resolveApiHeaders } from './resolveApi';
|
import resolveApi, { resolveApiHeaders } from './resolveApi';
|
||||||
import { findFileFormat } from '../plugins/fileformats';
|
import { findFileFormat } from '../plugins/fileformats';
|
||||||
import { showModal } from '../modals/modalTools';
|
import { showModal } from '../modals/modalTools';
|
||||||
import ImportExportModal from '../modals/ImportExportModal.svelte';
|
|
||||||
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
import ErrorMessageModal from '../modals/ErrorMessageModal.svelte';
|
||||||
import openNewTab from './openNewTab';
|
import openNewTab from './openNewTab';
|
||||||
import { openImportExportTab } from './importExportTools';
|
import { openImportExportTab } from './importExportTools';
|
||||||
|
Loading…
Reference in New Issue
Block a user