mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 03:45:59 +00:00
sql object tab
This commit is contained in:
@@ -26,13 +26,13 @@
|
|||||||
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
import LoadingInfo from '../elements/LoadingInfo.svelte';
|
||||||
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';
|
||||||
|
|
||||||
export let tabid;
|
export let tabid;
|
||||||
export let appObjectData;
|
export let appObjectData;
|
||||||
export let initialScriptTemplate;
|
export let scriptTemplate;
|
||||||
|
|
||||||
let scriptTemplate =
|
$: defaultScriptTemplate = getSupportedScriptTemplates(appObjectData.objectTypeField)?.[0]?.scriptTemplate;
|
||||||
initialScriptTemplate ?? getSupportedScriptTemplates(appObjectData.objectTypeField)?.[0]?.scriptTemplate;
|
|
||||||
|
|
||||||
$: connection = useConnectionInfo({ conid: appObjectData.conid });
|
$: connection = useConnectionInfo({ conid: appObjectData.conid });
|
||||||
$: driver = findEngineDriver($connection, $extensions);
|
$: driver = findEngineDriver($connection, $extensions);
|
||||||
@@ -58,11 +58,12 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ToolStripContainer>
|
<ToolStripContainer>
|
||||||
{#await applyScriptTemplate(scriptTemplate, $extensions, appObjectData)}
|
{#await applyScriptTemplate(scriptTemplate ?? defaultScriptTemplate, $extensions, appObjectData)}
|
||||||
<LoadingInfo message="Loading script..." />
|
<LoadingInfo message="Loading script..." />
|
||||||
{:then sql}
|
{:then sql}
|
||||||
<AceEditor
|
<AceEditor
|
||||||
value={sql || ''}
|
value={sql || ''}
|
||||||
|
readOnly
|
||||||
menu={createMenu()}
|
menu={createMenu()}
|
||||||
on:focus={() => {
|
on:focus={() => {
|
||||||
activator.activate();
|
activator.activate();
|
||||||
@@ -75,16 +76,21 @@
|
|||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<svelte:fragment slot="toolstrip">
|
<svelte:fragment slot="toolstrip">
|
||||||
<ToolStripCommandButton command="sqlObject.find" />
|
|
||||||
<SelectField
|
<SelectField
|
||||||
isNative
|
isNative
|
||||||
value={scriptTemplate}
|
value={scriptTemplate ?? defaultScriptTemplate}
|
||||||
options={getSupportedScriptTemplates(appObjectData.objectTypeField).map(x => ({
|
options={getSupportedScriptTemplates(appObjectData.objectTypeField).map(x => ({
|
||||||
label: x.label,
|
label: x.label,
|
||||||
value: x.scriptTemplate,
|
value: x.scriptTemplate,
|
||||||
}))}
|
}))}
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
scriptTemplate = e.detail;
|
changeTab(tabid, tab => ({
|
||||||
|
...tab,
|
||||||
|
props: {
|
||||||
|
...tab.props,
|
||||||
|
scriptTemplate: e.detail,
|
||||||
|
},
|
||||||
|
}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
|
|||||||
Reference in New Issue
Block a user