feat: adjust the delay display interval and color, close #836

This commit is contained in:
GyDi
2023-10-29 23:01:05 +08:00
parent 9888f2a322
commit fbf230cd01
3 changed files with 19 additions and 16 deletions

View File

@@ -107,6 +107,21 @@ class DelayManager {
for (let i = 0; i < concurrency; ++i) help();
});
}
formatDelay(delay: number) {
if (delay < 0) return "-";
if (delay > 1e5) return "Error";
if (delay >= 10000) return "Timeout"; // 10s
return `${delay}`;
}
formatDelayColor(delay: number) {
if (delay <= 0) return "text.secondary";
if (delay >= 10000) return "error.main";
if (delay > 500) return "warning.main";
if (delay > 100) return "text.secondary";
return "success.main";
}
}
export default new DelayManager();