This commit is contained in:
Raven Scott 2024-12-02 03:51:17 -05:00
parent ffb51d0d72
commit 72e164fe34
2 changed files with 13 additions and 3 deletions

10
app.js
View File

@ -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.`);

View File

@ -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();