fix(docker/image): swarm image list issue [EE-6374] (#10710)

pull/10731/head
Oscar Zhou 1 year ago committed by GitHub
parent 3cf36b0e93
commit 5c7f6aab66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,7 @@ package images
import ( import (
"net/http" "net/http"
"strings"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/portainer/portainer/api/http/handler/docker/utils" "github.com/portainer/portainer/api/http/handler/docker/utils"
@ -66,6 +67,12 @@ func (handler *Handler) imagesList(w http.ResponseWriter, r *http.Request) *http
imagesList := make([]ImageResponse, len(images)) imagesList := make([]ImageResponse, len(images))
for i, image := range images { for i, image := range images {
if (image.RepoTags == nil || len(image.RepoTags) == 0) && (image.RepoDigests != nil && len(image.RepoDigests) > 0) {
for _, repoDigest := range image.RepoDigests {
image.RepoTags = append(image.RepoTags, repoDigest[0:strings.Index(repoDigest, "@")]+":<none>")
}
}
imagesList[i] = ImageResponse{ imagesList[i] = ImageResponse{
Created: image.Created, Created: image.Created,
ID: image.ID, ID: image.ID,

@ -26,8 +26,8 @@ export function TableContent<T extends DefaultType = DefaultType>({
return ( return (
<> <>
{rows.map((row) => ( {rows.map((row, index) => (
<Fragment key={row.id}>{renderRow(row)}</Fragment> <Fragment key={`${row.id}-${index}`}>{renderRow(row)}</Fragment>
))} ))}
</> </>
); );

Loading…
Cancel
Save