From 72e164fe343a8b5ede523bc7d398e2fe5af72902 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Mon, 2 Dec 2024 03:51:17 -0500 Subject: [PATCH] better --- app.js | 10 ++++++++++ libs/templateDeploy.js | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 917ba6c..10202db 100644 --- a/app.js +++ b/app.js @@ -108,6 +108,7 @@ function waitForPeerResponse(expectedMessageFragment, timeout = 900000) { window.handlePeerResponse = (response) => { console.log(`[DEBUG] Received response: ${JSON.stringify(response)}`); + console.log(response.message) if (response && response.success && response.message.includes(expectedMessageFragment)) { console.log(`[DEBUG] Expected response received: ${response.message}`); resolve(response); @@ -310,7 +311,16 @@ function handlePeerData(data, topicId, peer) { // Parse the incoming data const response = JSON.parse(data.toString()); console.log(`[DEBUG] Received data from peer (topic: ${topicId}): ${JSON.stringify(response)}`); + console.log(response.message) + if (response.success && response.message.includes && response.message.includes('deployed successfully')) { + console.log(`[INFO] Template deployed successfully: ${response.message}`); + hideStatusIndicator(); + startStatsInterval(); // Restart stats polling + showAlert('success', response.message); + closeAllModals(); // Close all modals after successful deployment + hideStatusIndicator(); + } // Ensure the data is for the active connection if (!connections[topicId]) { console.warn(`[WARN] No connection found for topic: ${topicId}. Ignoring data.`); diff --git a/libs/templateDeploy.js b/libs/templateDeploy.js index fb522aa..36f9ed5 100644 --- a/libs/templateDeploy.js +++ b/libs/templateDeploy.js @@ -222,8 +222,8 @@ deployForm.addEventListener('submit', async (e) => { console.log('[DEBUG] Deploy payload:', deployPayload); try { - // showStatusIndicator('Deploying container...'); - + showStatusIndicator('Deploying container...'); + closeAllModals(); // Send the deployment request await deployDockerContainer(deployPayload); @@ -235,8 +235,8 @@ deployForm.addEventListener('submit', async (e) => { console.log('[INFO] Deployment success:', successResponse); hideStatusIndicator(); - closeAllModals(); showAlert('success', successResponse.message); + startStatsInterval(); } catch (error) { console.error('[ERROR] Failed to deploy container:', error.message); hideStatusIndicator();