v3.3.0 b164fe9

cleanup.go RawHistoryFolder

1package dto
2
3import "github.com/bnema/gordon/internal/domain"
4
5// CleanupReport describes cleanup results in API responses.
6type CleanupReport struct {
7	Domain               string              `json:"domain"`
8	RemovedContainers    []CleanupContainer  `json:"removed_containers"`
9	PreservedVolumes     []CleanupVolume     `json:"preserved_volumes"`
10	PreservedAttachments []CleanupAttachment `json:"preserved_attachments"`
11	OrphanedEntities     []CleanupOrphaned   `json:"orphaned_entities"`
12	Warnings             []string            `json:"warnings"`
13	Hints                []string            `json:"hints"`
14	PartialFailures      []CleanupFailure    `json:"partial_failures"`
15}
16
17// CleanupContainer identifies a container affected by cleanup.
18type CleanupContainer struct {
19	ID     string `json:"id"`
20	Name   string `json:"name"`
21	Image  string `json:"image"`
22	Status string `json:"status"`
23}
24
25// CleanupVolume identifies preserved stateful data.
26type CleanupVolume struct {
27	Name          string `json:"name"`
28	ContainerPath string `json:"container_path,omitempty"`
29	Reason        string `json:"reason,omitempty"`
30}
31
32// CleanupAttachment identifies an attachment retained for follow-up cleanup.
33type CleanupAttachment struct {
34	Name        string `json:"name"`
35	Image       string `json:"image"`
36	ContainerID string `json:"container_id"`
37	Status      string `json:"status"`
38	Owner       string `json:"owner,omitempty"`
39	Reason      string `json:"reason,omitempty"`
40}
41
42// CleanupOrphaned identifies runtime state no longer configured.
43type CleanupOrphaned struct {
44	Kind   string `json:"kind"`
45	ID     string `json:"id,omitempty"`
46	Name   string `json:"name,omitempty"`
47	Status string `json:"status,omitempty"`
48	Reason string `json:"reason,omitempty"`
49}
50
51// CleanupFailure records non-fatal cleanup failures.
52type CleanupFailure struct {
53	Action string `json:"action"`
54	Kind   string `json:"kind"`
55	ID     string `json:"id,omitempty"`
56	Name   string `json:"name,omitempty"`
57	Error  string `json:"error"`
58}
59
60// CleanupReportFromDomain maps a domain cleanup report to an API DTO.
61func CleanupReportFromDomain(report *domain.CleanupReport) *CleanupReport {
62	if report == nil {
63		return nil
64	}
65	out := &CleanupReport{
66		Domain:   report.Domain,
67		Warnings: append([]string(nil), report.Warnings...),
68		Hints:    append([]string(nil), report.Hints...),
69	}
70	for _, item := range report.RemovedContainers {
71		out.RemovedContainers = append(out.RemovedContainers, CleanupContainer(item))
72	}
73	for _, item := range report.PreservedVolumes {
74		out.PreservedVolumes = append(out.PreservedVolumes, CleanupVolume(item))
75	}
76	for _, item := range report.PreservedAttachments {
77		out.PreservedAttachments = append(out.PreservedAttachments, CleanupAttachment(item))
78	}
79	for _, item := range report.OrphanedEntities {
80		out.OrphanedEntities = append(out.OrphanedEntities, CleanupOrphaned(item))
81	}
82	for _, item := range report.PartialFailures {
83		out.PartialFailures = append(out.PartialFailures, CleanupFailure(item))
84	}
85	return out
86}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close