Add new grade

pull/40/head
ChrisKim 2022-11-28 20:04:14 +08:00
parent 25e5229498
commit 12284bcd22
No known key found for this signature in database
GPG Key ID: 9D08101BC21C3016
2 changed files with 8 additions and 0 deletions

View File

@ -127,6 +127,9 @@ a {
&.ok { &.ok {
background-color: $primary-color; background-color: $primary-color;
} }
&.good {
background-color: #ffa500;
}
&.down { &.down {
background-color: #de484a; background-color: #de484a;
} }

View File

@ -8,6 +8,7 @@ function UptimeRobot({ apikey }) {
const status = { const status = {
ok: '正常', ok: '正常',
good: '一般',
down: '无法访问', down: '无法访问',
unknow: '未知' unknow: '未知'
}; };
@ -35,6 +36,10 @@ function UptimeRobot({ apikey }) {
status = 'ok'; status = 'ok';
text += `可用率 ${formatNumber(data.uptime)}%`; text += `可用率 ${formatNumber(data.uptime)}%`;
} }
else if (data.uptime >= 98) {
status = 'good';
text += `故障 ${data.down.times} 次,累计 ${formatDuration(data.down.duration)},可用率 ${formatNumber(data.uptime)}%`;
}
else if (data.uptime <= 0 && data.down.times === 0) { else if (data.uptime <= 0 && data.down.times === 0) {
status = 'none'; status = 'none';
text += '无数据'; text += '无数据';