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:
@@ -1017,9 +1017,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ipam-form-vlan">VLAN</label>
|
<label for="ipam-form-vlan">VLAN</label>
|
||||||
<select id="ipam-form-vlan">
|
<input type="number" id="ipam-form-vlan" min="1" max="4094" placeholder="esim. 100">
|
||||||
<option value="">— Ei VLANia —</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="ipam-form-nimi">Nimi / Kuvaus</label>
|
<label for="ipam-form-nimi">Nimi / Kuvaus</label>
|
||||||
|
|||||||
12
script.js
12
script.js
@@ -3209,14 +3209,6 @@ function vlanRefHtml(vlanId) {
|
|||||||
return `<strong>${vlanId}</strong>${label ? ` <small style="color:#888;">${label}</small>` : ''}`;
|
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 ---
|
// --- Asiakas-dropdown populointi ---
|
||||||
async function populateIpamCustomerDropdown(selectedName) {
|
async function populateIpamCustomerDropdown(selectedName) {
|
||||||
if (!customers || customers.length === 0) {
|
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-nimi').value = e.nimi || '';
|
||||||
document.getElementById('ipam-form-tila').value = e.tila || 'vapaa';
|
document.getElementById('ipam-form-tila').value = e.tila || 'vapaa';
|
||||||
document.getElementById('ipam-form-lisatiedot').value = e.lisatiedot || '';
|
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 populateIpamCustomerDropdown(e.asiakas || '');
|
||||||
await loadIpamSitesDropdown();
|
await loadIpamSitesDropdown();
|
||||||
document.getElementById('ipam-form-site').value = e.site_id || '';
|
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-id').value = '';
|
||||||
document.getElementById('ipam-form').reset();
|
document.getElementById('ipam-form').reset();
|
||||||
document.getElementById('ipam-form-tyyppi').value = 'subnet';
|
document.getElementById('ipam-form-tyyppi').value = 'subnet';
|
||||||
populateVlanDropdown('');
|
|
||||||
await populateIpamCustomerDropdown('');
|
await populateIpamCustomerDropdown('');
|
||||||
await loadIpamSitesDropdown();
|
await loadIpamSitesDropdown();
|
||||||
document.getElementById('ipam-modal-title').textContent = 'Lisää verkko / IP';
|
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-id').value = '';
|
||||||
document.getElementById('ipam-form').reset();
|
document.getElementById('ipam-form').reset();
|
||||||
document.getElementById('ipam-form-tyyppi').value = 'vlan';
|
document.getElementById('ipam-form-tyyppi').value = 'vlan';
|
||||||
populateVlanDropdown('');
|
|
||||||
await populateIpamCustomerDropdown('');
|
await populateIpamCustomerDropdown('');
|
||||||
await loadIpamSitesDropdown();
|
await loadIpamSitesDropdown();
|
||||||
document.getElementById('ipam-modal-title').textContent = 'Lisää VLAN';
|
document.getElementById('ipam-modal-title').textContent = 'Lisää VLAN';
|
||||||
|
|||||||
Reference in New Issue
Block a user