more flexible connection dialog, improved UX when connecting to redshift

This commit is contained in:
Jan Prochazka
2021-05-16 11:22:48 +02:00
parent 6d7cc7d441
commit 8bffa4a7dd
10 changed files with 201 additions and 102 deletions

View File

@@ -1,6 +1,13 @@
const { driverBase } = require('dbgate-tools');
const Dumper = require('./Dumper');
function getDatabaseFileLabel(databaseFile) {
if (!databaseFile) return databaseFile;
const m = databaseFile.match(/[\/]([^\/]+)$/);
if (m) return m[1];
return databaseFile;
}
/** @type {import('dbgate-types').SqlDialect} */
const dialect = {
limitSelect: true,
@@ -13,7 +20,6 @@ const dialect = {
},
};
/** @type {import('dbgate-types').EngineDriver} */
const driver = {
...driverBase,
@@ -21,7 +27,15 @@ const driver = {
dialect,
engine: 'sqlite@dbgate-plugin-sqlite',
title: 'SQLite',
isFileDatabase: true,
showConnectionField: (field, values) => field == 'databaseFile',
showConnectionTab: (field) => false,
beforeConnectionSave: (connection) => ({
...connection,
singleDatabase: true,
defaultDatabase: getDatabaseFileLabel(connection.databaseFile),
}),
// isFileDatabase: true,
isElectronOnly: true,
};
module.exports = driver;