mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 01:04:05 +00:00
Merge pull request #2709 from chakflying/fix/use-constants
Chore: Use constants instead of int
This commit is contained in:
commit
c699868bb9
1 changed files with 5 additions and 5 deletions
|
@ -4,7 +4,7 @@ const { R } = require("redbean-node");
|
||||||
const apicache = require("../modules/apicache");
|
const apicache = require("../modules/apicache");
|
||||||
const Monitor = require("../model/monitor");
|
const Monitor = require("../model/monitor");
|
||||||
const dayjs = require("dayjs");
|
const dayjs = require("dayjs");
|
||||||
const { UP, MAINTENANCE, DOWN, flipStatus, log } = require("../../src/util");
|
const { UP, MAINTENANCE, DOWN, PENDING, flipStatus, log } = require("../../src/util");
|
||||||
const StatusPage = require("../model/status_page");
|
const StatusPage = require("../model/status_page");
|
||||||
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
const { UptimeKumaServer } = require("../uptime-kuma-server");
|
||||||
const { makeBadge } = require("badge-maker");
|
const { makeBadge } = require("badge-maker");
|
||||||
|
@ -147,19 +147,19 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
|
||||||
|
|
||||||
badgeValues.label = label ?? "";
|
badgeValues.label = label ?? "";
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case DOWN:
|
||||||
badgeValues.color = downColor;
|
badgeValues.color = downColor;
|
||||||
badgeValues.message = downLabel;
|
badgeValues.message = downLabel;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case UP:
|
||||||
badgeValues.color = upColor;
|
badgeValues.color = upColor;
|
||||||
badgeValues.message = upLabel;
|
badgeValues.message = upLabel;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case PENDING:
|
||||||
badgeValues.color = pendingColor;
|
badgeValues.color = pendingColor;
|
||||||
badgeValues.message = pendingLabel;
|
badgeValues.message = pendingLabel;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case MAINTENANCE:
|
||||||
badgeValues.color = maintenanceColor;
|
badgeValues.color = maintenanceColor;
|
||||||
badgeValues.message = maintenanceLabel;
|
badgeValues.message = maintenanceLabel;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue