From 6272514820ea126780efe873d70ee057470bacdf Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Thu, 13 Jan 2022 11:53:08 +0800 Subject: [PATCH] [MQTT] Use existing fields instead of creating new ones (Server) --- server/model/monitor.js | 4 +--- server/server.js | 1 - src/pages/EditMonitor.vue | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index c073c733..c71c5145 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -79,11 +79,9 @@ class Monitor extends BeanModel { pushToken: this.pushToken, notificationIDList, tags: tags, - mqttPort: this.mqttPort, mqttUsername: this.mqttUsername, mqttTopic: this.mqttTopic, mqttSuccessMessage: this.mqttSuccessMessage - }; } @@ -354,7 +352,7 @@ class Monitor extends BeanModel { } else if (this.type === "mqtt") { try { bean.msg = await mqttAsync(this.url, this.mqttTopic, this.mqttSuccessMessage, { - mqttPort: this.mqttPort, + mqttPort: this.port, mqttUsername: this.mqttUsername, mqttPassword: this.mqttPassword, interval: this.interval, diff --git a/server/server.js b/server/server.js index f23f8f45..951fd76f 100644 --- a/server/server.js +++ b/server/server.js @@ -588,7 +588,6 @@ exports.entryPage = "dashboard"; bean.dns_resolve_type = monitor.dns_resolve_type; bean.dns_resolve_server = monitor.dns_resolve_server; bean.pushToken = monitor.pushToken; - bean.mqttPort = monitor.mqttPort; bean.mqttUsername = monitor.mqttUsername; bean.mqttTopic = monitor.mqttTopic; bean.mqttSuccessMessage = monitor.mqttSuccessMessage; diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 13ed84ca..24d38946 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -472,7 +472,6 @@ export default { accepted_statuscodes: ["200-299"], dns_resolve_type: "A", dns_resolve_server: "1.1.1.1", - mqttPort: "", mqttUsername: "", mqttPassword: "", mqttTopic: "",