Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images Tree: Change 'Used' to 'In Use' #5474

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions cli/command/image/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
details := imageDetails{
ID: img.ID,
DiskUsage: units.HumanSizeWithPrecision(float64(img.Size), 3),
Used: img.Containers > 0,
InUse: img.Containers > 0,
}

var totalContent int64
Expand All @@ -63,14 +63,14 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
Details: imageDetails{
ID: im.ID,
DiskUsage: units.HumanSizeWithPrecision(float64(im.Size.Total), 3),
Used: len(im.ImageData.Containers) > 0,
InUse: len(im.ImageData.Containers) > 0,
ContentSize: units.HumanSizeWithPrecision(float64(im.Size.Content), 3),
},
}

if sub.Details.Used {
if sub.Details.InUse {
// Mark top-level parent image as used if any of its subimages are used.
details.Used = true
details.InUse = true
}

totalContent += im.Size.Content
Expand Down Expand Up @@ -100,7 +100,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
type imageDetails struct {
ID string
DiskUsage string
Used bool
InUse bool
ContentSize string
}

Expand Down Expand Up @@ -179,12 +179,12 @@ func printImageTree(dockerCLI command.Cli, view treeView) error {
},
},
{
Title: "Used",
Title: "In Use",
Align: alignCenter,
Width: 4,
Width: 6,
Color: &greenColor,
DetailsValue: func(d *imageDetails) string {
if d.Used {
if d.InUse {
return "✔"
}
return " "
Expand Down
Loading