reset the heartbeat list instead of reload the page after cleared events or heartbeats

This commit is contained in:
LouisLam
2021-09-05 02:03:40 +08:00
parent ca8d4ab61b
commit 299506ce45
4 changed files with 109 additions and 73 deletions

View File

@@ -107,8 +107,8 @@ export default {
}
});
socket.on("heartbeatList", (monitorID, data) => {
if (! (monitorID in this.heartbeatList)) {
socket.on("heartbeatList", (monitorID, data, overwrite = false) => {
if (! (monitorID in this.heartbeatList) || overwrite) {
this.heartbeatList[monitorID] = data;
} else {
this.heartbeatList[monitorID] = data.concat(this.heartbeatList[monitorID])
@@ -127,8 +127,8 @@ export default {
this.certInfoList[monitorID] = JSON.parse(data)
});
socket.on("importantHeartbeatList", (monitorID, data) => {
if (! (monitorID in this.importantHeartbeatList)) {
socket.on("importantHeartbeatList", (monitorID, data, overwrite) => {
if (! (monitorID in this.importantHeartbeatList) || overwrite) {
this.importantHeartbeatList[monitorID] = data;
} else {
this.importantHeartbeatList[monitorID] = data.concat(this.importantHeartbeatList[monitorID])

View File

@@ -276,6 +276,7 @@ export default {
importantHeartBeatList() {
if (this.$root.importantHeartbeatList[this.monitor.id]) {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.heartBeatList = this.$root.importantHeartbeatList[this.monitor.id];
return this.$root.importantHeartbeatList[this.monitor.id]
}
@@ -359,9 +360,7 @@ export default {
clearEvents() {
this.$root.clearEvents(this.monitor.id, (res) => {
if (res.ok) {
this.$router.go();
} else {
if (! res.ok) {
toast.error(res.msg);
}
})
@@ -369,9 +368,7 @@ export default {
clearHeartbeats() {
this.$root.clearHeartbeats(this.monitor.id, (res) => {
if (res.ok) {
this.$router.go();
} else {
if (! res.ok) {
toast.error(res.msg);
}
})
@@ -495,7 +492,7 @@ table {
border-color: $dark-bg2;
border-width: 2px;
li button{
li button {
color: $dark-font-color;
}