mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-02 19:24:04 +00:00
Fix: Add support for pending in badges
This commit is contained in:
parent
21b418230c
commit
0ed3dd5e4f
2 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ const badgeConstants = {
|
||||||
naColor: "#999",
|
naColor: "#999",
|
||||||
defaultUpColor: "#66c20a",
|
defaultUpColor: "#66c20a",
|
||||||
defaultDownColor: "#c2290a",
|
defaultDownColor: "#c2290a",
|
||||||
|
defaultPendingColor: "#f8a306",
|
||||||
defaultMaintenanceColor: "#1747f5",
|
defaultMaintenanceColor: "#1747f5",
|
||||||
defaultPingColor: "blue", // as defined by badge-maker / shields.io
|
defaultPingColor: "blue", // as defined by badge-maker / shields.io
|
||||||
defaultStyle: "flat",
|
defaultStyle: "flat",
|
||||||
|
|
|
@ -111,9 +111,11 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
|
||||||
label,
|
label,
|
||||||
upLabel = "Up",
|
upLabel = "Up",
|
||||||
downLabel = "Down",
|
downLabel = "Down",
|
||||||
|
pendingLabel = "Pending",
|
||||||
maintenanceLabel = "Maintenance",
|
maintenanceLabel = "Maintenance",
|
||||||
upColor = badgeConstants.defaultUpColor,
|
upColor = badgeConstants.defaultUpColor,
|
||||||
downColor = badgeConstants.defaultDownColor,
|
downColor = badgeConstants.defaultDownColor,
|
||||||
|
pendingColor = badgeConstants.defaultPendingColor,
|
||||||
maintenanceColor = badgeConstants.defaultMaintenanceColor,
|
maintenanceColor = badgeConstants.defaultMaintenanceColor,
|
||||||
style = badgeConstants.defaultStyle,
|
style = badgeConstants.defaultStyle,
|
||||||
value, // for demo purpose only
|
value, // for demo purpose only
|
||||||
|
@ -153,6 +155,10 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
|
||||||
badgeValues.color = upColor;
|
badgeValues.color = upColor;
|
||||||
badgeValues.message = upLabel;
|
badgeValues.message = upLabel;
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
badgeValues.color = pendingColor;
|
||||||
|
badgeValues.message = pendingLabel;
|
||||||
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
badgeValues.color = maintenanceColor;
|
badgeValues.color = maintenanceColor;
|
||||||
badgeValues.message = maintenanceLabel;
|
badgeValues.message = maintenanceLabel;
|
||||||
|
|
Loading…
Reference in a new issue