refactor: reuse databaseConnectionString

pull/2541/head
long2ice 2 years ago
parent 40ebc2df79
commit db757123ba

@ -1,6 +0,0 @@
BEGIN TRANSACTION;
ALTER TABLE monitor
ADD redis_connection_string VARCHAR(255);
COMMIT

@ -66,7 +66,6 @@ class Database {
"patch-add-radius-monitor.sql": true, "patch-add-radius-monitor.sql": true,
"patch-monitor-add-resend-interval.sql": true, "patch-monitor-add-resend-interval.sql": true,
"patch-maintenance-table2.sql": true, "patch-maintenance-table2.sql": true,
"patch-redis-monitor.sql": true,
}; };
/** /**

@ -122,7 +122,6 @@ class Monitor extends BeanModel {
basic_auth_pass: this.basic_auth_pass, basic_auth_pass: this.basic_auth_pass,
pushToken: this.pushToken, pushToken: this.pushToken,
databaseConnectionString: this.databaseConnectionString, databaseConnectionString: this.databaseConnectionString,
redisConnectionString: this.redisConnectionString,
radiusUsername: this.radiusUsername, radiusUsername: this.radiusUsername,
radiusPassword: this.radiusPassword, radiusPassword: this.radiusPassword,
radiusSecret: this.radiusSecret, radiusSecret: this.radiusSecret,
@ -623,7 +622,7 @@ class Monitor extends BeanModel {
} else if (this.type === "redis") { } else if (this.type === "redis") {
let startTime = dayjs().valueOf(); let startTime = dayjs().valueOf();
bean.msg = await redisPingAsync(this.redisConnectionString); bean.msg = await redisPingAsync(this.databaseConnectionString);
bean.status = UP; bean.status = UP;
bean.ping = dayjs().valueOf() - startTime; bean.ping = dayjs().valueOf() - startTime;
} else { } else {

@ -274,7 +274,7 @@
<template v-if="monitor.type === 'redis'"> <template v-if="monitor.type === 'redis'">
<div class="my-3"> <div class="my-3">
<label for="redisConnectionString" class="form-label">{{ $t("Connection String") }}</label> <label for="redisConnectionString" class="form-label">{{ $t("Connection String") }}</label>
<input id="redisConnectionString" v-model="monitor.redisConnectionString" type="text" class="form-control" placeholder="redis://user:password@host:port"> <input id="redisConnectionString" v-model="monitor.databaseConnectionString" type="text" class="form-control" placeholder="redis://user:password@host:port">
</div> </div>
</template> </template>
<!-- Interval --> <!-- Interval -->

Loading…
Cancel
Save