From 9623b07d26bba0e65a4a1225d203778b10c9948d Mon Sep 17 00:00:00 2001 From: Stephane de Labrusse Date: Wed, 31 Jul 2024 11:31:19 +0200 Subject: [PATCH] feat: Update DNS toggle logic in Settings.vue --- imageroot/actions/get-configuration/10get | 6 +----- .../actions/get-configuration/validate-output.json | 4 ++-- ui/src/views/Settings.vue | 14 +++++++------- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/imageroot/actions/get-configuration/10get b/imageroot/actions/get-configuration/10get index 3b41efe..1a54d11 100755 --- a/imageroot/actions/get-configuration/10get +++ b/imageroot/actions/get-configuration/10get @@ -19,10 +19,6 @@ if config["interface"] != "" and config["dhcp-server"]["start"] == "" and config config["dhcp-server"]["end"] = str(interface["end"]) config["are_dns_bound"] = network.are_ports_53_bound() -try: - p = subprocess.run(['systemctl', 'is-active', '-q', os.environ['MODULE_ID']]) - config['running'] = (p.returncode == 0) -except: - config['running'] = False +config['is_dns_enabled'] = config["dns-server"]["enabled"] json.dump(config, sys.stdout) diff --git a/imageroot/actions/get-configuration/validate-output.json b/imageroot/actions/get-configuration/validate-output.json index 59813a5..ecbf133 100644 --- a/imageroot/actions/get-configuration/validate-output.json +++ b/imageroot/actions/get-configuration/validate-output.json @@ -97,7 +97,7 @@ "secondary-server" ] }, - "running": { + "is_dns_enabled": { "description": "True if dnsmasq is configured", "type": "boolean" }, @@ -110,7 +110,7 @@ "interface", "dhcp-server", "dns-server", - "running", + "is_dns_enabled", "are_dns_bound" ] } diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index 5ce780d..08d13fb 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -162,13 +162,13 @@
{{ $t("settings.DNS_description") }}
- + @@ -179,7 +179,7 @@ v-model="dnsEnableField" value="dnsEnableField" formItem - :disabled="are_dns_bound && !dnsEnableField && !running" + :disabled="are_dns_bound && !dnsEnableField && !is_dns_enabled" ref="dnsEnableField" >