Skip to content

Commit

Permalink
feat: Update DNS toggle logic in Settings.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Jul 31, 2024
1 parent e5ffc56 commit 040b16c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
7 changes: 0 additions & 7 deletions imageroot/actions/get-configuration/10get
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

import json
import sys
import os
import network
import subprocess

config = json.load(open("config.json"))
if config["interface"] != "" and config["dhcp-server"]["start"] == "" and config["dhcp-server"]["end"] == "":
Expand All @@ -19,10 +17,5 @@ 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

json.dump(config, sys.stdout)
5 changes: 0 additions & 5 deletions imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@
"secondary-server"
]
},
"running": {
"description": "True if dnsmasq is configured",
"type": "boolean"
},
"are_dns_bound": {
"description": "True if DNS servers are bound to the interface",
"type": "boolean"
Expand All @@ -110,7 +106,6 @@
"interface",
"dhcp-server",
"dns-server",
"running",
"are_dns_bound"
]
}
12 changes: 7 additions & 5 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,14 @@
<div class="title-description mg-bottom-xlg">
{{ $t("settings.DNS_description") }}
</div>
<cv-row v-if="are_dns_bound && !dnsEnableField">
<cv-row v-if="are_dns_bound && !dnsEnableField">
<cv-column>
<NsInlineNotification
kind="info"
:title="$t('settings.dns_server_is_running')"
:description="$t('settings.dns_server_is_running_description')"
:description="
$t('settings.dns_server_is_running_description')
"
:showCloseButton="false"
/>
</cv-column>
Expand Down Expand Up @@ -212,7 +214,9 @@
:icon="Save20"
:loading="loading.configureModule"
:disabled="
loading.getConfiguration || loading.configureModule
loading.getConfiguration ||
loading.configureModule ||
(are_dns_bound && !dnsEnableField)
"
>{{ $t("settings.save") }}</NsButton
>
Expand Down Expand Up @@ -262,7 +266,6 @@ export default {
dhcpEndField: "",
dhcpLeaseField: 12,
are_dns_bound: false,
running: false,
dnsEnableField: false,
dnsPrimaryField: "",
dnsSecondaryField: "",
Expand Down Expand Up @@ -420,7 +423,6 @@ export default {
this.dnsPrimaryField = dns_server["primary-server"];
this.dnsSecondaryField = dns_server["secondary-server"];
this.are_dns_bound = config["are_dns_bound"];
this.running = config["running"];
},
validateConfigureModule() {
this.clearErrors(this);
Expand Down

0 comments on commit 040b16c

Please sign in to comment.