edit: add modal asking user if they really want to delete a container
This commit is contained in:
parent
b2302f8067
commit
956b7ee056
12
app.js
12
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', () => {
|
||||
|
19
index.html
19
index.html
@ -267,6 +267,25 @@
|
||||
<div id="terminal-resize-handle"></div> <!-- Resize handle -->
|
||||
</div>
|
||||
|
||||
<!-- Delete Confirmation Modal -->
|
||||
<div class="modal fade" id="deleteModal" tabindex="-1" aria-labelledby="deleteModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content bg-dark text-white">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="deleteModalLabel">Confirm Deletion</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Are you sure you want to delete this container?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" id="confirm-delete-btn" class="btn btn-danger">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="tray"></div>
|
||||
|
||||
<!-- xterm.js -->
|
||||
|
Loading…
Reference in New Issue
Block a user