mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 06:53:58 +00:00
new table command
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { currentTheme, extensions, getVisibleToolbar, visibleToolbar } from '../stores';
|
import { currentDatabase, currentTheme, extensions, getVisibleToolbar, visibleToolbar } from '../stores';
|
||||||
import registerCommand from './registerCommand';
|
import registerCommand from './registerCommand';
|
||||||
import { derived, get } from 'svelte/store';
|
import { derived, get } from 'svelte/store';
|
||||||
import { ThemeDefinition } from 'dbgate-types';
|
import { ThemeDefinition } from 'dbgate-types';
|
||||||
@@ -17,6 +17,7 @@ import { getDefaultFileFormat } from '../plugins/fileformats';
|
|||||||
import { getCurrentConfig, getCurrentDatabase } from '../stores';
|
import { getCurrentConfig, getCurrentDatabase } from '../stores';
|
||||||
import './recentDatabaseSwitch';
|
import './recentDatabaseSwitch';
|
||||||
import hasPermission from '../utility/hasPermission';
|
import hasPermission from '../utility/hasPermission';
|
||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
const electron = getElectron();
|
const electron = getElectron();
|
||||||
|
|
||||||
@@ -104,6 +105,37 @@ registerCommand({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
registerCommand({
|
||||||
|
id: 'new.table',
|
||||||
|
category: 'New',
|
||||||
|
icon: 'img table',
|
||||||
|
name: 'Table',
|
||||||
|
toolbar: true,
|
||||||
|
toolbarName: 'New table',
|
||||||
|
onClick: () => {
|
||||||
|
const $currentDatabase = get(currentDatabase);
|
||||||
|
const connection = _.get($currentDatabase, 'connection') || {};
|
||||||
|
const database = _.get($currentDatabase, 'name');
|
||||||
|
|
||||||
|
openNewTab(
|
||||||
|
{
|
||||||
|
title: 'Table #',
|
||||||
|
icon: 'img table',
|
||||||
|
tabComponent: 'TableStructureTab',
|
||||||
|
props: {
|
||||||
|
conid: connection._id,
|
||||||
|
database,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
editor: {
|
||||||
|
columns: [],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
registerCommand({
|
registerCommand({
|
||||||
id: 'new.markdown',
|
id: 'new.markdown',
|
||||||
category: 'New',
|
category: 'New',
|
||||||
|
|||||||
Reference in New Issue
Block a user