Skip to content

Commit

Permalink
fix: 容器管理多一个空元素
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 23, 2024
1 parent b166022 commit 0b61f2f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *ContainerService) List(w http.ResponseWriter, r *http.Request) {
}

paged, total := Paginate(r, containers)
items := make([]any, len(paged))
items := make([]any, 0)
for _, item := range paged {
var name string
if len(item.Names) > 0 {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/container_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *ContainerImageService) List(w http.ResponseWriter, r *http.Request) {

paged, total := Paginate(r, images)

items := make([]any, len(paged))
items := make([]any, 0)
for _, item := range paged {
items = append(items, map[string]any{
"id": item.ID,
Expand Down
2 changes: 1 addition & 1 deletion internal/service/container_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *ContainerNetworkService) List(w http.ResponseWriter, r *http.Request) {

paged, total := Paginate(r, networks)

items := make([]any, len(paged))
items := make([]any, 0)
for _, item := range paged {
var ipamConfig []any
for _, v := range item.IPAM.Config {
Expand Down
2 changes: 1 addition & 1 deletion internal/service/container_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (s *ContainerVolumeService) List(w http.ResponseWriter, r *http.Request) {

paged, total := Paginate(r, volumes)

items := make([]any, len(paged))
items := make([]any, 0)
for _, item := range paged {
var usage any
if item.UsageData != nil {
Expand Down

0 comments on commit 0b61f2f

Please sign in to comment.