feat(verlauf): Filter, Wiederholen und Aufräumen
Verlauf filterbar (URL, API, proxdeploy history); Wiederholen füllt den Assistenten aus einem alten Auftrag; Aufräumen löscht nach Fehlschlag oder Abbruch den halb angelegten Gast – nur, wenn dessen Beschreibung auf den Auftrag verweist. Deshalb setzt das Klonen die Beschreibung jetzt sofort. Auf pve-demo geprüft (CT 109). Closes #014 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -200,6 +200,27 @@ func (c *Client) Log(ctx context.Context, id, ab string) ([]LogZeile, error) {
|
||||
return zeilen, c.Aufrufen(ctx, http.MethodGet, pfad, nil, &zeilen)
|
||||
}
|
||||
|
||||
// Verlauf: eine Seite, gefiltert. Leere Filter fallen weg.
|
||||
func (c *Client) Verlauf(ctx context.Context, filter map[string]string) (Verlauf, error) {
|
||||
werte := url.Values{}
|
||||
for k, v := range filter {
|
||||
if v != "" {
|
||||
werte.Set(k, v)
|
||||
}
|
||||
}
|
||||
pfad := "/auftraege"
|
||||
if len(werte) > 0 {
|
||||
pfad += "?" + werte.Encode()
|
||||
}
|
||||
var v Verlauf
|
||||
return v, c.Aufrufen(ctx, http.MethodGet, pfad, nil, &v)
|
||||
}
|
||||
|
||||
func (c *Client) Aufraeumen(ctx context.Context, id string) (AuftragAngenommen, error) {
|
||||
var a AuftragAngenommen
|
||||
return a, c.Aufrufen(ctx, http.MethodPost, "/auftraege/"+url.PathEscape(id)+"/aufraeumen", nil, &a)
|
||||
}
|
||||
|
||||
func (c *Client) Abbrechen(ctx context.Context, id string) error {
|
||||
return c.Aufrufen(ctx, http.MethodPost, "/auftraege/"+url.PathEscape(id)+"/abbrechen", nil, nil)
|
||||
}
|
||||
|
||||
@@ -30,18 +30,36 @@ func (e AuftragArt) Valid() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AuftragAufraeumbarTyp.
|
||||
const (
|
||||
AuftragAufraeumbarTypLXC AuftragAufraeumbarTyp = "LXC"
|
||||
AuftragAufraeumbarTypVM AuftragAufraeumbarTyp = "VM"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AuftragAufraeumbarTyp enum.
|
||||
func (e AuftragAufraeumbarTyp) Valid() bool {
|
||||
switch e {
|
||||
case AuftragAufraeumbarTypLXC:
|
||||
return true
|
||||
case AuftragAufraeumbarTypVM:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for AuftragGastTyp.
|
||||
const (
|
||||
LXC AuftragGastTyp = "LXC"
|
||||
VM AuftragGastTyp = "VM"
|
||||
AuftragGastTypLXC AuftragGastTyp = "LXC"
|
||||
AuftragGastTypVM AuftragGastTyp = "VM"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the AuftragGastTyp enum.
|
||||
func (e AuftragGastTyp) Valid() bool {
|
||||
switch e {
|
||||
case LXC:
|
||||
case AuftragGastTypLXC:
|
||||
return true
|
||||
case VM:
|
||||
case AuftragGastTypVM:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@@ -201,6 +219,30 @@ func (e ProfilVariableType) Valid() bool {
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for VerlaufParamsTyp.
|
||||
const (
|
||||
VerlaufParamsTypAufraeumen VerlaufParamsTyp = "aufraeumen"
|
||||
VerlaufParamsTypLxc VerlaufParamsTyp = "lxc"
|
||||
VerlaufParamsTypTemplate VerlaufParamsTyp = "template"
|
||||
VerlaufParamsTypVm VerlaufParamsTyp = "vm"
|
||||
)
|
||||
|
||||
// Valid indicates whether the value is a known member of the VerlaufParamsTyp enum.
|
||||
func (e VerlaufParamsTyp) Valid() bool {
|
||||
switch e {
|
||||
case VerlaufParamsTypAufraeumen:
|
||||
return true
|
||||
case VerlaufParamsTypLxc:
|
||||
return true
|
||||
case VerlaufParamsTypTemplate:
|
||||
return true
|
||||
case VerlaufParamsTypVm:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// Defines values for DistributionenListeParamsTyp.
|
||||
const (
|
||||
DistributionenListeParamsTypLxc DistributionenListeParamsTyp = "lxc"
|
||||
@@ -229,8 +271,13 @@ type Abschluss struct {
|
||||
|
||||
// Auftrag defines model for Auftrag.
|
||||
type Auftrag struct {
|
||||
Abschluss *Abschluss `json:"abschluss"`
|
||||
Art AuftragArt `json:"art"`
|
||||
Abschluss *Abschluss `json:"abschluss"`
|
||||
Art AuftragArt `json:"art"`
|
||||
Aufraeumbar *struct {
|
||||
Knoten *string `json:"knoten"`
|
||||
Typ AuftragAufraeumbarTyp `json:"typ"`
|
||||
Vmid int `json:"vmid"`
|
||||
} `json:"aufraeumbar"`
|
||||
|
||||
// BeendetAm ISO 8601
|
||||
BeendetAm *string `json:"beendetAm"`
|
||||
@@ -267,6 +314,9 @@ type Auftrag struct {
|
||||
// AuftragArt defines model for Auftrag.Art.
|
||||
type AuftragArt string
|
||||
|
||||
// AuftragAufraeumbarTyp defines model for Auftrag.Aufraeumbar.Typ.
|
||||
type AuftragAufraeumbarTyp string
|
||||
|
||||
// AuftragGastTyp defines model for Auftrag.GastTyp.
|
||||
type AuftragGastTyp string
|
||||
|
||||
@@ -537,6 +587,14 @@ type TokenAnmeldung struct {
|
||||
Tage *int `json:"tage,omitempty"`
|
||||
}
|
||||
|
||||
// Verlauf defines model for Verlauf.
|
||||
type Verlauf struct {
|
||||
Eintraege []Auftrag `json:"eintraege"`
|
||||
Gesamt int `json:"gesamt"`
|
||||
Seite int `json:"seite"`
|
||||
Seiten int `json:"seiten"`
|
||||
}
|
||||
|
||||
// Vorlage defines model for Vorlage.
|
||||
type Vorlage struct {
|
||||
Beschreibung *string `json:"beschreibung"`
|
||||
@@ -544,6 +602,18 @@ type Vorlage struct {
|
||||
Titel string `json:"titel"`
|
||||
}
|
||||
|
||||
// VerlaufParams defines parameters for Verlauf.
|
||||
type VerlaufParams struct {
|
||||
Server *string `form:"server,omitempty" json:"server,omitempty"`
|
||||
Typ *VerlaufParamsTyp `form:"typ,omitempty" json:"typ,omitempty"`
|
||||
Distribution *string `form:"distribution,omitempty" json:"distribution,omitempty"`
|
||||
Status *string `form:"status,omitempty" json:"status,omitempty"`
|
||||
Seite *int `form:"seite,omitempty" json:"seite,omitempty"`
|
||||
}
|
||||
|
||||
// VerlaufParamsTyp defines parameters for Verlauf.
|
||||
type VerlaufParamsTyp string
|
||||
|
||||
// AuftragEreignisseParams defines parameters for AuftragEreignisse.
|
||||
type AuftragEreignisseParams struct {
|
||||
LastEventID *string `json:"Last-Event-ID,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user