fix: 修复所有页面 loading 动画未正确移除的问题

- chat-debug.js: loadDebugInfo 完成后正确调用 renderDebugInfo 移除 loading
- agents.js: loadAgents 失败时显示错误信息替代 loading
- dashboard.js: renderLogs 无日志时显示提示信息
- memory.js: loadFiles 失败时显示错误信息
- services.js: loadServices/loadRegistry/loadBackups 添加 loading 状态并在完成/失败时移除
- extensions.js: loadCftunnel/loadClawapp 添加 loading 状态并在完成/失败时移除
- models.js: loadConfig 添加 loading 状态并在失败时显示错误
- gateway.js: loadConfig 添加 loading 状态并在失败时显示错误
- logs.js: loadLog/searchLog 使用 loading-text 样式并在失败时显示错误

确保所有异步加载函数都:
1. 开始时显示 loading 状态
2. 成功时渲染数据(自动移除 loading)
3. 失败时显示错误信息(替代 loading)
This commit is contained in:
晴天
2026-03-03 01:46:19 +08:00
parent 53f46d8ef2
commit 05771ffa63
23 changed files with 1014 additions and 124 deletions

View File

@@ -101,6 +101,7 @@ const REGISTRIES = [
async function loadRegistry(page) {
const bar = page.querySelector('#registry-bar')
bar.innerHTML = '<div class="loading-text">加载中...</div>'
try {
const current = await api.getNpmRegistry()
const isPreset = REGISTRIES.some(r => r.value === current)
@@ -130,6 +131,7 @@ async function loadRegistry(page) {
async function loadServices(page) {
const container = page.querySelector('#services-list')
container.innerHTML = '<div class="loading-text">加载中...</div>'
try {
const services = await api.getServicesStatus()
renderServices(container, services)
@@ -198,6 +200,7 @@ function renderServices(container, services) {
async function loadBackups(page) {
const list = page.querySelector('#backup-list')
list.innerHTML = '<div class="loading-text">加载中...</div>'
try {
const backups = await api.listBackups()
renderBackups(list, backups)