Merge pull request #1735 from woooferz/patch-1

Added label to status badge
This commit is contained in:
Louis Lam 2022-08-29 21:19:15 +08:00 committed by GitHub
commit 84fad93555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,6 +136,7 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
const heartbeat = await Monitor.getPreviousHeartbeat(requestedMonitorId); const heartbeat = await Monitor.getPreviousHeartbeat(requestedMonitorId);
const state = overrideValue !== undefined ? overrideValue : heartbeat.status === 1; const state = overrideValue !== undefined ? overrideValue : heartbeat.status === 1;
badgeValues.label = label ? label : "";
badgeValues.color = state ? upColor : downColor; badgeValues.color = state ? upColor : downColor;
badgeValues.message = label ?? state ? upLabel : downLabel; badgeValues.message = label ?? state ? upLabel : downLabel;
} }