From b684ca9205bdbdecea297628f593db0027ffb7ef Mon Sep 17 00:00:00 2001 From: "courtmanr@gmail.com" Date: Fri, 30 May 2025 11:49:11 +0100 Subject: [PATCH] fix: improve configuration readiness detection in setup flow - Add system info to health endpoint including configPlaceholder status - Update setup page to check correct health properties - Include hasData and clientsInitialized flags for better readiness detection This ensures the 'Continue to Pulse' button appears when the server is actually ready with data, not just when it times out. --- server/index.js | 7 +++++++ src/public/setup.html | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/server/index.js b/server/index.js index 40b38cc76..3c40d158b 100644 --- a/server/index.js +++ b/server/index.js @@ -167,6 +167,13 @@ app.get('/healthz', (req, res) => { app.get('/api/health', (req, res) => { try { const healthSummary = stateManager.getHealthSummary(); + // Add system info including placeholder status + const state = stateManager.getState(); + healthSummary.system = { + configPlaceholder: state.isConfigPlaceholder || false, + hasData: stateManager.hasData(), + clientsInitialized: Object.keys(global.pulseApiClients?.apiClients || {}).length > 0 + }; res.json(healthSummary); } catch (error) { console.error("Error in /api/health:", error); diff --git a/src/public/setup.html b/src/public/setup.html index 013816bec..7132b81f6 100644 --- a/src/public/setup.html +++ b/src/public/setup.html @@ -540,8 +540,8 @@ console.log('Health check response:', health); // Check if the server has successfully loaded configuration - // Look for signs that API clients are initialized and not in placeholder mode - if (health.system && health.system.configPlaceholder === false) { + // Look for overall health and recent activity + if (health.overall === 'healthy' && health.lastUpdate && health.connections && health.connections.total > 0) { showSuccess('Configuration applied successfully!', true, false); // Re-enable the save button