IPAM: VLAN-duplikaattivaroitus "jatketaanko silti" -dialogilla

API palauttaa 409 kun VLAN-numero on jo olemassa, frontend
näyttää confirm-dialogin. Käyttäjä voi valita jatkaako vai ei.
IP/verkko-duplikaatti estää edelleen kokonaan (400).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 10:08:34 +02:00
parent 410e46a4fb
commit 6a84231cce
2 changed files with 38 additions and 8 deletions

View File

@@ -3470,7 +3470,22 @@ document.getElementById('ipam-form')?.addEventListener('submit', async (e) => {
};
if (id) data.id = id;
try {
await apiCall('ipam_save', 'POST', data);
const res = await fetch(`${API}?action=ipam_save`, {
method: 'POST', credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
const result = await res.json();
if (res.status === 409 && result.warning) {
if (confirm(result.warning)) {
data.force = true;
await apiCall('ipam_save', 'POST', data);
} else {
return;
}
} else if (!res.ok) {
throw new Error(result.error || 'Virhe');
}
document.getElementById('ipam-modal').style.display = 'none';
loadIpam();
} catch (e) { alert(e.message); }