Disable reservations; subnet enable/disable buttons; page-head CSS fix
release / release (push) Successful in 5m53s
release / release (push) Successful in 5m53s
- A disabled reservation is kept but ignored: the client gets a pool address like any other (steward reservation disable|enable, buttons and a checkbox in the web UI). Schema migration 3. - Subnets get Disable/Enable buttons on their page and in the list. - A rule left without its selector in style.css broke the page heading's layout, so the New ... buttons sat cramped under the description. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b3f0f764c
commit
6ad1bb9a0d
21 files changed
+165
-37
No files matched your search
+31
-2
@@ -330,7 +330,7 @@ func reservationCmd() *cobra.Command {
|
||||
return err
|
||||
}
|
||||
return output(rs, func(w io.Writer) {
|
||||
fmt.Fprintln(w, "ID\tIP\tMAC / CLIENT ID\tHOSTNAME\tSUBNET\tLEASE\tCOMMENT")
|
||||
fmt.Fprintln(w, "ID\tIP\tMAC / CLIENT ID\tHOSTNAME\tSUBNET\tLEASE\tSTATE\tCOMMENT")
|
||||
for _, r := range rs {
|
||||
who := r.MAC
|
||||
if r.ClientID != "" {
|
||||
@@ -340,7 +340,11 @@ func reservationCmd() *cobra.Command {
|
||||
if r.Lease != nil {
|
||||
lease = "until " + r.Lease.End.Local().Format("Jan 2 15:04")
|
||||
}
|
||||
fmt.Fprintf(w, "%d\t%s\t%s\t%s\t%s\t%s\t%s\n", r.ID, r.IP, who, orDash(r.Hostname), orDash(r.SubnetName), lease, r.Comment)
|
||||
state := "on"
|
||||
if r.Disabled {
|
||||
state = "disabled"
|
||||
}
|
||||
fmt.Fprintf(w, "%d\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", r.ID, r.IP, who, orDash(r.Hostname), orDash(r.SubnetName), lease, state, r.Comment)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -374,12 +378,37 @@ func reservationCmd() *cobra.Command {
|
||||
} else {
|
||||
fmt.Fprintln(w, "Lease:\tnone now")
|
||||
}
|
||||
if r.Disabled {
|
||||
fmt.Fprintln(w, "State:\tdisabled (ignored: the client gets a pool address like any other)")
|
||||
}
|
||||
if r.Comment != "" {
|
||||
fmt.Fprintf(w, "Comment:\t%s\n", r.Comment)
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
for _, on := range []bool{true, false} {
|
||||
on := on
|
||||
verb, short := "disable", "Ignore a reservation, keeping it (the client gets a pool address like any other)"
|
||||
if on {
|
||||
verb, short = "enable", "Use a disabled reservation again"
|
||||
}
|
||||
cmd.AddCommand(&cobra.Command{
|
||||
Use: verb + " RESERVATION", Short: short, Args: cobra.ExactArgs(1),
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
c, err := newClient()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
disabled := !on
|
||||
var resp api.MutationResponse
|
||||
if err := c.Do(ctx(), "PATCH", "/reservations/"+url.PathEscape(args[0]), nil, api.ReservationInput{Disabled: &disabled}, &resp); err != nil {
|
||||
return err
|
||||
}
|
||||
return report(&resp)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
var hostname, clientID, comment, ip, mac string
|
||||
var opts, unsetOpts []string
|
||||
|
||||
Reference in new issue
Block a user