From 6131c5588221e2ab3182d0d5873e61c4c2f643ed Mon Sep 17 00:00:00 2001
From: Sora39831 <540587985@qq.com>
Date: Mon, 6 Apr 2026 21:51:33 +0800
Subject: [PATCH] fix dashboard and inbounds load failure states
---
web/html/inbounds.html | 17 ++++++++++++++++-
web/html/index.html | 23 ++++++++++++++++++-----
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/web/html/inbounds.html b/web/html/inbounds.html
index 397a510c..1f37577d 100644
--- a/web/html/inbounds.html
+++ b/web/html/inbounds.html
@@ -19,6 +19,15 @@
+
+
+
+
+
+
@@ -749,6 +758,7 @@
isAdmin: {{if .is_admin}}true{{else}}false{{end}},
currentUsername: {{ printf "%q" .current_username }},
clientEmailOptions: [],
+ loadFailed: false,
},
methods: {
loading(spinning = true) {
@@ -759,16 +769,19 @@
const msg = await HttpUtil.get('/panel/api/inbounds/list');
if (!msg.success) {
this.refreshing = false;
- return;
+ this.loadFailed = true;
+ return false;
}
await this.getLastOnlineMap();
await this.getOnlineUsers();
+ this.loadFailed = false;
this.setInbounds(msg.obj);
setTimeout(() => {
this.refreshing = false;
}, 500);
+ return true;
},
async getOnlineUsers() {
const msg = await HttpUtil.post('/panel/api/inbounds/onlines');
@@ -1633,9 +1646,11 @@
// Initial data fetch
this.getDBInbounds()
.catch((e) => {
+ this.loadFailed = true;
console.error(e);
})
.finally(() => {
+ this.loadingStates.fetched = true;
this.loading(false);
});
diff --git a/web/html/index.html b/web/html/index.html
index 4eb4077e..53c97acb 100644
--- a/web/html/index.html
+++ b/web/html/index.html
@@ -19,6 +19,14 @@
+
+
+
+
+
+
@@ -882,6 +890,7 @@
fetched: false,
spinning: false
},
+ loadFailed: false,
status: new Status(),
cpuHistory: [], // small live widget history
cpuHistoryLong: [], // aggregated points from backend
@@ -905,15 +914,15 @@
try {
const msg = await HttpUtil.get('/panel/api/server/status');
if (msg.success) {
- if (!this.loadingStates.fetched) {
- this.loadingStates.fetched = true;
- }
-
+ this.loadFailed = false;
this.setStatus(msg.obj, true);
+ return true;
}
} catch (e) {
console.error("Failed to get status:", e);
}
+ this.loadFailed = true;
+ return false;
},
setStatus(data) {
this.status = new Status(data);
@@ -1134,7 +1143,11 @@
}
// Initial status fetch
- await this.getStatus();
+ try {
+ await this.getStatus();
+ } finally {
+ this.loadingStates.fetched = true;
+ }
// Setup WebSocket for real-time updates
if (window.wsClient) {