Add Notes field to client config

This commit is contained in:
Daniel Lundin
2019-07-27 11:01:07 +02:00
parent 0a5b178443
commit 40430182f5
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -27,6 +27,7 @@ type ClientConfig struct {
PrivateKey string
PublicKey string
IP net.IP
Notes string
}
func NewServerConfig(cfgPath string) *ServerConfig {
@@ -92,6 +93,7 @@ func NewClientConfig(ip net.IP) *ClientConfig {
PrivateKey: key.String(),
PublicKey: key.PublicKey().String(),
IP: ip,
Notes: "",
}
return &cfg
+4
View File
@@ -451,6 +451,10 @@ func (s *Server) EditClient(w http.ResponseWriter, r *http.Request, ps httproute
client.Name = cfg.Name
}
if cfg.Notes != "" {
client.Notes = cfg.Notes
}
s.reconfigure()
w.WriteHeader(http.StatusOK)
+6
View File
@@ -61,6 +61,12 @@ margin-top: 1em;
<span class="bmd-help">Friendly name of client.</span>
</div>
<div class="form-group">
<label for="notes" class="bmd-label-floating">Notes</label>
<textarea class="form-control" id="notes" rows="3" bind:value={client.Notes}/>
<span class="bmd-help">Notes about client.</span>
</div>
<button type="submit" class="btn btn-raised btn-primary">Save Changes</button>
</form>
</div>