diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 0b8e55073..997faf955 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -283,13 +283,13 @@
@@ -301,7 +301,7 @@ @@ -311,7 +311,7 @@
@@ -692,6 +692,13 @@ export default { ipOrHostnameRegexPattern: hostNameRegexPattern(), mqttIpOrHostnameRegexPattern: hostNameRegexPattern(true), gameList: null, + connectionStringTemplates: { + "sqlserver": "Server=,;Database=;User Id=;Password=;Encrypt=;TrustServerCertificate=;Connection Timeout=", + "postgres": "postgres://username:password@host:port/database", + "mysql": "mysql://username:password@host:port/database", + "redis": "redis://user:password@host:port", + "mongodb": "mongodb://username:password@host:port/database", + } }; }, @@ -853,6 +860,24 @@ message HealthCheckResponse { } }); } + + // Set default database connection string if empty or it is a template from another database monitor type + for (let monitorType in this.connectionStringTemplates) { + if (this.monitor.type === monitorType) { + let isTemplate = false; + for (let key in this.connectionStringTemplates) { + if (this.monitor.databaseConnectionString === this.connectionStringTemplates[key]) { + isTemplate = true; + break; + } + } + if (!this.monitor.databaseConnectionString || isTemplate) { + this.monitor.databaseConnectionString = this.connectionStringTemplates[monitorType]; + } + break; + } + } + }, currentGameObject(newGameObject, previousGameObject) { @@ -860,8 +885,7 @@ message HealthCheckResponse { this.monitor.port = newGameObject.options.port; } this.monitor.game = newGameObject.keys[0]; - } - + }, }, mounted() { this.init();