Laitteiden Tyyppi ja Funktio kentät muutettu dropdown-valikoiksi
Vapaa tekstikenttä → select-dropdown valmiilla vaihtoehdoilla: - Tyyppi: Reititin, Kytkin, Palomuuri, Tukiasema, Palvelin, OLT, ONT, Mediamuunnin, Muu - Funktio: PE/EDGE/CPE Reititin, Core/Aggregaatio/Access-kytkin, WAN GW, WLAN Controller, Asiakaslaite, Muu - Tyyppi-sarake siirretty ennen Funktio-saraketta - setSelectValue helper: lisää puuttuvan option automaattisesti muokatessa vanhaa dataa Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
19
script.js
19
script.js
@@ -2714,8 +2714,8 @@ function renderDevices() {
|
||||
<td><code style="font-size:0.82rem;">${esc(d.hallintaosoite || '-')}</code></td>
|
||||
<td style="font-size:0.85rem;">${esc(d.serial || '-')}</td>
|
||||
<td>${d.site_name ? esc(d.site_name) : '<span style="color:#ccc;">-</span>'}</td>
|
||||
<td>${esc(d.funktio || '-')}</td>
|
||||
<td>${esc(d.tyyppi || '-')}</td>
|
||||
<td>${esc(d.funktio || '-')}</td>
|
||||
<td>${esc(d.malli || '-')}</td>
|
||||
<td style="text-align:center;">${pingIcon}</td>
|
||||
<td class="actions-cell">
|
||||
@@ -2728,6 +2728,19 @@ function renderDevices() {
|
||||
document.getElementById('device-count').textContent = filtered.length + ' laitetta' + (query ? ` (${devicesData.length} yhteensä)` : '');
|
||||
}
|
||||
|
||||
function setSelectValue(selectId, val) {
|
||||
const sel = document.getElementById(selectId);
|
||||
if (!val) { sel.value = ''; return; }
|
||||
const exists = Array.from(sel.options).some(o => o.value === val);
|
||||
if (!exists) {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = val;
|
||||
opt.textContent = val;
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
sel.value = val;
|
||||
}
|
||||
|
||||
async function editDevice(id) {
|
||||
const d = devicesData.find(x => x.id === id);
|
||||
if (!d) return;
|
||||
@@ -2735,8 +2748,8 @@ async function editDevice(id) {
|
||||
document.getElementById('device-form-nimi').value = d.nimi || '';
|
||||
document.getElementById('device-form-hallintaosoite').value = d.hallintaosoite || '';
|
||||
document.getElementById('device-form-serial').value = d.serial || '';
|
||||
document.getElementById('device-form-funktio').value = d.funktio || '';
|
||||
document.getElementById('device-form-tyyppi').value = d.tyyppi || '';
|
||||
setSelectValue('device-form-tyyppi', d.tyyppi || '');
|
||||
setSelectValue('device-form-funktio', d.funktio || '');
|
||||
document.getElementById('device-form-malli').value = d.malli || '';
|
||||
document.getElementById('device-form-ping-check').checked = d.ping_check || false;
|
||||
document.getElementById('device-form-lisatiedot').value = d.lisatiedot || '';
|
||||
|
||||
Reference in New Issue
Block a user