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

M #5819: fix datatable zombies and add data-cy (#2077)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-05-25 10:53:17 +02:00 committed by GitHub
parent 7e24b82c14
commit 70dbe010f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 13 deletions

View File

@ -33,7 +33,7 @@ const Row = memo(({ original, ...props }) => {
const { DEPLOY_ID, VM_NAME } = original
return (
<div {...props}>
<div data-cy={`wild-${DEPLOY_ID}`} {...props}>
<div className={classes.main}>
<div className={classes.title}>
<Typography noWrap component="span">

View File

@ -38,7 +38,7 @@ const ZombiesTable = (props) => {
data={useMemo(() => zombies, [zombies])}
rootProps={rootProps}
searchProps={searchProps}
getRowId={(row) => String(row.ZOMBIE_VM)}
getRowId={(row) => String(row.DEPLOY_ID)}
RowComponent={ZombieRow}
{...rest}
/>

View File

@ -30,14 +30,14 @@ import { Row as RowType } from 'react-table'
*/
const Row = memo(({ original, ...props }) => {
const classes = rowStyles()
const { ZOMBIE_VM } = original
const { DEPLOY_ID, VM_NAME } = original
return (
<div {...props}>
<div data-cy={`zombie-${DEPLOY_ID}`} {...props}>
<div className={classes.main}>
<div className={classes.title}>
<Typography noWrap component="span">
{ZOMBIE_VM}
{VM_NAME}
</Typography>
</div>
</div>

View File

@ -133,12 +133,15 @@ export const getKvmMachines = (hosts = []) => {
* @param {Host} host - Host
* @returns {object[]} - List of zombies from host
*/
export const getHostZombies = (host = {}) =>
[
host?.TEMPLATE?.ZOMBIES?.split(', ')?.map((zombie) => ({
ZOMBIE_VM: zombie,
})) ?? [],
].flat()
export const getHostZombies = (host = {}) => {
const zombies = host?.TEMPLATE?.ZOMBIES?.split(', ') ?? []
const vms = [host?.TEMPLATE?.VM ?? []]
.flat()
.filter((vm) => vm.VCENTER_TEMPLATE === 'YES')
return vms.filter((vm) => vm?.VM_NAME && zombies.includes(vm?.VM_NAME))
}
/**
* Returns list of Wilds available from the host.
@ -146,10 +149,15 @@ export const getHostZombies = (host = {}) =>
* @param {Host} host - Host
* @returns {object[]} - List of wilds from host
*/
export const getHostWilds = (host = {}) =>
[host?.TEMPLATE?.VM ?? []]
export const getHostWilds = (host = {}) => {
const wilds = host?.TEMPLATE?.WILDS?.split(', ') ?? []
const vms = [host?.TEMPLATE?.VM ?? []]
.flat()
.filter((vm) => vm.VCENTER_TEMPLATE === 'YES')
return vms.filter((vm) => vm?.VM_NAME && wilds.includes(vm?.VM_NAME))
}
/**
* Returns list of Numa available from the host.
*