MCPcopy Create free account
hub / github.com/Tong89/smartNode / refreshAll

Function refreshAll

frontend/app.js:345–387  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

343 },
344
345 async refreshAll() {
346 if (this.refreshing) return;
347 this.refreshing = true;
348 try {
349 const [health, data, info, status, utilization, timeline] = await Promise.allSettled([
350 this.fetchJson('/api/health'),
351 this.fetchJson('/api/data'),
352 this.fetchJson('/api/system_info'),
353 this.fetchJson('/api/resource_status'),
354 this.fetchJson('/api/resource_utilization'),
355 this.fetchJson('/api/resource_timeline'),
356 ]);
357
358 this.backendOnline = health.status === 'fulfilled';
359
360 if (data.status === 'fulfilled') {
361 this.systemData = data.value || {};
362 this.updateScene();
363 }
364
365 if (info.status === 'fulfilled') {
366 this.systemInfo = info.value || {};
367 this.syncResourceForm();
368 }
369
370 if (status.status === 'fulfilled') {
371 this.resourceStatus = status.value || {};
372 }
373
374 if (utilization.status === 'fulfilled') {
375 this.resourceUtilization = utilization.value || {};
376 }
377
378 if (timeline.status === 'fulfilled') {
379 this.resourceTimeline = timeline.value || null;
380 }
381 } catch (error) {
382 this.backendOnline = false;
383 this.setNotice(error.message || '刷新失败', 'error');
384 } finally {
385 this.refreshing = false;
386 }
387 },
388
389 // ── SSE 实时推送 ─────────────────────────────────────────────
390

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected