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

@ -7,4 +7,7 @@ ALTER TABLE monitor
ALTER TABLE monitor ALTER TABLE monitor
ADD dns_resolve_server VARCHAR(255); ADD dns_resolve_server VARCHAR(255);
ALTER TABLE monitor
ADD dns_last_result VARCHAR(255);
COMMIT; COMMIT;

View File

@ -50,6 +50,7 @@ class Monitor extends BeanModel {
accepted_statuscodes: this.getAcceptedStatuscodes(), accepted_statuscodes: this.getAcceptedStatuscodes(),
dns_resolve_type: this.dns_resolve_type, dns_resolve_type: this.dns_resolve_type,
dns_resolve_server: this.dns_resolve_server, dns_resolve_server: this.dns_resolve_server,
dns_last_result: this.dns_last_result,
notificationIDList, notificationIDList,
}; };
} }
@ -207,6 +208,17 @@ class Monitor extends BeanModel {
dnsMessage = dnsMessage.slice(0, -2) 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.msg = dnsMessage;
bean.status = UP; bean.status = UP;
} }

View File

@ -10,7 +10,7 @@
<br> <br>
<span>{{ $t("Keyword") }}:</span> <span class="keyword">{{ monitor.keyword }}</span> <span>{{ $t("Keyword") }}:</span> <span class="keyword">{{ monitor.keyword }}</span>
</span> </span>
<span v-if="monitor.type === 'dns'">[{{ monitor.dns_resolve_type }}] {{ monitor.hostname }}</span> <span v-if="monitor.type === 'dns'">[{{ monitor.dns_resolve_type }}] {{ monitor.hostname }} [ {{ monitor.dns_last_result }} ]</span>
</p> </p>
<div class="functions"> <div class="functions">