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

F #6118: missing data-cy and fix cluster tab (#2896)

Signed-off-by: Jorge Lobo <jlobo@opennebula.io>
(cherry picked from commit 81bdee74d659fb726f4b1a578a43371f58b43dd6)
This commit is contained in:
Jorge Miguel Lobo Escalona 2024-01-17 16:01:09 +01:00 committed by Tino Vázquez
parent 5caddc9600
commit 6197e4069c
No known key found for this signature in database
GPG Key ID: 14201E424D02047E
4 changed files with 14 additions and 6 deletions

View File

@ -38,7 +38,10 @@ const ClustersContent = ({ oneConfig, adminGroup }) => {
const clusters = useWatch({ name: TAB_PATH })
const selectedRowIds =
clusters?.reduce((res, id) => ({ ...res, [id]: true }), {}) || {}
Array.isArray(clusters) ?
clusters?.reduce((res, id) => ({ ...res, [id]: true }), {})
:
{[clusters]: true}
const handleSelectedRows = (rows) => {
const newValue = rows?.map((row) => row.original.ID) || []

View File

@ -254,7 +254,7 @@ const Actions = () => {
dialogProps: {
title: T.Delete,
children: MessageToConfirmAction,
dataCy: `modal-vnet-${VN_TEMPLATE_ACTIONS.DELETE}`,
dataCy: `modal-vnettemplate-${VN_TEMPLATE_ACTIONS.DELETE}`,
},
onSubmit: (rows) => async () => {
const ids = rows?.map?.(({ original }) => original?.ID)

View File

@ -16,8 +16,8 @@
/* eslint-disable jsdoc/require-jsdoc */
import PropTypes from 'prop-types'
import { User, Group, Lock, Cloud } from 'iconoir-react'
import { Typography } from '@mui/material'
import { Cloud, Group, Lock, User } from 'iconoir-react'
import { rowStyles } from 'client/components/Tables/styles'
@ -31,7 +31,7 @@ const Row = ({ original, value, ...props }) => {
const timeAgo = `registered ${time.toRelative()}`
return (
<div {...props}>
<div {...props} data-cy={`network-template-${ID}`}>
<div className={classes.main}>
<div className={classes.title}>
<Typography noWrap component="span">

View File

@ -16,7 +16,7 @@
import { List } from 'client/components/Tabs/Common'
import { T, VN_TEMPLATE_ACTIONS, VNetworkTemplate } from 'client/constants'
import { useRenameVNTemplateMutation } from 'client/features/OneApi/networkTemplate'
import { booleanToString, stringToBoolean } from 'client/models/Helper'
import { booleanToString, levelLockToString, stringToBoolean } from 'client/models/Helper'
import PropTypes from 'prop-types'
import { ReactElement } from 'react'
@ -30,7 +30,7 @@ import { ReactElement } from 'react'
*/
const InformationPanel = ({ vnetTemplate = {}, actions }) => {
const [rename] = useRenameVNTemplateMutation()
const { ID, NAME, VLAN_ID_AUTOMATIC, OUTER_VLAN_ID_AUTOMATIC } = vnetTemplate
const { ID, NAME, VLAN_ID_AUTOMATIC, OUTER_VLAN_ID_AUTOMATIC, LOCK } = vnetTemplate
const handleRename = async (_, newName) => {
await rename({ id: ID, name: newName })
@ -61,6 +61,11 @@ const InformationPanel = ({ vnetTemplate = {}, actions }) => {
value: booleanToString(stringToBoolean(OUTER_VLAN_ID_AUTOMATIC)),
dataCy: 'outer_vlan_automatic',
},
{
name: T.Locked,
value: levelLockToString(LOCK?.LOCKED),
dataCy: 'locked',
},
]
return (