mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-30 18:24:03 +00:00
Drop the property monitor.maintenance
, use lastHeartBeat.status
to check status instead
This commit is contained in:
parent
7bb12a7e00
commit
a5ff27da7a
3 changed files with 15 additions and 15 deletions
|
@ -36,7 +36,6 @@ class Monitor extends BeanModel {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
sendUrl: this.sendUrl,
|
sendUrl: this.sendUrl,
|
||||||
maintenance: await Monitor.isUnderMaintenance(this.id),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.sendUrl) {
|
if (this.sendUrl) {
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { DOWN, MAINTENANCE, PENDING, UP } from "../util.ts";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
/** Monitor this represents */
|
/** Monitor this represents */
|
||||||
|
@ -24,7 +26,6 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
uptime() {
|
uptime() {
|
||||||
|
|
||||||
if (this.type === "maintenance") {
|
if (this.type === "maintenance") {
|
||||||
return this.$t("statusMaintenance");
|
return this.$t("statusMaintenance");
|
||||||
}
|
}
|
||||||
|
@ -39,19 +40,19 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
color() {
|
color() {
|
||||||
if (this.type === "maintenance" || this.monitor.maintenance) {
|
if (this.lastHeartBeat.status === MAINTENANCE) {
|
||||||
return "maintenance";
|
return "maintenance";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lastHeartBeat.status === 0) {
|
if (this.lastHeartBeat.status === DOWN) {
|
||||||
return "danger";
|
return "danger";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lastHeartBeat.status === 1) {
|
if (this.lastHeartBeat.status === UP) {
|
||||||
return "primary";
|
return "primary";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.lastHeartBeat.status === 2) {
|
if (this.lastHeartBeat.status === PENDING) {
|
||||||
return "warning";
|
return "warning";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -627,28 +627,28 @@ export default {
|
||||||
for (let monitorID in this.lastHeartbeatList) {
|
for (let monitorID in this.lastHeartbeatList) {
|
||||||
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
let lastHeartBeat = this.lastHeartbeatList[monitorID];
|
||||||
|
|
||||||
if (this.monitorList[monitorID] && this.monitorList[monitorID].maintenance) {
|
if (! lastHeartBeat) {
|
||||||
result[monitorID] = {
|
|
||||||
text: this.$t("statusMaintenance"),
|
|
||||||
color: "maintenance",
|
|
||||||
};
|
|
||||||
} else if (! lastHeartBeat) {
|
|
||||||
result[monitorID] = unknown;
|
result[monitorID] = unknown;
|
||||||
} else if (lastHeartBeat.status === 1) {
|
} else if (lastHeartBeat.status === UP) {
|
||||||
result[monitorID] = {
|
result[monitorID] = {
|
||||||
text: this.$t("Up"),
|
text: this.$t("Up"),
|
||||||
color: "primary",
|
color: "primary",
|
||||||
};
|
};
|
||||||
} else if (lastHeartBeat.status === 0) {
|
} else if (lastHeartBeat.status === DOWN) {
|
||||||
result[monitorID] = {
|
result[monitorID] = {
|
||||||
text: this.$t("Down"),
|
text: this.$t("Down"),
|
||||||
color: "danger",
|
color: "danger",
|
||||||
};
|
};
|
||||||
} else if (lastHeartBeat.status === 2) {
|
} else if (lastHeartBeat.status === PENDING) {
|
||||||
result[monitorID] = {
|
result[monitorID] = {
|
||||||
text: this.$t("Pending"),
|
text: this.$t("Pending"),
|
||||||
color: "warning",
|
color: "warning",
|
||||||
};
|
};
|
||||||
|
} else if (lastHeartBeat.status === MAINTENANCE) {
|
||||||
|
result[monitorID] = {
|
||||||
|
text: this.$t("statusMaintenance"),
|
||||||
|
color: "maintenance",
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
result[monitorID] = unknown;
|
result[monitorID] = unknown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue