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:
17
script.js
17
script.js
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user