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

F #5888: Add code to 6.4 branch(#2251)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-07-26 17:17:14 +02:00 committed by GitHub
parent ee88c0ffcb
commit 9837534bbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 7 deletions

View File

@ -66,7 +66,7 @@ const ImageCreateCard = memo(
const classes = useStyles()
return (
<Grid item xs={12} md={6} onClick={onClick}>
<Grid item xs={12} md={6} onClick={onClick} data-cy="create">
<Paper variant="outlined" className={classes.root}>
{Icon && (
<Box className={classes.figure}>

View File

@ -23,7 +23,9 @@ import { T } from 'client/constants'
export const STEP_ID = 'advanced'
const Content = () => <FormWithSchema id={STEP_ID} fields={FIELDS} />
const Content = () => (
<FormWithSchema id={STEP_ID} fields={FIELDS} cy={`${STEP_ID}`} />
)
/**
* Advanced options create image.

View File

@ -24,7 +24,9 @@ import { T } from 'client/constants'
export const STEP_ID = 'general'
const Content = () => <FormWithSchema id={STEP_ID} fields={FIELDS} />
const Content = () => (
<FormWithSchema id={STEP_ID} fields={FIELDS} cy={`${STEP_ID}`} />
)
/**
* General configuration about VM Template.

View File

@ -25,6 +25,7 @@ export default [
{ Header: 'Name', accessor: 'NAME' },
{ Header: 'Owner', accessor: 'UNAME' },
{ Header: 'Group', accessor: 'GNAME' },
{ Header: 'Locked', id: 'locked', accessor: 'LOCK' },
{
Header: 'State',
id: 'STATE',

View File

@ -36,7 +36,7 @@ const Row = ({ original, value, ...props }) => {
TYPE,
DISK_TYPE,
PERSISTENT,
LOCK,
locked,
DATASTORE,
TOTAL_VMS,
RUNNING_VMS,
@ -59,7 +59,7 @@ const Row = ({ original, value, ...props }) => {
<Typography noWrap component="span" data-cy="name">
{NAME}
</Typography>
{LOCK && <Lock />}
{locked && <Lock />}
<span className={classes.labels}>
{labels.map((label) => (
<StatusChip key={label} text={label} />

View File

@ -26,7 +26,11 @@ import { StatusChip } from 'client/components/Status'
import { List } from 'client/components/Tabs/Common'
import { getType, getState } from 'client/models/Image'
import { timeToString, booleanToString } from 'client/models/Helper'
import {
timeToString,
booleanToString,
levelLockToString,
} from 'client/models/Helper'
import { arrayToOptions, prettyBytes } from 'client/utils'
import { T, Image, IMAGE_ACTIONS, IMAGE_TYPES } from 'client/constants'
import { PATH } from 'client/apps/sunstone/routesOne'
@ -49,6 +53,7 @@ const InformationPanel = ({ image = {}, actions }) => {
NAME,
SIZE,
PERSISTENT,
LOCK,
REGTIME,
DATASTORE_ID,
DATASTORE = '--',
@ -110,6 +115,11 @@ const InformationPanel = ({ image = {}, actions }) => {
handleEdit: handleChangeType,
dataCy: 'type',
},
{
name: T.Locked,
value: levelLockToString(LOCK?.LOCKED),
dataCy: 'locked',
},
{
name: T.Persistent,
value: booleanToString(+PERSISTENT),
@ -127,6 +137,7 @@ const InformationPanel = ({ image = {}, actions }) => {
{
name: T.State,
value: <StatusChip text={stateName} stateColor={stateColor} />,
dataCy: 'state',
},
{
name: T.RunningVMs,

View File

@ -27,6 +27,7 @@ import {
Permission,
IMAGE_TYPES_STR,
} from 'client/constants'
import { getType } from 'client/models/Image'
const { IMAGE } = ONE_RESOURCES
const { IMAGE_POOL } = ONE_RESOURCES_POOL
@ -50,7 +51,19 @@ const imageApi = oneApi.injectEndpoints({
return { params, command }
},
transformResponse: (data) => [data?.IMAGE_POOL?.IMAGE ?? []].flat(),
transformResponse: (data) => {
const images = data?.IMAGE_POOL?.IMAGE?.filter?.((image) => {
const type = getType(image)
return (
type === IMAGE_TYPES_STR.OS ||
type === IMAGE_TYPES_STR.CDROM ||
type === IMAGE_TYPES_STR.DATABLOCK
)
})
return [images ?? []].flat()
},
providesTags: (images) =>
images
? [