WIP: support different interface types: server, client and custom. Show different UI for each type.

This commit is contained in:
Christoph Haas
2021-04-03 19:11:05 +02:00
parent 116a86c5e7
commit aa17303cec
8 changed files with 396 additions and 124 deletions

View File

@@ -36,6 +36,12 @@
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
<input type="hidden" name="type" value="server">
<h3>Server's interface configuration</h3>
<div class="form-row">
<div class="form-group col-md-12">
<label for="server_DisplayName">Display Name</label>
<input type="text" name="displayname" class="form-control" id="server_DisplayName" value="{{.Device.DisplayName}}">
</div>
</div>
{{if .EditableKeys}}
<div class="form-row">
<div class="form-group required col-md-12">
@@ -134,6 +140,12 @@
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
<input type="hidden" name="type" value="client">
<h3>Client's interface configuration</h3>
<div class="form-row">
<div class="form-group col-md-12">
<label for="client_DisplayName">Display Name</label>
<input type="text" name="displayname" class="form-control" id="client_DisplayName" value="{{.Device.DisplayName}}">
</div>
</div>
{{if .EditableKeys}}
<div class="form-row">
<div class="form-group required col-md-12">
@@ -219,6 +231,12 @@
<input type="hidden" name="device" value="{{.Device.DeviceName}}">
<input type="hidden" name="type" value="custom">
<h3>Custom interface configuration</h3>
<div class="form-row">
<div class="form-group col-md-12">
<label for="custom_DisplayName">Display Name</label>
<input type="text" name="displayname" class="form-control" id="custom_DisplayName" value="{{.Device.DisplayName}}">
</div>
</div>
{{if .EditableKeys}}
<div class="form-row">
<div class="form-group required col-md-12">
@@ -257,8 +275,12 @@
<input type="number" name="mtu" class="form-control" id="custom_MTU" placeholder="0" value="{{.Device.Mtu}}">
</div>
<div class="form-group col-md-6">
<label for="custom_SaveConfig">Save Configuration</label>
<input type="number" name="saveconfig" class="form-control" id="custom_SaveConfig" placeholder="0" value="{{.Device.SaveConfig}}">
<div class="custom-control custom-switch">
<label class="custom-control-label" for="custom_SaveConfig">
Save Configuration (if Interface was edited via WireGuard configuration tool)
</label>
<input class="custom-control-input" name="saveconfig" type="checkbox" value="true" id="custom_SaveConfig" {{if .Peer.SaveConfig}}checked{{end}}>
</div>
</div>
</div>
<div class="form-row">