1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

B #5780: Provision images doesn't work with hyphen (#1942)

This commit is contained in:
Frederick Borges 2022-04-13 13:31:50 +02:00 committed by GitHub
parent e208067817
commit 34575a0708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 13 deletions

View File

@ -1,4 +1,4 @@
name: 'Dummy'
image: 'ON-PREMISE'
image: 'ONPREMISE'
provision_type: 'onprem'
color: '#436637'

View File

@ -50,13 +50,15 @@ const ProvisionCard = memo(
const IMAGES_URL = isProvider ? PROVIDER_IMAGES_URL : PROVISION_IMAGES_URL
const stateInfo = PROVISIONS_STATES[BODY.state]
const image = propImage ?? BODY?.image ?? DEFAULT_IMAGE
const image = propImage ?? BODY?.image
const isExternalImage = useMemo(() => isExternalURL(image), [image])
const imageUrl = useMemo(
() => (isExternalImage ? image : `${IMAGES_URL}/${image}`),
[isExternalImage]
const imageUrl = useMemo(() => {
if (!image) return DEFAULT_IMAGE
return isExternalImage ? image : `${IMAGES_URL}/${image}`
},[isExternalImage]
)
return (

View File

@ -78,14 +78,13 @@ const Image = memo(
return withSources ? (
<picture {...pictureProps}>
{withSources &&
IMAGE_FORMATS.map((format) => (
<source
key={format}
srcSet={`${src}.${format}`}
type={`image/${format}`}
/>
))}
{IMAGE_FORMATS.map((format) => (
<source
key={format}
srcSet={`${src}.${format}`}
type={`image/${format}`}
/>
))}
<img alt="" {...imageProps} src={src} onError={onImageFail} />
</picture>
) : (