mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 21:33:58 +00:00
import export tab working
This commit is contained in:
@@ -764,31 +764,31 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
// openNewTab(
|
openNewTab(
|
||||||
// {
|
{
|
||||||
// tabComponent: 'ImportExportTab',
|
tabComponent: 'ImportExportTab',
|
||||||
// title: 'Import/Export',
|
title: 'Import/Export',
|
||||||
// icon: 'img export',
|
icon: 'img export',
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// editor: {
|
|
||||||
// sourceStorageType: 'database',
|
|
||||||
// sourceConnectionId: data.conid,
|
|
||||||
// sourceDatabaseName: data.database,
|
|
||||||
// sourceSchemaName: data.schemaName,
|
|
||||||
// sourceList: [data.pureName],
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
showModal(ImportExportModal, {
|
|
||||||
initialValues: {
|
|
||||||
sourceStorageType: 'database',
|
|
||||||
sourceConnectionId: data.conid,
|
|
||||||
sourceDatabaseName: data.database,
|
|
||||||
sourceSchemaName: data.schemaName,
|
|
||||||
sourceList: [data.pureName],
|
|
||||||
},
|
},
|
||||||
});
|
{
|
||||||
|
editor: {
|
||||||
|
sourceStorageType: 'database',
|
||||||
|
sourceConnectionId: data.conid,
|
||||||
|
sourceDatabaseName: data.database,
|
||||||
|
sourceSchemaName: data.schemaName,
|
||||||
|
sourceList: [data.pureName],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
// showModal(ImportExportModal, {
|
||||||
|
// initialValues: {
|
||||||
|
// sourceStorageType: 'database',
|
||||||
|
// sourceConnectionId: data.conid,
|
||||||
|
// sourceDatabaseName: data.database,
|
||||||
|
// sourceSchemaName: data.schemaName,
|
||||||
|
// sourceList: [data.pureName],
|
||||||
|
// },
|
||||||
|
// });
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
import WidgetColumnBar from '../widgets/WidgetColumnBar.svelte';
|
import WidgetColumnBar from '../widgets/WidgetColumnBar.svelte';
|
||||||
import WidgetColumnBarItem from '../widgets/WidgetColumnBarItem.svelte';
|
import WidgetColumnBarItem from '../widgets/WidgetColumnBarItem.svelte';
|
||||||
import useEditorData from '../query/useEditorData';
|
import useEditorData from '../query/useEditorData';
|
||||||
|
import ToolStripContainer from '../buttons/ToolStripContainer.svelte';
|
||||||
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
|
import FormProviderCore from '../forms/FormProviderCore.svelte';
|
||||||
|
|
||||||
let busy = false;
|
let busy = false;
|
||||||
let executeNumber = 0;
|
let executeNumber = 0;
|
||||||
@@ -39,10 +42,24 @@
|
|||||||
|
|
||||||
const refreshArchiveFolderRef = createRef(null);
|
const refreshArchiveFolderRef = createRef(null);
|
||||||
|
|
||||||
|
const formValues = writable({
|
||||||
|
sourceStorageType: 'database',
|
||||||
|
targetStorageType: getDefaultFileFormat($extensions).storageType,
|
||||||
|
targetArchiveFolder: $currentArchive,
|
||||||
|
sourceArchiveFolder: $currentArchive,
|
||||||
|
...detectCurrentTarget(),
|
||||||
|
...initialValues,
|
||||||
|
});
|
||||||
|
|
||||||
const { editorState, editorValue, setEditorData } = useEditorData({
|
const { editorState, editorValue, setEditorData } = useEditorData({
|
||||||
tabid,
|
tabid,
|
||||||
|
onInitialData: value => {
|
||||||
|
$formValues = value;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$: setEditorData($formValues);
|
||||||
|
|
||||||
function detectCurrentTarget() {
|
function detectCurrentTarget() {
|
||||||
if (!importToCurrentTarget) return {};
|
if (!importToCurrentTarget) return {};
|
||||||
|
|
||||||
@@ -94,7 +111,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleGenerateScript = async e => {
|
const handleGenerateScript = async e => {
|
||||||
const code = await createImpExpScript($extensions, e.detail, undefined, true);
|
const values = $formValues;
|
||||||
|
const code = await createImpExpScript($extensions, values, undefined, true);
|
||||||
openNewTab(
|
openNewTab(
|
||||||
{
|
{
|
||||||
title: 'Shell #',
|
title: 'Shell #',
|
||||||
@@ -107,7 +125,7 @@
|
|||||||
|
|
||||||
const handleExecute = async e => {
|
const handleExecute = async e => {
|
||||||
if (busy) return;
|
if (busy) return;
|
||||||
const values = e.detail;
|
const values = $formValues;
|
||||||
busy = true;
|
busy = true;
|
||||||
const script = await createImpExpScript($extensions, values);
|
const script = await createImpExpScript($extensions, values);
|
||||||
executeNumber += 1;
|
executeNumber += 1;
|
||||||
@@ -130,49 +148,41 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<FormProvider
|
<ToolStripContainer>
|
||||||
initialValues={{
|
<FormProviderCore values={formValues}>
|
||||||
sourceStorageType: 'database',
|
<HorizontalSplitter initialValue="70%">
|
||||||
targetStorageType: getDefaultFileFormat($extensions).storageType,
|
<div class="content" slot="1">
|
||||||
targetArchiveFolder: $currentArchive,
|
<ImportExportConfigurator {uploadedFile} {openedFile} {previewReaderStore} />
|
||||||
sourceArchiveFolder: $currentArchive,
|
|
||||||
...detectCurrentTarget(),
|
|
||||||
...initialValues,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<HorizontalSplitter initialValue="70%">
|
|
||||||
<div class="content" slot="1">
|
|
||||||
<ImportExportConfigurator {uploadedFile} {openedFile} {previewReaderStore} />
|
|
||||||
|
|
||||||
{#if busy}
|
{#if busy}
|
||||||
<LoadingInfo wrapper message="Processing import/export ..." />
|
<LoadingInfo wrapper message="Processing import/export ..." />
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<svelte:fragment slot="2">
|
<svelte:fragment slot="2">
|
||||||
<WidgetColumnBar>
|
<WidgetColumnBar>
|
||||||
<WidgetColumnBarItem title="Output files" name="output" height="20%">
|
<WidgetColumnBarItem title="Output files" name="output" height="20%">
|
||||||
<RunnerOutputFiles {runnerId} {executeNumber} />
|
<RunnerOutputFiles {runnerId} {executeNumber} />
|
||||||
</WidgetColumnBarItem>
|
</WidgetColumnBarItem>
|
||||||
<WidgetColumnBarItem title="Messages" name="messages">
|
<WidgetColumnBarItem title="Messages" name="messages">
|
||||||
<SocketMessageView
|
<SocketMessageView
|
||||||
eventName={runnerId ? `runner-info-${runnerId}` : null}
|
eventName={runnerId ? `runner-info-${runnerId}` : null}
|
||||||
{executeNumber}
|
{executeNumber}
|
||||||
showNoMessagesAlert
|
showNoMessagesAlert
|
||||||
/>
|
/>
|
||||||
</WidgetColumnBarItem>
|
</WidgetColumnBarItem>
|
||||||
<WidgetColumnBarItem title="Preview" name="preview" skip={!$previewReaderStore}>
|
<WidgetColumnBarItem title="Preview" name="preview" skip={!$previewReaderStore}>
|
||||||
<PreviewDataGrid reader={$previewReaderStore} />
|
<PreviewDataGrid reader={$previewReaderStore} />
|
||||||
</WidgetColumnBarItem>
|
</WidgetColumnBarItem>
|
||||||
<WidgetColumnBarItem title="Advanced configuration" name="config" collapsed>
|
<WidgetColumnBarItem title="Advanced configuration" name="config" collapsed>
|
||||||
<FormTextField label="Schedule" name="schedule" />
|
<FormTextField label="Schedule" name="schedule" />
|
||||||
<FormTextField label="Start variable index" name="startVariableIndex" />
|
<FormTextField label="Start variable index" name="startVariableIndex" />
|
||||||
</WidgetColumnBarItem>
|
</WidgetColumnBarItem>
|
||||||
</WidgetColumnBar>
|
</WidgetColumnBar>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</HorizontalSplitter>
|
</HorizontalSplitter>
|
||||||
|
|
||||||
<!-- <svelte:fragment slot="footer">
|
<!-- <svelte:fragment slot="footer">
|
||||||
<div class="flex m-2">
|
<div class="flex m-2">
|
||||||
{#if busy}
|
{#if busy}
|
||||||
<LargeButton icon="icon stop" on:click={handleCancel}>Stop</LargeButton>
|
<LargeButton icon="icon stop" on:click={handleCancel}>Stop</LargeButton>
|
||||||
@@ -184,7 +194,16 @@
|
|||||||
<LargeButton on:click={closeCurrentModal} icon="icon close">Close</LargeButton>
|
<LargeButton on:click={closeCurrentModal} icon="icon close">Close</LargeButton>
|
||||||
</div>
|
</div>
|
||||||
</svelte:fragment> -->
|
</svelte:fragment> -->
|
||||||
</FormProvider>
|
</FormProviderCore>
|
||||||
|
<svelte:fragment slot="toolstrip">
|
||||||
|
{#if busy}
|
||||||
|
<ToolStripButton icon="icon stop" on:click={handleCancel}>Stop</ToolStripButton>
|
||||||
|
{:else}
|
||||||
|
<ToolStripButton on:click={handleExecute} icon="icon run">Run</ToolStripButton>
|
||||||
|
{/if}
|
||||||
|
<ToolStripButton icon="img sql-file" on:click={handleGenerateScript}>Generate script</ToolStripButton>
|
||||||
|
</svelte:fragment>
|
||||||
|
</ToolStripContainer>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.content {
|
.content {
|
||||||
@@ -193,5 +212,6 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
background-color: var(--theme-bg-0);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user