From 7499640d63935ffd966b429ae95611d551f211f1 Mon Sep 17 00:00:00 2001 From: Ben Francis Date: Wed, 16 Oct 2024 22:08:49 +0100 Subject: [PATCH] Show static IP settings in the UI --- static/js/views/settings.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/static/js/views/settings.js b/static/js/views/settings.js index 556587903..3d76ee083 100644 --- a/static/js/views/settings.js +++ b/static/js/views/settings.js @@ -874,9 +874,22 @@ const SettingsScreen = { API.getLanSettings() .then((body) => { this.elements.network.client.ethernet.mode.value = body.mode || 'dhcp'; - this.elements.network.client.ethernet.ip.value = body.ipdaddr || ''; - this.elements.network.client.ethernet.netmask.value = body.netmask || '255.255.255.0'; - this.elements.network.client.ethernet.gateway.value = body.gateway || ''; + this.elements.network.client.ethernet.ip.value = body.options.ipaddr || ''; + this.elements.network.client.ethernet.netmask.value = body.options.netmask || '255.255.255.0'; + this.elements.network.client.ethernet.gateway.value = body.options.gateway || ''; + const ethernetEls = [ + this.elements.network.client.ethernet.ipLabel, + this.elements.network.client.ethernet.ip, + this.elements.network.client.ethernet.netmaskLabel, + this.elements.network.client.ethernet.netmask, + this.elements.network.client.ethernet.gatewayLabel, + this.elements.network.client.ethernet.gateway, + ]; + if (body.mode === 'static') { + ethernetEls.forEach((el) => el.classList.remove('hidden')); + } else { + ethernetEls.forEach((el) => el.classList.add('hidden')); + } }) .catch((e) => { console.error(`Failed to get ethernet config: ${e}`);