Merge pull request #5474 from docker/change_to_inuse

Images Tree: Change 'Used' to 'In Use'
This commit is contained in:
Sebastiaan van Stijn 2024-09-24 10:37:17 +02:00 committed by GitHub
commit 56d0af783c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -46,7 +46,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
details := imageDetails{ details := imageDetails{
ID: img.ID, ID: img.ID,
DiskUsage: units.HumanSizeWithPrecision(float64(img.Size), 3), DiskUsage: units.HumanSizeWithPrecision(float64(img.Size), 3),
Used: img.Containers > 0, InUse: img.Containers > 0,
} }
var totalContent int64 var totalContent int64
@ -63,14 +63,14 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
Details: imageDetails{ Details: imageDetails{
ID: im.ID, ID: im.ID,
DiskUsage: units.HumanSizeWithPrecision(float64(im.Size.Total), 3), 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), 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. // Mark top-level parent image as used if any of its subimages are used.
details.Used = true details.InUse = true
} }
totalContent += im.Size.Content totalContent += im.Size.Content
@ -100,7 +100,7 @@ func runTree(ctx context.Context, dockerCLI command.Cli, opts treeOptions) error
type imageDetails struct { type imageDetails struct {
ID string ID string
DiskUsage string DiskUsage string
Used bool InUse bool
ContentSize string ContentSize string
} }
@ -179,12 +179,12 @@ func printImageTree(dockerCLI command.Cli, view treeView) error {
}, },
}, },
{ {
Title: "Used", Title: "In Use",
Align: alignCenter, Align: alignCenter,
Width: 4, Width: 6,
Color: &greenColor, Color: &greenColor,
DetailsValue: func(d *imageDetails) string { DetailsValue: func(d *imageDetails) string {
if d.Used { if d.InUse {
return "✔" return "✔"
} }
return " " return " "