- Undo is staged like any edit: in review mode the web UI's Undo, and hc history undo with -C or HOUSECARL_CHANGESET, add a revert operation that checks, when replayed, that nothing it touches changed since; applied, History links the entries. Imports and takeovers still can't be staged. - The rules page sums up a chain's built-ins in one line; a window lists them with what they do and their hits, and switches them. - Warnings about the machine (dashboard, hc status): nftables.service enabled (it loads /etc/nftables.conf at boot and flushes every table when stopped), and the imported table still in force beside Housecarl's. The docs say to disable nftables.service but not stop it. - A raw rule with other fields set is refused (raw_conflict) instead of silently ignoring them; the rule dialog's nftables section hides what it replaces, and the importer's raw rules carry only their text. - A dynamic set with configured entries is refused (set_dynamic_entries): they were silently ignored. The set dialog shows entries or the entry timeout, as fits. - The rule dialog's chain choices are just the chains' names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.8 KiB
Go
60 lines
1.8 KiB
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Changeset statuses.
|
|
const (
|
|
ChangesetOpen = "open"
|
|
ChangesetApplied = "applied"
|
|
ChangesetDiscarded = "discarded"
|
|
)
|
|
|
|
// Changeset is a list of changes, staged to be reviewed and applied
|
|
// together (or discarded). Applied, it is one history entry.
|
|
type Changeset struct {
|
|
ID int64 `json:"id"`
|
|
UserID int64 `json:"user_id,omitempty"`
|
|
Username string `json:"username"`
|
|
Via string `json:"via"`
|
|
Description string `json:"description"`
|
|
Status string `json:"status"`
|
|
Ops []Op `json:"ops"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
// HistoryID is the history entry an applied changeset became.
|
|
HistoryID int64 `json:"history_id,omitempty"`
|
|
}
|
|
|
|
// Operations.
|
|
const (
|
|
OpCreate = "create"
|
|
OpUpdate = "update"
|
|
OpDelete = "delete"
|
|
OpMove = "move"
|
|
OpSettings = "settings"
|
|
// OpRevert undoes a history entry: Data is the entry (its changes),
|
|
// ID its number.
|
|
OpRevert = "revert"
|
|
)
|
|
|
|
// Op is one change, as the API received it, so it can be stored and
|
|
// replayed on whatever the configuration is when it is applied.
|
|
type Op struct {
|
|
Seq int `json:"seq"`
|
|
Op string `json:"op"` // create, update, delete, move, settings, revert
|
|
Kind string `json:"kind,omitempty"`
|
|
// Ref names the object (ID, or name) for update, delete and move.
|
|
Ref string `json:"ref,omitempty"`
|
|
// ID is the object a create makes, given when it is staged so later
|
|
// operations can name it.
|
|
ID int64 `json:"id,omitempty"`
|
|
// Data is the object (create), the fields to change (update,
|
|
// settings) or where to move it (move).
|
|
Data json.RawMessage `json:"data,omitempty"`
|
|
Summary string `json:"summary"`
|
|
AddedAt time.Time `json:"added_at"`
|
|
}
|