From 0ed3dd5e4fd8e33ef2d1d579e1b9d882ce4f09c3 Mon Sep 17 00:00:00 2001 From: Nelson Chan Date: Thu, 12 Jan 2023 04:14:46 +0800 Subject: [PATCH] Fix: Add support for pending in badges --- server/config.js | 1 + server/routers/api-router.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/server/config.js b/server/config.js index 398ddbb10..0523e7078 100644 --- a/server/config.js +++ b/server/config.js @@ -5,6 +5,7 @@ const badgeConstants = { naColor: "#999", defaultUpColor: "#66c20a", defaultDownColor: "#c2290a", + defaultPendingColor: "#f8a306", defaultMaintenanceColor: "#1747f5", defaultPingColor: "blue", // as defined by badge-maker / shields.io defaultStyle: "flat", diff --git a/server/routers/api-router.js b/server/routers/api-router.js index f2e0874e2..6001d58e0 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -111,9 +111,11 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response label, upLabel = "Up", downLabel = "Down", + pendingLabel = "Pending", maintenanceLabel = "Maintenance", upColor = badgeConstants.defaultUpColor, downColor = badgeConstants.defaultDownColor, + pendingColor = badgeConstants.defaultPendingColor, maintenanceColor = badgeConstants.defaultMaintenanceColor, style = badgeConstants.defaultStyle, 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.message = upLabel; break; + case 2: + badgeValues.color = pendingColor; + badgeValues.message = pendingLabel; + break; case 3: badgeValues.color = maintenanceColor; badgeValues.message = maintenanceLabel;