renamed singleDatabase => singleDbConnection

This commit is contained in:
Jan Prochazka 2022-12-25 18:01:36 +01:00
parent 54278f6276
commit bbb6c5e5f5
7 changed files with 14 additions and 11 deletions

View File

@ -2,6 +2,7 @@ DEVMODE=1
CONNECTIONS=mysql
SINGLE_CONNECTION=mysql
# SINGLE_DATABASE=Chinook
LABEL_mysql=MySql localhost
SERVER_mysql=localhost

View File

@ -5,8 +5,8 @@ CONNECTIONS=mysql
LABEL_mysql=MySql localhost
SERVER_mysql=localhost
USER_mysql=root
PASSWORD_mysql=test
PORT_mysql=3307
PASSWORD_mysql=Pwd2020Db
PORT_mysql=3306
ENGINE_mysql=mysql@dbgate-plugin-mysql
DBCONFIG_mysql=[{"name":"Chinook","connectionColor":"cyan"}]

View File

@ -38,7 +38,7 @@ module.exports = {
return {
runAsPortal: !!connections.portalConnections,
singleDatabase: connections.singleDatabase,
singleDbConnection: connections.singleDbConnection,
singleConnection: connections.singleConnection,
// hideAppEditor: !!process.env.HIDE_APP_EDITOR,
allowShellConnection: platformInfo.allowShellConnection,

View File

@ -133,7 +133,7 @@ function getPortalCollections() {
const portalConnections = getPortalCollections();
function getSingleDatabase() {
function getSingleDbConnection() {
if (process.env.SINGLE_CONNECTION && process.env.SINGLE_DATABASE) {
// @ts-ignore
const connection = portalConnections.find(x => x._id == process.env.SINGLE_CONNECTION);
@ -158,7 +158,7 @@ function getSingleDatabase() {
}
function getSingleConnection() {
if (getSingleDatabase()) return null;
if (getSingleDbConnection()) return null;
if (process.env.SINGLE_CONNECTION) {
// @ts-ignore
const connection = portalConnections.find(x => x._id == process.env.SINGLE_CONNECTION);
@ -174,13 +174,13 @@ function getSingleConnection() {
return null;
}
const singleDatabase = getSingleDatabase();
const singleDbConnection = getSingleDbConnection();
const singleConnection = getSingleConnection();
module.exports = {
datastore: null,
opened: [],
singleDatabase,
singleDbConnection,
singleConnection,
portalConnections,

View File

@ -40,7 +40,7 @@
for (const connection of connectionList || []) {
const conid = connection._id;
if (connection.singleDatabase) continue;
if (getCurrentConfig()?.singleDatabase) continue;
if (getCurrentConfig()?.singleDbConnection) continue;
const databases = getLocalStorage(`database_list_${conid}`) || [];
for (const db of databases) {
databaseList.push({

View File

@ -246,8 +246,8 @@ export function subscribeApiDependendStores() {
useConfig().subscribe(value => {
currentConfigValue = value;
invalidateCommands();
if (value.singleDatabase) {
currentDatabase.set(value.singleDatabase);
if (value.singleDbConnection) {
currentDatabase.set(value.singleDbConnection);
}
});
}

View File

@ -21,10 +21,12 @@
$: config = useConfig();
$: singleDatabase = $currentDatabase?.connection?.singleDatabase;
$: database = $currentDatabase?.name;
$: console.log('CFG', $config);
</script>
<WidgetColumnBar {hidden}>
{#if !$config?.singleDatabase}
{#if !$config?.singleDbConnection}
<WidgetColumnBarItem title="Connections" name="connections" height="35%" storageName="connectionsWidget">
<ConnectionList />
</WidgetColumnBarItem>