fixed edit monitor fields empty issues

This commit is contained in:
Tarun Singh 2021-12-18 16:35:18 -05:00
parent 5afc6a41e3
commit d3c90df8a8
4 changed files with 15 additions and 5 deletions

View File

@ -1,6 +1,5 @@
const https = require("https"); const https = require("https");
const dayjs = require("dayjs"); const dayjs = require("dayjs");
const mqtt = require("mqtt");
const utc = require("dayjs/plugin/utc"); const utc = require("dayjs/plugin/utc");
let timezone = require("dayjs/plugin/timezone"); let timezone = require("dayjs/plugin/timezone");
dayjs.extend(utc); dayjs.extend(utc);
@ -78,6 +77,11 @@ class Monitor extends BeanModel {
pushToken: this.pushToken, pushToken: this.pushToken,
notificationIDList, notificationIDList,
tags: tags, tags: tags,
mqttPort: this.mqttPort,
mqttUsername: this.mqttUsername,
mqttTopic: this.mqttTopic,
mqttSuccessMessage: this.mqttSuccessMessage
}; };
} }

View File

@ -588,6 +588,10 @@ exports.entryPage = "dashboard";
bean.dns_resolve_type = monitor.dns_resolve_type; bean.dns_resolve_type = monitor.dns_resolve_type;
bean.dns_resolve_server = monitor.dns_resolve_server; bean.dns_resolve_server = monitor.dns_resolve_server;
bean.pushToken = monitor.pushToken; bean.pushToken = monitor.pushToken;
bean.mqttPort = monitor.mqttPort;
bean.mqttUsername = monitor.mqttUsername;
bean.mqttTopic = monitor.mqttTopic;
bean.mqttSuccessMessage = monitor.mqttSuccessMessage;
await R.store(bean); await R.store(bean);

View File

@ -310,6 +310,5 @@ export default {
topicExplanation: "MQTT topic to monitor", topicExplanation: "MQTT topic to monitor",
successMessage: "Success Message", successMessage: "Success Message",
successMessageExplanation: "MQTT message that will be considered as success", successMessageExplanation: "MQTT message that will be considered as success",
serverUrl: "Server URL",
recent: "Recent", recent: "Recent",
}; };

View File

@ -122,7 +122,7 @@
<!-- For MQTT Type --> <!-- For MQTT Type -->
<template v-if="monitor.type === 'mqtt'"> <template v-if="monitor.type === 'mqtt'">
<div class="my-3"> <div class="my-3">
<label for="url" class="form-label">{{ $t("serverUrl") }}</label> <label for="url" class="form-label">{{ $t("hostname") }}</label>
<input id="url" v-model="monitor.url" type="text" class="form-control" required> <input id="url" v-model="monitor.url" type="text" class="form-control" required>
</div> </div>
@ -469,8 +469,11 @@ export default {
accepted_statuscodes: ["200-299"], accepted_statuscodes: ["200-299"],
dns_resolve_type: "A", dns_resolve_type: "A",
dns_resolve_server: "1.1.1.1", dns_resolve_server: "1.1.1.1",
topic: "", mqttPort: "",
successMessage: "", mqttUsername: "",
mqttPassword: "",
mqttTopic: "",
mqttSuccessMessage: "",
}; };
for (let i = 0; i < this.$root.notificationList.length; i++) { for (let i = 0; i < this.$root.notificationList.length; i++) {