mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 22:55:59 +00:00
database file label
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
export function getDatabaseFileLabel(databaseFile) {
|
||||
if (!databaseFile) return databaseFile;
|
||||
const m = databaseFile.match(/[\/]([^\/]+)$/);
|
||||
if (m) return m[1];
|
||||
return databaseFile;
|
||||
}
|
||||
|
||||
export default function getConnectionLabel(connection, { allowExplicitDatabase = true } = {}) {
|
||||
if (!connection) {
|
||||
return null;
|
||||
@@ -9,9 +16,7 @@ export default function getConnectionLabel(connection, { allowExplicitDatabase =
|
||||
return `${connection.defaultDatabase} on ${connection.server}`;
|
||||
}
|
||||
if (connection.databaseFile) {
|
||||
const m = connection.databaseFile.match(/[\/]([^\/]+)$/);
|
||||
if (m) return m[1];
|
||||
return connection.databaseFile;
|
||||
return getDatabaseFileLabel(connection.databaseFile);
|
||||
}
|
||||
if (connection.server) {
|
||||
return connection.server;
|
||||
|
||||
Reference in New Issue
Block a user