Show latest dns result in Details.vue

This commit is contained in:
Ponkhy 2021-08-28 21:20:25 +02:00
parent 712da02324
commit 303adbf9b1
3 changed files with 16 additions and 1 deletions

View file

@ -50,6 +50,7 @@ class Monitor extends BeanModel {
accepted_statuscodes: this.getAcceptedStatuscodes(),
dns_resolve_type: this.dns_resolve_type,
dns_resolve_server: this.dns_resolve_server,
dns_last_result: this.dns_last_result,
notificationIDList,
};
}
@ -207,6 +208,17 @@ class Monitor extends BeanModel {
dnsMessage = dnsMessage.slice(0, -2)
}
let dnsLastResult = await R.findOne("monitor", "id = ?", [
this.id,
]);
if (dnsLastResult.dnsLastResult !== dnsMessage) {
R.exec("UPDATE `monitor` SET dns_last_result = ? WHERE id = ? ", [
dnsMessage,
this.id
]);
}
bean.msg = dnsMessage;
bean.status = UP;
}