Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status Page: Display offline monitors at the top of the statuspage. #4689

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -910,5 +910,7 @@
"Allow Long SMS": "Allow Long SMS",
"cellsyntSplitLongMessages": "Split long messages into up to 6 parts. 153 x 6 = 918 characters.",
"max 15 digits": "max 15 digits",
"max 11 alphanumeric characters": "max 11 alphanumeric characters"
"max 11 alphanumeric characters": "max 11 alphanumeric characters",
"offlineMonitor": "Offline Monitor",
"offlineMonitors": "Offline Monitors"
}
46 changes: 46 additions & 0 deletions src/pages/StatusPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,30 @@
</div>
</div>

<div v-if="$root.downMonitors?.length > 0" class="mb-4">
<div class="mb-5">
<h2 class="group-title">
{{ $t($root.downMonitors.length === 1 ? "offlineMonitor" : "offlineMonitors") }}
</h2>

<div class="shadow-box monitor-list mt-4 position-relative">
<div v-for="monitor in $root.downMonitors" :key="monitor.id" class="item">
<div class="row">
<div class="col-9 col-md-8 small-padding">
<div class="info">
<Uptime :monitor="monitor" type="24" :pill="true" />
{{ monitor.name }}
</div>
</div>
<div :key="$root.userHeartbeatBar" class="col-3 col-md-4">
<HeartbeatBar size="mid" :monitor-id="monitor.id" />
</div>
</div>
</div>
</div>
</div>
</div>

<div class="mb-4">
<div v-if="$root.publicGroupList.length === 0 && loadedData" class="text-center">
<!-- 👀 Nothing here, please add a group or a monitor. -->
Expand Down Expand Up @@ -374,6 +398,8 @@ import { getResBaseURL } from "../util-frontend";
import { STATUS_PAGE_ALL_DOWN, STATUS_PAGE_ALL_UP, STATUS_PAGE_MAINTENANCE, STATUS_PAGE_PARTIAL_DOWN, UP, MAINTENANCE } from "../util.ts";
import Tag from "../components/Tag.vue";
import VueMultiselect from "vue-multiselect";
import Uptime from "../components/Uptime.vue";
import HeartbeatBar from "../components/HeartbeatBar.vue";

const toast = useToast();
dayjs.extend(duration);
Expand All @@ -390,6 +416,8 @@ const favicon = new Favico({
export default {

components: {
HeartbeatBar,
Uptime,
PublicGroupList,
ImageCropUpload,
Confirm,
Expand Down Expand Up @@ -768,6 +796,8 @@ export default {
this.$root.heartbeatList = heartbeatList;
this.$root.uptimeList = uptimeList;

this.$root.downMonitors = this.downMonitors();

const heartbeatIds = Object.keys(heartbeatList);
const downMonitors = heartbeatIds.reduce((downMonitorsAmount, currentId) => {
const monitorHeartbeats = heartbeatList[currentId];
Expand All @@ -789,6 +819,22 @@ export default {
}
},

downMonitors() {
let result = [];

for (const id in this.$root.publicMonitorList) {
const monitor = this.$root.publicMonitorList[id];
const heartbeats = this.$root.heartbeatList[monitor.id];
const lastHeartbeat = heartbeats.at(-1);
if (!lastHeartbeat || lastHeartbeat.status !== 0) {
continue;
}
result.push(monitor);
}

return result;
},

/**
* Setup timer to display countdown to refresh
* @returns {void}
Expand Down
Loading