mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 19:03:58 +00:00
table & view preview mode switch
This commit is contained in:
@@ -29,6 +29,9 @@
|
|||||||
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
import ToolStripCommandButton from '../buttons/ToolStripCommandButton.svelte';
|
||||||
import SelectField from '../forms/SelectField.svelte';
|
import SelectField from '../forms/SelectField.svelte';
|
||||||
import { changeTab } from '../utility/common';
|
import { changeTab } from '../utility/common';
|
||||||
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
import { template } from 'lodash';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let appObjectData;
|
export let appObjectData;
|
||||||
@@ -109,5 +112,67 @@
|
|||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
{#if objectTypeField == 'tables' || objectTypeField == 'views' || objectTypeField == 'matviews'}
|
||||||
|
<ToolStripButton
|
||||||
|
icon="icon structure"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: 'img table-structure',
|
||||||
|
tabComponent: 'TableStructureTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField,
|
||||||
|
defaultActionId: 'openStructure',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>Open structure</ToolStripButton
|
||||||
|
>
|
||||||
|
<ToolStripButton
|
||||||
|
icon="icon table"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
||||||
|
tabComponent: objectTypeField == 'tables' ? 'TableDataTab' : 'ViewDataTab',
|
||||||
|
objectTypeField,
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField,
|
||||||
|
defaultActionId: 'openTable',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>Open data</ToolStripButton
|
||||||
|
>
|
||||||
|
{/if}
|
||||||
|
{#each getSupportedScriptTemplates(appObjectData.objectTypeField) as template}
|
||||||
|
<ToolStripButton
|
||||||
|
icon="img sql-file"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: 'Query #',
|
||||||
|
icon: 'img sql-file',
|
||||||
|
tabComponent: 'QueryTab',
|
||||||
|
objectTypeField: appObjectData.objectTypeField,
|
||||||
|
props: {
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
objectTypeField,
|
||||||
|
initialArgs: { scriptTemplate: template.scriptTemplate },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>{template.label}</ToolStripButton
|
||||||
|
>
|
||||||
|
{/each}
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ToolStripContainer>
|
</ToolStripContainer>
|
||||||
|
|||||||
@@ -298,17 +298,39 @@
|
|||||||
title: pureName,
|
title: pureName,
|
||||||
icon: 'img table-structure',
|
icon: 'img table-structure',
|
||||||
tabComponent: 'TableStructureTab',
|
tabComponent: 'TableStructureTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
props: {
|
props: {
|
||||||
schemaName,
|
schemaName,
|
||||||
pureName,
|
pureName,
|
||||||
conid,
|
conid,
|
||||||
database,
|
database,
|
||||||
objectTypeField: 'tables',
|
objectTypeField: 'tables',
|
||||||
|
defaultActionId: 'openStructure',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}>Open structure</ToolStripButton
|
}}>Open structure</ToolStripButton
|
||||||
>
|
>
|
||||||
|
|
||||||
|
<ToolStripButton
|
||||||
|
icon="img sql-file"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: 'img sql-file',
|
||||||
|
tabComponent: 'SqlObjectTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField: 'tables',
|
||||||
|
defaultActionId: 'showSql',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>Table SQL</ToolStripButton
|
||||||
|
>
|
||||||
|
|
||||||
<ToolStripButton
|
<ToolStripButton
|
||||||
icon={$collapsedLeftColumnStore ? 'icon columns-outline' : 'icon columns'}
|
icon={$collapsedLeftColumnStore ? 'icon columns-outline' : 'icon columns'}
|
||||||
on:click={() => collapsedLeftColumnStore.update(x => !x)}>View columns</ToolStripButton
|
on:click={() => collapsedLeftColumnStore.update(x => !x)}>View columns</ToolStripButton
|
||||||
|
|||||||
@@ -175,24 +175,43 @@
|
|||||||
<ToolStripCommandButton command="tableEditor.addColumn" />
|
<ToolStripCommandButton command="tableEditor.addColumn" />
|
||||||
<ToolStripCommandButton command="tableEditor.addIndex" hideDisabled />
|
<ToolStripCommandButton command="tableEditor.addIndex" hideDisabled />
|
||||||
|
|
||||||
{#if objectTypeField == 'tables'}
|
<ToolStripButton
|
||||||
<ToolStripButton
|
icon={'icon table'}
|
||||||
icon="icon table"
|
on:click={() => {
|
||||||
on:click={() => {
|
openNewTab({
|
||||||
openNewTab({
|
title: pureName,
|
||||||
title: pureName,
|
icon: objectTypeField == 'tables' ? 'img table' : 'img view',
|
||||||
icon: 'img table',
|
tabComponent: objectTypeField == 'tables' ? 'TableDataTab' : 'ViewDataTab',
|
||||||
tabComponent: 'TableDataTab',
|
tabPreviewMode: true,
|
||||||
props: {
|
props: {
|
||||||
schemaName,
|
schemaName,
|
||||||
pureName,
|
pureName,
|
||||||
conid,
|
conid,
|
||||||
database,
|
database,
|
||||||
objectTypeField: 'tables',
|
objectTypeField,
|
||||||
},
|
defaultActionId: 'openTable',
|
||||||
});
|
},
|
||||||
}}>Open data</ToolStripButton
|
});
|
||||||
>
|
}}>Open data</ToolStripButton
|
||||||
{/if}
|
>
|
||||||
|
<ToolStripButton
|
||||||
|
icon="img sql-file"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: 'img sql-file',
|
||||||
|
tabComponent: 'SqlObjectTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField,
|
||||||
|
defaultActionId: 'showSql',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>Show SQL</ToolStripButton
|
||||||
|
>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ToolStripContainer>
|
</ToolStripContainer>
|
||||||
|
|||||||
@@ -18,16 +18,24 @@
|
|||||||
import SqlFormView from '../formview/SqlFormView.svelte';
|
import SqlFormView from '../formview/SqlFormView.svelte';
|
||||||
import { getBoolSettingsValue } from '../settings/settingsTools';
|
import { getBoolSettingsValue } from '../settings/settingsTools';
|
||||||
import { extensions } from '../stores';
|
import { extensions } from '../stores';
|
||||||
import { useConnectionInfo, useDatabaseInfo, useDatabaseServerVersion, useViewInfo } from '../utility/metadataLoaders';
|
import {
|
||||||
|
useConnectionInfo,
|
||||||
|
useDatabaseInfo,
|
||||||
|
useDatabaseServerVersion,
|
||||||
|
useViewInfo,
|
||||||
|
} from '../utility/metadataLoaders';
|
||||||
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||||
import useGridConfig from '../utility/useGridConfig';
|
import useGridConfig from '../utility/useGridConfig';
|
||||||
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
|
import StatusBarTabItem from '../widgets/StatusBarTabItem.svelte';
|
||||||
|
import ToolStripButton from '../buttons/ToolStripButton.svelte';
|
||||||
|
import openNewTab from '../utility/openNewTab';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let conid;
|
export let conid;
|
||||||
export let database;
|
export let database;
|
||||||
export let schemaName;
|
export let schemaName;
|
||||||
export let pureName;
|
export let pureName;
|
||||||
|
export let objectTypeField;
|
||||||
|
|
||||||
$: connection = useConnectionInfo({ conid });
|
$: connection = useConnectionInfo({ conid });
|
||||||
$: viewInfo = useViewInfo({ conid, database, schemaName, pureName });
|
$: viewInfo = useViewInfo({ conid, database, schemaName, pureName });
|
||||||
@@ -76,6 +84,46 @@
|
|||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton command="dataGrid.refresh" />
|
<ToolStripCommandButton command="dataGrid.refresh" />
|
||||||
<ToolStripExportButton {quickExportHandlerRef} />
|
<ToolStripExportButton {quickExportHandlerRef} />
|
||||||
|
|
||||||
|
<ToolStripButton
|
||||||
|
icon="icon structure"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: 'img table-structure',
|
||||||
|
tabComponent: 'TableStructureTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField,
|
||||||
|
defaultActionId: 'openStructure',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>Open structure</ToolStripButton
|
||||||
|
>
|
||||||
|
|
||||||
|
<ToolStripButton
|
||||||
|
icon="img sql-file"
|
||||||
|
on:click={() => {
|
||||||
|
openNewTab({
|
||||||
|
title: pureName,
|
||||||
|
icon: 'img sql-file',
|
||||||
|
tabComponent: 'SqlObjectTab',
|
||||||
|
tabPreviewMode: true,
|
||||||
|
props: {
|
||||||
|
schemaName,
|
||||||
|
pureName,
|
||||||
|
conid,
|
||||||
|
database,
|
||||||
|
objectTypeField,
|
||||||
|
defaultActionId: 'showSql',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}>View SQL</ToolStripButton
|
||||||
|
>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
</ToolStripContainer>
|
</ToolStripContainer>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -138,4 +138,6 @@ export function getSupportedScriptTemplates(objectTypeField: string): { label: s
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user