mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 20:53:57 +00:00
nosql queries
This commit is contained in:
@@ -10,20 +10,27 @@
|
||||
|
||||
export let jslid;
|
||||
|
||||
let loadedRows;
|
||||
|
||||
$: info = useFetch({
|
||||
params: { jslid },
|
||||
url: 'jsldata/get-info',
|
||||
defaultValue: {},
|
||||
});
|
||||
|
||||
$: columns = ($info && $info.columns) || [];
|
||||
// $: columns = ($info && $info.columns) || [];
|
||||
const config = writable(createGridConfig());
|
||||
const cache = writable(createGridCache());
|
||||
|
||||
$: display = new JslGridDisplay(jslid, columns, $config, config.update, $cache, cache.update);
|
||||
|
||||
$: display = new JslGridDisplay(jslid, $info, $config, config.update, $cache, cache.update, loadedRows);
|
||||
</script>
|
||||
|
||||
{#key jslid}
|
||||
<DataGrid {display} {jslid} gridCoreComponent={JslDataGridCore} />
|
||||
<DataGrid
|
||||
{display}
|
||||
{jslid}
|
||||
gridCoreComponent={JslDataGridCore}
|
||||
bind:loadedRows
|
||||
isDynamicStructure={$info?.__isDynamicStructure}
|
||||
/>
|
||||
{/key}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
export const activator = createActivator('JslDataGridCore', false);
|
||||
|
||||
let loadedRows = [];
|
||||
export let loadedRows = [];
|
||||
let domGrid;
|
||||
|
||||
let changeIndex = 0;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
$: {
|
||||
if (executeNumber >= 0) {
|
||||
resultInfos = [];
|
||||
if (domTabs) domTabs.setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
id: 'query.formatCode',
|
||||
category: 'Query',
|
||||
name: 'Format code',
|
||||
testEnabled: () => getCurrentEditor() != null,
|
||||
testEnabled: () => getCurrentEditor()?.isSqlEditor(),
|
||||
onClick: () => getCurrentEditor().formatCode(),
|
||||
});
|
||||
registerCommand({
|
||||
@@ -13,7 +13,7 @@
|
||||
category: 'Query',
|
||||
name: 'Insert SQL Join',
|
||||
keyText: 'Ctrl+J',
|
||||
testEnabled: () => getCurrentEditor() != null,
|
||||
testEnabled: () => getCurrentEditor()?.isSqlEditor(),
|
||||
onClick: () => getCurrentEditor().insertSqlJoin(),
|
||||
});
|
||||
registerFileCommands({
|
||||
@@ -54,6 +54,8 @@
|
||||
import InsertJoinModal from '../modals/InsertJoinModal.svelte';
|
||||
import useTimerLabel from '../utility/useTimerLabel';
|
||||
import createActivator, { getActiveComponent } from '../utility/createActivator';
|
||||
import { findEngineDriver } from 'dbgate-tools';
|
||||
import AceEditor from '../query/AceEditor.svelte';
|
||||
|
||||
export let tabid;
|
||||
export let conid;
|
||||
@@ -73,6 +75,7 @@
|
||||
let domEditor;
|
||||
|
||||
$: connection = useConnectionInfo({ conid });
|
||||
$: driver = findEngineDriver($connection, $extensions);
|
||||
|
||||
$: effect = useEffect(() => {
|
||||
return onSession(sessionId);
|
||||
@@ -102,6 +105,10 @@
|
||||
domEditor?.getEditor()?.focus();
|
||||
}
|
||||
|
||||
export function isSqlEditor() {
|
||||
return !driver?.dialect?.nosql;
|
||||
}
|
||||
|
||||
export function canKill() {
|
||||
return !!sessionId;
|
||||
}
|
||||
@@ -225,19 +232,33 @@
|
||||
|
||||
<VerticalSplitter isSplitter={visibleResultTabs}>
|
||||
<svelte:fragment slot="1">
|
||||
<SqlEditor
|
||||
engine={$connection && $connection.engine}
|
||||
{conid}
|
||||
{database}
|
||||
value={$editorState.value || ''}
|
||||
menu={createMenu()}
|
||||
on:input={e => setEditorData(e.detail)}
|
||||
on:focus={() => {
|
||||
activator.activate();
|
||||
invalidateCommands();
|
||||
}}
|
||||
bind:this={domEditor}
|
||||
/>
|
||||
{#if driver?.dialect?.nosql}
|
||||
<AceEditor
|
||||
mode="javascript"
|
||||
value={$editorState.value || ''}
|
||||
menu={createMenu()}
|
||||
on:input={e => setEditorData(e.detail)}
|
||||
on:focus={() => {
|
||||
activator.activate();
|
||||
invalidateCommands();
|
||||
}}
|
||||
bind:this={domEditor}
|
||||
/>
|
||||
{:else}
|
||||
<SqlEditor
|
||||
engine={$connection && $connection.engine}
|
||||
{conid}
|
||||
{database}
|
||||
value={$editorState.value || ''}
|
||||
menu={createMenu()}
|
||||
on:input={e => setEditorData(e.detail)}
|
||||
on:focus={() => {
|
||||
activator.activate();
|
||||
invalidateCommands();
|
||||
}}
|
||||
bind:this={domEditor}
|
||||
/>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="2">
|
||||
<ResultTabs tabs={[{ label: 'Messages', slot: 0 }]} {sessionId} {executeNumber}>
|
||||
|
||||
Reference in New Issue
Block a user