Gear dialog: do not shadow window.location
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -578,11 +578,11 @@
|
|||||||
b.querySelector("#dcancel").onclick = closeDialog;
|
b.querySelector("#dcancel").onclick = closeDialog;
|
||||||
b.querySelector("#dok").onclick = async () => {
|
b.querySelector("#dok").onclick = async () => {
|
||||||
const name = b.querySelector("#gname").value.trim(), kind = b.querySelector("#gkind").value, address = b.querySelector("#gaddr").value.trim();
|
const name = b.querySelector("#gname").value.trim(), kind = b.querySelector("#gkind").value, address = b.querySelector("#gaddr").value.trim();
|
||||||
const location = b.querySelector("#gloc").value.trim(), notes = b.querySelector("#gnotes").value.trim(), watch = b.querySelector("#gwatch").value, keyId = b.querySelector("#gkey").value;
|
const where = b.querySelector("#gloc").value.trim(), notes = b.querySelector("#gnotes").value.trim(), watch = b.querySelector("#gwatch").value, keyId = b.querySelector("#gkey").value;
|
||||||
if (!name) return alertBox("A name, please.");
|
if (!name) return alertBox("A name, please.");
|
||||||
if (watch === "ping" && !/^[\w.:-]+$/.test(address)) return alertBox("To ping it, give it an address.");
|
if (watch === "ping" && !/^[\w.:-]+$/.test(address)) return alertBox("To ping it, give it an address.");
|
||||||
if (!ensureDraft()) return;
|
if (!ensureDraft()) return;
|
||||||
try { const r = await post("/api/gear", { name, kind, address, location, notes }); state.draft = r.draft; } catch (e) { return alertBox(e.message); }
|
try { const r = await post("/api/gear", { name, kind, address, location: where, notes }); state.draft = r.draft; } catch (e) { return alertBox(e.message); }
|
||||||
if (watch) {
|
if (watch) {
|
||||||
const d = state.draft.config;
|
const d = state.draft.config;
|
||||||
const chk = watch === "ping" ? { type: "ping", host: address, name: tagOf(name) } : { type: "conn", conn: watch.slice(5), fix: "restart-connection" };
|
const chk = watch === "ping" ? { type: "ping", host: address, name: tagOf(name) } : { type: "conn", conn: watch.slice(5), fix: "restart-connection" };
|
||||||
|
|||||||
Reference in New Issue
Block a user