mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 10:46:00 +00:00
shwll connection fixes
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
import { apiCall } from '../utility/api';
|
||||
import hasPermission from '../utility/hasPermission';
|
||||
import { isProApp } from '../utility/proTools';
|
||||
import { extractShellConnection } from '../impexp/createImpExpScript';
|
||||
|
||||
export let data;
|
||||
|
||||
@@ -66,10 +67,7 @@
|
||||
|
||||
await dbgateApi.deployDb(${JSON.stringify(
|
||||
{
|
||||
connection: {
|
||||
..._.omit($currentDatabase.connection, '_id', 'displayName'),
|
||||
database: $currentDatabase.name,
|
||||
},
|
||||
connection: extractShellConnection($currentDatabase.connection, $currentDatabase.name),
|
||||
modelFolder: `archive:${data.name}`,
|
||||
},
|
||||
undefined,
|
||||
|
||||
@@ -297,10 +297,7 @@
|
||||
|
||||
await dbgateApi.dropAllDbObjects(${JSON.stringify(
|
||||
{
|
||||
connection: {
|
||||
..._.omit(connection, '_id', 'displayName'),
|
||||
database: name,
|
||||
},
|
||||
connection: extractShellConnection(connection, name),
|
||||
},
|
||||
undefined,
|
||||
2
|
||||
@@ -484,6 +481,7 @@ await dbgateApi.dropAllDbObjects(${JSON.stringify(
|
||||
import { isProApp } from '../utility/proTools';
|
||||
import ExportDbModelModal from '../modals/ExportDbModelModal.svelte';
|
||||
import ChooseArchiveFolderModal from '../modals/ChooseArchiveFolderModal.svelte';
|
||||
import { extractShellConnection } from '../impexp/createImpExpScript';
|
||||
|
||||
export let data;
|
||||
export let passProps;
|
||||
|
||||
@@ -39,7 +39,10 @@ export function extractShellConnection(connection, database) {
|
||||
|
||||
return config.allowShellConnection
|
||||
? {
|
||||
..._.omit(connection, ['_id', 'displayName', 'databases', 'connectionColor']),
|
||||
..._.omitBy(
|
||||
_.omit(connection, ['_id', 'displayName', 'databases', 'connectionColor', 'status', 'unsaved']),
|
||||
v => !v
|
||||
),
|
||||
database,
|
||||
}
|
||||
: {
|
||||
@@ -192,7 +195,7 @@ export function normalizeExportColumnMap(colmap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default async function createImpExpScript(extensions, values, forceScript = false) {
|
||||
export default async function createImpExpScript(extensions, values, forceScript = false) {
|
||||
const config = getCurrentConfig();
|
||||
const script =
|
||||
config.allowShellScripting || forceScript
|
||||
|
||||
@@ -22,6 +22,16 @@
|
||||
testEnabled: () => getCurrentEditor()?.canKill(),
|
||||
onClick: () => getCurrentEditor().kill(),
|
||||
});
|
||||
registerCommand({
|
||||
id: 'dataDuplicator.generateScript',
|
||||
category: 'Data duplicator',
|
||||
icon: 'img shell',
|
||||
name: 'Generate Script',
|
||||
toolbar: true,
|
||||
isRelatedToTab: true,
|
||||
testEnabled: () => getCurrentEditor()?.canRun(),
|
||||
onClick: () => getCurrentEditor().generateScript(),
|
||||
});
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
@@ -52,7 +62,6 @@
|
||||
import useEffect from '../utility/useEffect';
|
||||
import useTimerLabel from '../utility/useTimerLabel';
|
||||
import appObjectTypes from '../appobj';
|
||||
import RowHeaderCell from '../datagrid/RowHeaderCell.svelte';
|
||||
|
||||
export let conid;
|
||||
export let database;
|
||||
@@ -146,6 +155,18 @@
|
||||
timerLabel.start();
|
||||
}
|
||||
|
||||
export async function generateScript() {
|
||||
const code = await createScript();
|
||||
openNewTab(
|
||||
{
|
||||
title: 'Shell #',
|
||||
icon: 'img shell',
|
||||
tabComponent: 'ShellTab',
|
||||
},
|
||||
{ editor: code }
|
||||
);
|
||||
}
|
||||
|
||||
$: effect = useEffect(() => registerRunnerDone(runnerId));
|
||||
|
||||
function registerRunnerDone(rid) {
|
||||
@@ -422,6 +443,7 @@
|
||||
<svelte:fragment slot="toolstrip">
|
||||
<ToolStripCommandButton command="dataDuplicator.run" />
|
||||
<ToolStripCommandButton command="dataDuplicator.kill" />
|
||||
<ToolStripCommandButton command="dataDuplicator.generateScript" />
|
||||
</svelte:fragment>
|
||||
</ToolStripContainer>
|
||||
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
{:else}
|
||||
<ToolStripButton on:click={handleExecute} icon="icon run">Run</ToolStripButton>
|
||||
{/if}
|
||||
<ToolStripButton icon="img sql-file" on:click={handleGenerateScript}>Generate script</ToolStripButton>
|
||||
<ToolStripButton icon="img shell" on:click={handleGenerateScript}>Generate script</ToolStripButton>
|
||||
<ToolStripSaveButton idPrefix="job" />
|
||||
</svelte:fragment>
|
||||
</ToolStripContainer>
|
||||
|
||||
Reference in New Issue
Block a user