1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-21 18:03:38 +03:00

B #~: Show only OS, CDROM, and DATABLOCK images on image tab (#2401)

This commit is contained in:
Frederick Borges 2022-12-05 17:21:22 +01:00 committed by GitHub
parent 7e42776ea6
commit ce46eba98f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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