mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
fix: use DiskUsage instead of VolumeList to populate Volume.UsageData
This commit is contained in:
parent
577797d9ed
commit
b06f7d0fe6
2 changed files with 3 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ package commands
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/docker/docker/api/types/volume"
|
||||
"github.com/docker/docker/client"
|
||||
|
|
@ -21,7 +22,7 @@ type Volume struct {
|
|||
|
||||
// RefreshVolumes gets the volumes and stores them
|
||||
func (c *DockerCommand) RefreshVolumes() ([]*Volume, error) {
|
||||
result, err := c.Client.VolumeList(context.Background(), volume.ListOptions{})
|
||||
result, err := c.Client.DiskUsage(context.Background(), types.DiskUsageOptions{Types: []types.DiskUsageObject{types.VolumeObject}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ func (gui *Gui) volumeConfigStr(volume *commands.Volume) string {
|
|||
}
|
||||
|
||||
if volume.Volume.UsageData != nil {
|
||||
output += utils.WithPadding("RefCount: ", padding) + fmt.Sprintf("%d", volume.Volume.UsageData.RefCount) + "\n"
|
||||
output += "\n" + utils.WithPadding("RefCount: ", padding) + fmt.Sprintf("%d", volume.Volume.UsageData.RefCount) + "\n"
|
||||
output += utils.WithPadding("Size: ", padding) + utils.FormatBinaryBytes(int(volume.Volume.UsageData.Size)) + "\n"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue