move instance management and firewall help into modal windows

This commit is contained in:
CPTN Cosmo 2026-04-18 17:10:26 +02:00
parent 76565477e7
commit 77c1c3114f
3 changed files with 185 additions and 64 deletions

View file

@ -15,10 +15,30 @@ document.addEventListener('DOMContentLoaded', () => {
const createUserForm = document.getElementById('create-user-form');
const changePasswordForm = document.getElementById('change-password-form');
const profileSuccess = document.getElementById('profile-success');
const helpBtn = document.getElementById('help-btn');
const helpModal = document.getElementById('help-modal');
const addInstanceModal = document.getElementById('add-instance-modal');
const showAddBtn = document.getElementById('show-add-btn');
let config = { firewall_host_ip: null };
let currentUser = null;
const openModal = (modal) => modal.classList.add('active');
const closeModal = (modal) => modal.classList.remove('active');
document.querySelectorAll('.btn-close').forEach(btn => {
btn.addEventListener('click', () => {
closeModal(btn.closest('.modal'));
});
});
window.addEventListener('click', (e) => {
if (e.target.classList.contains('modal')) closeModal(e.target);
});
helpBtn.addEventListener('click', () => openModal(helpModal));
showAddBtn.addEventListener('click', () => openModal(addInstanceModal));
const showLogin = () => {
loginOverlay.style.display = 'flex';
logoutBtn.style.display = 'none';
@ -158,6 +178,7 @@ document.addEventListener('DOMContentLoaded', () => {
if (res.ok) {
addForm.reset();
document.getElementById('port').value = "4646";
closeModal(addInstanceModal);
fetchInstances();
} else if (res.status === 401) {
showLogin();