mirror of https://github.com/aredn/aredn.git
Focus newly created items (#1410)
This commit is contained in:
parent
582cbf8acd
commit
0829f6400a
|
@ -477,7 +477,9 @@ if (f) {
|
||||||
Object.assign(o, { name: "", mac: "", noprop: true, reserved: true, leased: false });
|
Object.assign(o, { name: "", mac: "", noprop: true, reserved: true, leased: false });
|
||||||
const item = document.createElement("div");
|
const item = document.createElement("div");
|
||||||
item.innerHTML = `<div class="cols reservation" data-ip="${o.ip}"><div style="white-space:nowrap"><input name="hostname" type="text" placeholder="hostname" value="${o.name}" required> <select class="dhcp-addresses"></select> <input name="mac" type="text" placeholder="mac a‌ddress" required pattern="([0-9a-fA-F][0-9a-fA-F]:){5}[0-9a-fA-F][0-9a-fA-F]" value="${o.mac}"><label> <input type="checkbox" ${o.noprop ? "checked" : ""}></label></div><button>-</button></div>`;
|
item.innerHTML = `<div class="cols reservation" data-ip="${o.ip}"><div style="white-space:nowrap"><input name="hostname" type="text" placeholder="hostname" value="${o.name}" required> <select class="dhcp-addresses"></select> <input name="mac" type="text" placeholder="mac a‌ddress" required pattern="([0-9a-fA-F][0-9a-fA-F]:){5}[0-9a-fA-F][0-9a-fA-F]" value="${o.mac}"><label> <input type="checkbox" ${o.noprop ? "checked" : ""}></label></div><button>-</button></div>`;
|
||||||
htmx.find("#dhcp-reservations").appendChild(item.firstChild);
|
const ic = item.firstChild;
|
||||||
|
htmx.find("#dhcp-reservations").appendChild(ic);
|
||||||
|
htmx.find(ic, "input").focus();
|
||||||
}
|
}
|
||||||
if (!options.find(o => !o.reserved && !o.leased)) {
|
if (!options.find(o => !o.reserved && !o.leased)) {
|
||||||
target.disabled = true;
|
target.disabled = true;
|
||||||
|
|
|
@ -514,6 +514,7 @@ if (f) {
|
||||||
htmx.find(div, "select[name=type]").value = t.type || "";
|
htmx.find(div, "select[name=type]").value = t.type || "";
|
||||||
const ls = htmx.find("#local-services");
|
const ls = htmx.find("#local-services");
|
||||||
ls.insertBefore(div.firstChild, ls.firstChild);
|
ls.insertBefore(div.firstChild, ls.firstChild);
|
||||||
|
htmx.find(ls, "input").focus();
|
||||||
refreshHostSelectors();
|
refreshHostSelectors();
|
||||||
updateServices();
|
updateServices();
|
||||||
}
|
}
|
||||||
|
@ -547,6 +548,7 @@ if (f) {
|
||||||
</div>`;
|
</div>`;
|
||||||
const ha = htmx.find("#host-aliases");
|
const ha = htmx.find("#host-aliases");
|
||||||
ha.insertBefore(div.firstChild, ha.firstChild);
|
ha.insertBefore(div.firstChild, ha.firstChild);
|
||||||
|
htmx.find(ha, "input").focus();
|
||||||
refreshHostSelectors();
|
refreshHostSelectors();
|
||||||
updateAliases();
|
updateAliases();
|
||||||
});
|
});
|
||||||
|
@ -607,7 +609,9 @@ if (f) {
|
||||||
</div>
|
</div>
|
||||||
<button>-</button>
|
<button>-</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
htmx.find("#port-forwards").appendChild(div.firstChild);
|
const pf = htmx.find("#port-forwards");
|
||||||
|
pf.appendChild(div.firstChild);
|
||||||
|
htmx.find(pf, "input[name=port_sports]").focus();
|
||||||
});
|
});
|
||||||
htmx.on("#port-forwards", "change", _ => updatePortForwards());
|
htmx.on("#port-forwards", "change", _ => updatePortForwards());
|
||||||
htmx.on("#port-forwards", "select", _ => updatePortForwards());
|
htmx.on("#port-forwards", "select", _ => updatePortForwards());
|
||||||
|
|
|
@ -471,7 +471,9 @@ uciMesh.foreach("xlink", "interface", x => {
|
||||||
</div>
|
</div>
|
||||||
<button>-</button>
|
<button>-</button>
|
||||||
</div>`;
|
</div>`;
|
||||||
ls.appendChild(div.firstChild);
|
const fc = div.firstChild;
|
||||||
|
ls.appendChild(fc);
|
||||||
|
htmx.find(fc, "input").focus();
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -488,6 +488,7 @@ This value is used by default, but each tunnel may overide it.
|
||||||
</div>`;
|
</div>`;
|
||||||
const t = htmx.find("#tunnels");
|
const t = htmx.find("#tunnels");
|
||||||
t.insertBefore(div.firstChild, t.firstChild);
|
t.insertBefore(div.firstChild, t.firstChild);
|
||||||
|
htmx.find(t, "input").focus();
|
||||||
});
|
});
|
||||||
htmx.on("#tunnels", "change", updateTunnels);
|
htmx.on("#tunnels", "change", updateTunnels);
|
||||||
htmx.on("#tunnels", "click", event => {
|
htmx.on("#tunnels", "click", event => {
|
||||||
|
|
Loading…
Reference in New Issue