Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update DNS toggle logic in Settings.vue
Browse files Browse the repository at this point in the history
stephdl committed Jul 31, 2024
1 parent f420a8a commit 9623b07
Showing 3 changed files with 10 additions and 14 deletions.
6 changes: 1 addition & 5 deletions imageroot/actions/get-configuration/10get
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
14 changes: 7 additions & 7 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
@@ -162,13 +162,13 @@
<div class="title-description mg-bottom-xlg">
{{ $t("settings.DNS_description") }}
</div>
<cv-row v-if="are_dns_bound && !dnsEnableField && !running">
<cv-row v-if="are_dns_bound && !dnsEnableField && !is_dns_enabled">
<cv-column>
<NsInlineNotification
kind="info"
:title="$t('settings.dns_server_is_running')"
:title="$t('settings.dns_server_is_is_dns_enabled')"
:description="
$t('settings.dns_server_is_running_description')
$t('settings.dns_server_is_is_dns_enabled_description')
"
:showCloseButton="false"
/>
@@ -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"
>
<template slot="text-left">{{
@@ -216,7 +216,7 @@
:disabled="
loading.getConfiguration ||
loading.configureModule ||
(are_dns_bound && !dnsEnableField && !running)
(are_dns_bound && !dnsEnableField && !is_dns_enabled)
"
>{{ $t("settings.save") }}</NsButton
>
@@ -266,7 +266,7 @@ export default {
dhcpEndField: "",
dhcpLeaseField: 12,
are_dns_bound: false,
running: false,
is_dns_enabled: false,
dnsEnableField: false,
dnsPrimaryField: "",
dnsSecondaryField: "",
@@ -424,7 +424,7 @@ 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"];
this.is_dns_enabled = config["is_dns_enabled"];
},
validateConfigureModule() {
this.clearErrors(this);

0 comments on commit 9623b07

Please sign in to comment.