From 956b7ee056cd65f79c285e6c5ae5e0d78163ecd1 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Fri, 29 Nov 2024 20:17:53 -0500 Subject: [PATCH] edit: add modal asking user if they really want to delete a container --- app.js | 12 ++++++++++-- index.html | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 01cdc5e..86540a6 100644 --- a/app.js +++ b/app.js @@ -341,7 +341,6 @@ function renderContainers(containers) { }); } -// Add event listeners to action buttons function addActionListeners(row, container) { const startBtn = row.querySelector('.action-start'); const stopBtn = row.querySelector('.action-stop'); @@ -357,7 +356,16 @@ function addActionListeners(row, container) { }); removeBtn.addEventListener('click', () => { - sendCommand('removeContainer', { id: container.Id }); + // Show the delete confirmation modal + const deleteModal = new bootstrap.Modal(document.getElementById('deleteModal')); + deleteModal.show(); + + // Handle confirmation button + const confirmDeleteBtn = document.getElementById('confirm-delete-btn'); + confirmDeleteBtn.onclick = () => { + sendCommand('removeContainer', { id: container.Id }); // Remove the container + deleteModal.hide(); // Close the modal + }; }); terminalBtn.addEventListener('click', () => { diff --git a/index.html b/index.html index 928804c..f500631 100644 --- a/index.html +++ b/index.html @@ -267,6 +267,25 @@
+ + +