[Status Page] WIP: Checkpoint

This commit is contained in:
LouisLam
2021-09-11 23:43:07 +08:00
parent 3e25f0e9d9
commit 934685637a
8 changed files with 123 additions and 75 deletions

View File

@@ -25,6 +25,10 @@ export default {
type: Number,
required: true,
},
heartbeatList: {
type: Array,
default: null,
}
},
data() {
return {
@@ -38,8 +42,15 @@ export default {
},
computed: {
/**
* If heartbeatList is null, get it from $root.heartbeatList
*/
beatList() {
return this.$root.heartbeatList[this.monitorId]
if (this.heartbeatList === null) {
return this.$root.heartbeatList[this.monitorId];
} else {
return this.heartbeatList;
}
},
shortBeatList() {
@@ -118,8 +129,10 @@ export default {
window.removeEventListener("resize", this.resize);
},
beforeMount() {
if (! (this.monitorId in this.$root.heartbeatList)) {
this.$root.heartbeatList[this.monitorId] = [];
if (this.heartbeatList === null) {
if (! (this.monitorId in this.$root.heartbeatList)) {
this.$root.heartbeatList[this.monitorId] = [];
}
}
},

View File

@@ -1,5 +1,5 @@
<template>
<div class="shadow-box list mb-3" :class="{ scrollbar: scrollbar }">
<div class="shadow-box monitor-list mb-3" :class="{ scrollbar: scrollbar }">
<div v-if="Object.keys($root.monitorList).length === 0" class="text-center mt-3">
{{ $t("No Monitors, please") }} <router-link to="/add">{{ $t("add one") }}</router-link>
</div>
@@ -87,56 +87,6 @@ export default {
padding-right: 5px !important;
}
.list {
&.scrollbar {
min-height: calc(100vh - 240px);
max-height: calc(100vh - 30px);
overflow-y: auto;
position: sticky;
top: 10px;
}
.item {
display: block;
text-decoration: none;
padding: 13px 15px 10px 15px;
border-radius: 10px;
transition: all ease-in-out 0.15s;
&.disabled {
opacity: 0.3;
}
.info {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
&:hover {
background-color: $highlight-white;
}
&.active {
background-color: #cdf8f4;
}
}
}
.dark {
.list {
.item {
&:hover {
background-color: $dark-bg2;
}
&.active {
background-color: $dark-bg2;
}
}
}
}
.monitorItem {
width: 100%;
}