mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-04 00:06:18 +00:00
Completed override peer settings
This commit is contained in:
@@ -6,6 +6,7 @@ const props = defineProps(['configuration'])
|
||||
const saving = ref(false)
|
||||
const overridePeerSettings = ref({...props.configuration.Info.OverridePeerSettings})
|
||||
const edited = ref(false)
|
||||
const errorMsg = ref("")
|
||||
|
||||
onMounted(() => {
|
||||
document.querySelectorAll("#editPeerSettingsOverride input").forEach(
|
||||
@@ -21,13 +22,23 @@ const resetForm = () => {
|
||||
}
|
||||
|
||||
const submitForm = async () => {
|
||||
document.querySelectorAll("#editPeerSettingsOverride input").forEach(
|
||||
x => x.classList.remove("is-invalid", "is-valid")
|
||||
)
|
||||
await fetchPost("/api/updateWireguardConfigurationInfo", {
|
||||
Name: props.configuration.Name,
|
||||
Key: "OverridePeerSettings",
|
||||
Value: overridePeerSettings.value
|
||||
}, (res) => {
|
||||
if (res.status){
|
||||
edited.value = false
|
||||
props.configuration.Info.OverridePeerSettings = overridePeerSettings.value
|
||||
document.querySelectorAll("#editPeerSettingsOverride input").forEach(
|
||||
x => x.classList.add("is-valid")
|
||||
)
|
||||
}else{
|
||||
errorMsg.value = res.message
|
||||
document.querySelector(`#override_${res.data}`).classList.add("is-invalid")
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -45,7 +56,7 @@ const submitForm = async () => {
|
||||
</h6>
|
||||
<div class="d-flex gap-2 flex-column">
|
||||
<div>
|
||||
<label for="override_dns" class="form-label">
|
||||
<label for="override_DNS" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="DNS"></LocaleText>
|
||||
</small>
|
||||
@@ -53,10 +64,11 @@ const submitForm = async () => {
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.DNS"
|
||||
id="override_dns">
|
||||
id="override_DNS">
|
||||
<div class="invalid-feedback">{{ errorMsg }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="override_endpoint_allowed_ips" class="form-label">
|
||||
<label for="override_EndpointAllowedIPs" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="Endpoint Allowed IPs"></LocaleText>
|
||||
</small>
|
||||
@@ -64,10 +76,11 @@ const submitForm = async () => {
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.EndpointAllowedIPs"
|
||||
id="override_endpoint_allowed_ips">
|
||||
id="override_EndpointAllowedIPs">
|
||||
<div class="invalid-feedback">{{ errorMsg }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="override_listen_port" class="form-label">
|
||||
<label for="override_ListenPort" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="Listen Port"></LocaleText>
|
||||
</small>
|
||||
@@ -75,10 +88,11 @@ const submitForm = async () => {
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.ListenPort"
|
||||
id="override_listen_port">
|
||||
id="override_ListenPort">
|
||||
<div class="invalid-feedback">{{ errorMsg }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="override_mtu" class="form-label">
|
||||
<label for="override_MTU" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="MTU"></LocaleText>
|
||||
</small>
|
||||
@@ -87,10 +101,11 @@ const submitForm = async () => {
|
||||
class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.MTU"
|
||||
id="override_mtu">
|
||||
id="override_MTU">
|
||||
<div class="invalid-feedback">{{ errorMsg }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="override_peer_remote_endpoint" class="form-label">
|
||||
<label for="override_PeerRemoteEndpoint" class="form-label">
|
||||
<small class="text-muted">
|
||||
<LocaleText t="Peer Remote Endpoint"></LocaleText>
|
||||
</small>
|
||||
@@ -98,7 +113,7 @@ const submitForm = async () => {
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.PeerRemoteEndpoint"
|
||||
id="override_peer_remote_endpoint">
|
||||
id="override_PeerRemoteEndpoint">
|
||||
</div>
|
||||
<div>
|
||||
<label for="override_persistent_keepalive" class="form-label">
|
||||
@@ -109,7 +124,8 @@ const submitForm = async () => {
|
||||
<input type="text" class="form-control form-control-sm rounded-3"
|
||||
:disabled="saving"
|
||||
v-model="overridePeerSettings.PersistentKeepalive"
|
||||
id="override_persistent_keepalive">
|
||||
id="override_PersistentKeepalive">
|
||||
<div class="invalid-feedback">{{ errorMsg }}</div>
|
||||
</div>
|
||||
<div class="d-flex mt-1 gap-2">
|
||||
<button
|
||||
|
Reference in New Issue
Block a user