IPAM: VLAN-kenttä takaisin vapaaksi numerokentäksi

Dropdown oli liian rajoittava — nyt VLAN-numeron voi kirjoittaa
vapaasti lomakkeeseen verkkojen ja IP:iden kohdalla.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 09:29:15 +02:00
parent 9830ed6b82
commit 5a77c70a7e
2 changed files with 2 additions and 14 deletions

View File

@@ -1017,9 +1017,7 @@
</div>
<div class="form-group">
<label for="ipam-form-vlan">VLAN</label>
<select id="ipam-form-vlan">
<option value="">— Ei VLANia —</option>
</select>
<input type="number" id="ipam-form-vlan" min="1" max="4094" placeholder="esim. 100">
</div>
<div class="form-group">
<label for="ipam-form-nimi">Nimi / Kuvaus</label>

View File

@@ -3209,14 +3209,6 @@ function vlanRefHtml(vlanId) {
return `<strong>${vlanId}</strong>${label ? ` <small style="color:#888;">${label}</small>` : ''}`;
}
// --- VLAN-dropdown populointi ---
function populateVlanDropdown(selectedVlanId) {
const sel = document.getElementById('ipam-form-vlan');
const vlans = ipamData.filter(e => e.tyyppi === 'vlan').sort((a, b) => (a.vlan_id || 0) - (b.vlan_id || 0));
sel.innerHTML = '<option value="">— Ei VLANia —</option>' +
vlans.map(v => `<option value="${v.vlan_id}" ${String(v.vlan_id) === String(selectedVlanId) ? 'selected' : ''}>${v.vlan_id}${esc(v.nimi || 'Nimetön')}</option>`).join('');
}
// --- Asiakas-dropdown populointi ---
async function populateIpamCustomerDropdown(selectedName) {
if (!customers || customers.length === 0) {
@@ -3267,7 +3259,7 @@ async function editIpam(id) {
document.getElementById('ipam-form-nimi').value = e.nimi || '';
document.getElementById('ipam-form-tila').value = e.tila || 'vapaa';
document.getElementById('ipam-form-lisatiedot').value = e.lisatiedot || '';
populateVlanDropdown(e.vlan_id || '');
document.getElementById('ipam-form-vlan').value = e.vlan_id || '';
await populateIpamCustomerDropdown(e.asiakas || '');
await loadIpamSitesDropdown();
document.getElementById('ipam-form-site').value = e.site_id || '';
@@ -3287,7 +3279,6 @@ document.getElementById('btn-add-ipam')?.addEventListener('click', async () => {
document.getElementById('ipam-form-id').value = '';
document.getElementById('ipam-form').reset();
document.getElementById('ipam-form-tyyppi').value = 'subnet';
populateVlanDropdown('');
await populateIpamCustomerDropdown('');
await loadIpamSitesDropdown();
document.getElementById('ipam-modal-title').textContent = 'Lisää verkko / IP';
@@ -3298,7 +3289,6 @@ document.getElementById('btn-add-vlan')?.addEventListener('click', async () => {
document.getElementById('ipam-form-id').value = '';
document.getElementById('ipam-form').reset();
document.getElementById('ipam-form-tyyppi').value = 'vlan';
populateVlanDropdown('');
await populateIpamCustomerDropdown('');
await loadIpamSitesDropdown();
document.getElementById('ipam-modal-title').textContent = 'Lisää VLAN';