mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
sql editor - not working
This commit is contained in:
37
packages/web/src/query/newQuery.ts
Normal file
37
packages/web/src/query/newQuery.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import _ from 'lodash';
|
||||
import { get } from 'svelte/store';
|
||||
import { currentDatabase } from '../stores';
|
||||
import openNewTab from '../utility/openNewTab';
|
||||
|
||||
export default function newQuery({
|
||||
tabComponent = 'QueryTab',
|
||||
icon = 'img sql-file',
|
||||
title = undefined,
|
||||
initialData = undefined,
|
||||
...props
|
||||
} = {}) {
|
||||
const $currentDatabase = get(currentDatabase);
|
||||
const connection = _.get($currentDatabase, 'connection') || {};
|
||||
const database = _.get($currentDatabase, 'name');
|
||||
|
||||
const tooltip = `${connection.displayName || connection.server}\n${database}`;
|
||||
|
||||
openNewTab(
|
||||
{
|
||||
title: title || 'Query #',
|
||||
icon,
|
||||
tooltip,
|
||||
tabComponent,
|
||||
props: {
|
||||
...props,
|
||||
conid: connection._id,
|
||||
database,
|
||||
},
|
||||
},
|
||||
{ editor: initialData }
|
||||
);
|
||||
}
|
||||
|
||||
export function newQueryDesign() {
|
||||
return newQuery({ tabComponent: 'QueryDesignTab', icon: 'img query-design' });
|
||||
}
|
||||
Reference in New Issue
Block a user