Improve connectivity test

This commit is contained in:
jason5ng32 committed 2023-12-06 16:13:30 +08:00
1 parent 9adf7437bd
commit d9a49f2bc8
2 files changed
+20 -12

No files matched your search

+3 -2
View File
@@ -13,7 +13,8 @@
<!-- Bootstrap CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.2/font/bootstrap-icons.min.css">
<link rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.2/font/bootstrap-icons.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/3.5.0/css/flag-icon.min.css">
<link rel="icon" href="favicon.ico">
<link rel="stylesheet" href="res/style.css">
@@ -177,7 +178,7 @@
<div class="availability-test-section mb-4">
<div class="jn-title2">
<h2 id="scrollspyHeading2" :class="{'mobile-h2' : isMobile }">🚦 {{currentTexts.connectivity.Title}}</h2>
<button @click="checkAllConnectivity(0)"
<button @click="checkAllConnectivity(false)"
:class="['btn', isDarkMode ? 'btn-dark dark-mode-refresh' : 'btn-light']"><i
class="bi bi-arrow-clockwise"></i></button>
</div>
+17 -10
View File
@@ -268,15 +268,22 @@ new Vue({
checkAllConnectivity(isAlertToShow) {
let totalTests = connectivityTests.length;
let successCount = 0;
let completedCount = 0;
const onTestComplete = (isSuccess) => {
if (isSuccess) successCount++;
if (successCount === totalTests) {
// 所有测试成功
this.updateConnectivityAlert(true, "success");
} else if (connectivityTests.every(test => test.status !== "")) {
// 所有测试完成,但有失败的测试
this.updateConnectivityAlert(true, "error");
if (isSuccess) {
successCount++;
}
completedCount++;
// 只有当所有测试都完成时才做出最终判断
if (completedCount === totalTests) {
this.alertToShow = true;
if (successCount === totalTests) {
this.updateConnectivityAlert(true, "success");
} else {
this.updateConnectivityAlert(true, "error");
}
}
};
@@ -708,7 +715,7 @@ new Vue({
refreshEverything() {
this.checkAllIPs();
setTimeout(() => {
this.checkAllConnectivity(0);
this.checkAllConnectivity(false);
}, 2000);
setTimeout(() => {
this.checkAllWebRTC();
@@ -758,7 +765,7 @@ new Vue({
this.PWAColor();
this.checkAllIPs();
setTimeout(() => {
this.checkAllConnectivity(1);
this.checkAllConnectivity(true);
}, 2500);
setTimeout(() => {
this.checkAllWebRTC();
@@ -767,7 +774,7 @@ new Vue({
this.checkAllDNSLeakTest();
}, 2500);
setTimeout(() => {
this.checkAllConnectivity(0);
this.checkAllConnectivity(false);
}, 6000);
setTimeout(() => {
this.isInfosLoaded = true;