feat: add new duck db command

This commit is contained in:
Nybkox
2025-04-08 18:56:17 +02:00
parent ca18994092
commit b8d86518e7
5 changed files with 46 additions and 4 deletions

View File

@@ -46,6 +46,7 @@ import { openImportExportTab } from '../utility/importExportTools';
import newTable from '../tableeditor/newTable';
import { isProApp } from '../utility/proTools';
import { openWebLink } from '../utility/simpleTools';
import { _t } from '../translations';
// function themeCommand(theme: ThemeDefinition) {
// return {
@@ -389,12 +390,12 @@ registerCommand({
category: 'New',
icon: 'img sqlite-database',
name: 'SQLite database',
menuName: 'New SQLite database',
menuName: _t('command.new.sqliteDatabase', { defaultMessage: 'New SQLite database' }),
onClick: () => {
showModal(InputTextModal, {
value: 'newdb',
label: 'New database name',
header: 'Create SQLite database',
label: _t('command.new.sqliteDatabase', { defaultMessage: 'New SQLite database' }),
header: _t('command.new.sqliteDatabase.header', { defaultMessage: 'Create SQLite database' }),
onConfirm: async file => {
const resp = await apiCall('connections/new-sqlite-database', { file });
const connection = resp;
@@ -404,6 +405,26 @@ registerCommand({
},
});
registerCommand({
id: 'new.duckdbDatabase',
category: 'New',
icon: 'img sqlite-database',
name: 'DuckDB database',
menuName: _t('command.new.duckdbDatabase', { defaultMessage: 'New DuckDB database' }),
onClick: () => {
showModal(InputTextModal, {
value: 'newdb',
label: _t('command.new.duckdbDatabase', { defaultMessage: 'New DuckDB database' }),
header: _t('command.new.duckdbDatabase.header', { defaultMessage: 'Create DuckDB database' }),
onConfirm: async file => {
const resp = await apiCall('connections/new-duckdb-database', { file });
const connection = resp;
switchCurrentDatabase({ connection, name: `${file}.duckdb` });
},
});
},
});
registerCommand({
id: 'tabs.changelog',
category: 'Tabs',