aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2018-02-25 13:37:52 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2018-02-25 13:37:52 +0000
commite561125e5be2c02095dfe8f4557f6b9a6676b588 (patch)
treed5caa469e03dcd577ccd705ebb84ba27e9a12996
parent1c9e90c1619d56f199c119874d09263acd827b07 (diff)
downloadsql-plus-plus-e561125e5be2c02095dfe8f4557f6b9a6676b588.tar.xz
sql-plus-plus-e561125e5be2c02095dfe8f4557f6b9a6676b588.zip
Set connection title to host:port if name not set
-rw-r--r--instance-manager.js11
-rw-r--r--main.js2
2 files changed, 11 insertions, 2 deletions
diff --git a/instance-manager.js b/instance-manager.js
index 7d27a7e..96151ab 100644
--- a/instance-manager.js
+++ b/instance-manager.js
@@ -12,7 +12,7 @@ function createNewConnection() {
function registerNewInstance(payload) {
tabGroup.addTab({
- title: payload.connectionName,
+ title: getTabTitle(payload.connectionConfig),
src: "file://" + __dirname + "/editor-instance.html",
visible: true,
active: true,
@@ -28,6 +28,15 @@ function registerNewInstance(payload) {
});
}
+function getTabTitle(connectionConfig) {
+ if(connectionConfig.name) {
+ return connectionConfig.name;
+ }
+ else {
+ return connectionConfig.hostname + ":" + connectionConfig.port;
+ }
+}
+
ipcRenderer.on("instanceManager.registerNewInstance", (event, payload) => {
registerNewInstance(payload);
});
diff --git a/main.js b/main.js
index 0b9495e..8a8842b 100644
--- a/main.js
+++ b/main.js
@@ -97,7 +97,7 @@ ipcMain.on("queryExecutor.initialiseConnectionCallback", (event, payload) => {
queryExecutors.pop().close();
}
else{
- uiWindow.webContents.send("instanceManager.registerNewInstance", { assignedQueryExecutorId: payload.executorId, connectionName: connectionConfig.name });
+ uiWindow.webContents.send("instanceManager.registerNewInstance", { assignedQueryExecutorId: payload.executorId, connectionConfig: connectionConfig });
newConnectionDialog.close();
}
}