2021-08-19 06:05:14 -04:00
|
|
|
<template>
|
2021-08-29 14:22:49 -04:00
|
|
|
<div class="shadow-box list mb-3" :class="{ scrollbar: scrollbar }">
|
2021-08-19 06:05:14 -04:00
|
|
|
<div v-if="Object.keys($root.monitorList).length === 0" class="text-center mt-3">
|
2021-08-24 06:26:44 -04:00
|
|
|
{{ $t("No Monitors, please") }} <router-link to="/add">{{ $t("add one") }}</router-link>
|
2021-08-19 06:05:14 -04:00
|
|
|
</div>
|
|
|
|
|
2021-08-19 06:12:52 -04:00
|
|
|
<router-link v-for="(item, index) in sortedMonitorList" :key="index" :to="monitorURL(item.id)" class="item" :class="{ 'disabled': ! item.active }">
|
2021-08-19 06:05:14 -04:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-6 col-md-8 small-padding" :class="{ 'monitorItem': $root.userHeartbeatBar == 'bottom' || $root.userHeartbeatBar == 'none' }">
|
|
|
|
<div class="info">
|
|
|
|
<Uptime :monitor="item" type="24" :pill="true" />
|
|
|
|
{{ item.name }}
|
|
|
|
</div>
|
2021-08-26 06:55:19 -04:00
|
|
|
<div class="tags">
|
|
|
|
<Tag v-for="tag in item.tags" :key="tag" :item="tag" :size="'sm'" />
|
|
|
|
</div>
|
2021-08-19 06:05:14 -04:00
|
|
|
</div>
|
|
|
|
<div v-show="$root.userHeartbeatBar == 'normal'" :key="$root.userHeartbeatBar" class="col-6 col-md-4">
|
|
|
|
<HeartbeatBar size="small" :monitor-id="item.id" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="$root.userHeartbeatBar == 'bottom'" class="row">
|
|
|
|
<div class="col-12">
|
|
|
|
<HeartbeatBar size="small" :monitor-id="item.id" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</router-link>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import HeartbeatBar from "../components/HeartbeatBar.vue";
|
|
|
|
import Uptime from "../components/Uptime.vue";
|
2021-08-26 06:55:19 -04:00
|
|
|
import Tag from "../components/Tag.vue";
|
|
|
|
|
2021-08-19 06:05:14 -04:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Uptime,
|
|
|
|
HeartbeatBar,
|
2021-08-26 06:55:19 -04:00
|
|
|
Tag,
|
2021-08-19 06:05:14 -04:00
|
|
|
},
|
2021-08-29 14:22:49 -04:00
|
|
|
props: {
|
|
|
|
scrollbar: {
|
|
|
|
type: Boolean,
|
|
|
|
},
|
|
|
|
},
|
2021-08-19 06:05:14 -04:00
|
|
|
computed: {
|
|
|
|
sortedMonitorList() {
|
|
|
|
let result = Object.values(this.$root.monitorList);
|
|
|
|
|
|
|
|
result.sort((m1, m2) => {
|
|
|
|
|
|
|
|
if (m1.active !== m2.active) {
|
|
|
|
if (m1.active === 0) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m2.active === 0) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m1.weight !== m2.weight) {
|
|
|
|
if (m1.weight > m2.weight) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m1.weight < m2.weight) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return m1.name.localeCompare(m2.name);
|
|
|
|
})
|
|
|
|
|
|
|
|
return result;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
monitorURL(id) {
|
|
|
|
return "/dashboard/" + id;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "../assets/vars.scss";
|
|
|
|
|
|
|
|
.small-padding {
|
|
|
|
padding-left: 5px !important;
|
|
|
|
padding-right: 5px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.list {
|
2021-08-29 14:22:49 -04:00
|
|
|
&.scrollbar {
|
2021-08-29 18:28:43 -04:00
|
|
|
min-height: calc(100vh - 240px);
|
2021-08-30 01:09:24 -04:00
|
|
|
max-height: calc(100vh - 30px);
|
2021-08-29 18:28:43 -04:00
|
|
|
overflow-y: auto;
|
2021-08-29 14:22:49 -04:00
|
|
|
position: sticky;
|
|
|
|
top: 10px;
|
|
|
|
}
|
2021-08-19 06:05:14 -04:00
|
|
|
|
|
|
|
.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%;
|
|
|
|
}
|
2021-08-26 06:55:19 -04:00
|
|
|
|
|
|
|
.tags {
|
|
|
|
padding-left: 62px;
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
gap: 0;
|
|
|
|
}
|
2021-08-19 06:05:14 -04:00
|
|
|
</style>
|