mirror of https://github.com/docker/cli.git
Merge pull request #27294 from mlaventure/hide-unused-volume-fields
Move types.Volumes optional fields under a new type
This commit is contained in:
commit
2e2f16a621
|
@ -288,7 +288,7 @@ func (c *diskUsageVolumesContext) Active() string {
|
|||
|
||||
used := 0
|
||||
for _, v := range c.volumes {
|
||||
if v.RefCount > 0 {
|
||||
if v.UsageData.RefCount > 0 {
|
||||
used++
|
||||
}
|
||||
}
|
||||
|
@ -301,8 +301,8 @@ func (c *diskUsageVolumesContext) Size() string {
|
|||
|
||||
c.AddHeader(sizeHeader)
|
||||
for _, v := range c.volumes {
|
||||
if v.Size != -1 {
|
||||
size += v.Size
|
||||
if v.UsageData.Size != -1 {
|
||||
size += v.UsageData.Size
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -315,11 +315,11 @@ func (c *diskUsageVolumesContext) Reclaimable() string {
|
|||
|
||||
c.AddHeader(reclaimableHeader)
|
||||
for _, v := range c.volumes {
|
||||
if v.Size != -1 {
|
||||
if v.RefCount == 0 {
|
||||
reclaimable += v.Size
|
||||
if v.UsageData.Size != -1 {
|
||||
if v.UsageData.RefCount == 0 {
|
||||
reclaimable += v.UsageData.Size
|
||||
}
|
||||
totalSize += v.Size
|
||||
totalSize += v.UsageData.Size
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,16 +101,16 @@ func (c *volumeContext) Label(name string) string {
|
|||
|
||||
func (c *volumeContext) Links() string {
|
||||
c.AddHeader(linksHeader)
|
||||
if c.v.Size == -1 {
|
||||
if c.v.UsageData == nil {
|
||||
return "N/A"
|
||||
}
|
||||
return fmt.Sprintf("%d", c.v.RefCount)
|
||||
return fmt.Sprintf("%d", c.v.UsageData.RefCount)
|
||||
}
|
||||
|
||||
func (c *volumeContext) Size() string {
|
||||
c.AddHeader(sizeHeader)
|
||||
if c.v.Size == -1 {
|
||||
if c.v.UsageData == nil {
|
||||
return "N/A"
|
||||
}
|
||||
return units.HumanSize(float64(c.v.Size))
|
||||
return units.HumanSize(float64(c.v.UsageData.Size))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue