1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-03-07 21:07:55 +01:00

refactor(SQLite): improved sqlite window title

This commit is contained in:
Fabio Di Stasio 2022-04-25 17:37:12 +02:00
parent 690cdcb2eb
commit d61acf8a00
2 changed files with 11 additions and 5 deletions
src/renderer

@ -79,7 +79,7 @@ export default {
const connectionName = this.getConnectionName(this.selectedWorkspace); const connectionName = this.getConnectionName(this.selectedWorkspace);
const workspace = this.getWorkspace(this.selectedWorkspace); const workspace = this.getWorkspace(this.selectedWorkspace);
const breadcrumbs = Object.values(workspace.breadcrumbs).filter(breadcrumb => breadcrumb); const breadcrumbs = Object.values(workspace.breadcrumbs).filter(breadcrumb => breadcrumb) || [workspace.client];
return [connectionName, ...breadcrumbs].join(' • '); return [connectionName, ...breadcrumbs].join(' • ');
} }

@ -26,9 +26,9 @@ export default {
const connection = state.connections.filter(connection => connection.uid === uid)[0]; const connection = state.connections.filter(connection => connection.uid === uid)[0];
let connectionName = ''; let connectionName = '';
if (connection.name) if (connection?.name)
connectionName = connection.name; connectionName = connection.name;
else if (connection.ask) else if (connection?.ask)
connectionName = `${connection.host}:${connection.port}`; connectionName = `${connection.host}:${connection.port}`;
else if (connection.databasePath) { else if (connection.databasePath) {
let string = connection.databasePath.split(/[/\\]+/).pop(); let string = connection.databasePath.split(/[/\\]+/).pop();
@ -38,8 +38,14 @@ export default {
connectionName = string; connectionName = string;
} }
else else {
connectionName = `${connection.user + '@'}${connection.host}:${connection.port}`; if (connection.user) connectionName += `${connection.user}@`;
if (connection.host) {
connectionName += connection.host;
if (connection.port) connectionName += `:${connection.port}`;
}
}
return connectionName; return connectionName;
} }