1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: Fix image datatable (#2316)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-10-21 14:05:41 +02:00 committed by GitHub
parent b619854c3e
commit 54b77c4308
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,13 +55,17 @@ const imageApi = oneApi.injectEndpoints({
return { params, command }
},
transformResponse: (data) => {
const images = data?.IMAGE_POOL?.IMAGE?.filter?.((image) =>
IMAGE_TYPES_FOR_IMAGES.some(
(imageType) => imageType === getType(image)
)
const imagesPool = data?.IMAGE_POOL?.IMAGE
? Array.isArray(data.IMAGE_POOL.IMAGE)
? data.IMAGE_POOL.IMAGE
: [data.IMAGE_POOL.IMAGE]
: []
const images = imagesPool?.filter?.((image) =>
IMAGE_TYPES_FOR_IMAGES.some(() => getType(image))
)
return [images ?? []].flat()
return images.flat()
},
providesTags: (images) =>
images