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

F #5819: vmtemplate tests (#2131)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-06-06 19:05:37 +02:00 committed by GitHub
parent d87f232ad4
commit 4bd657ccb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

View File

@ -172,6 +172,7 @@ const Actions = () => {
.filter(Boolean)
.join(' - ')
},
dataCy: 'modal-clone',
},
form: (rows) => {
const names = rows?.map(({ original }) => original?.NAME)
@ -199,6 +200,7 @@ const Actions = () => {
icon: Group,
selected: true,
color: 'secondary',
dataCy: 'template-ownership',
options: [
{
accessor: VM_TEMPLATE_ACTIONS.CHANGE_OWNER,
@ -243,6 +245,7 @@ const Actions = () => {
isConfirmDialog: true,
dialogProps: {
title: T.Share,
dataCy: `modal-${VM_TEMPLATE_ACTIONS.SHARE}`,
children: (rows) =>
MessageToConfirmAction(rows, T.ShareVmTemplateDescription),
},
@ -258,6 +261,7 @@ const Actions = () => {
isConfirmDialog: true,
dialogProps: {
title: T.Unshare,
dataCy: `modal-${VM_TEMPLATE_ACTIONS.UNSHARE}`,
children: (rows) =>
MessageToConfirmAction(
rows,
@ -277,6 +281,7 @@ const Actions = () => {
icon: Lock,
selected: true,
color: 'secondary',
dataCy: 'template-lock',
options: [
{
accessor: VM_TEMPLATE_ACTIONS.LOCK,
@ -284,6 +289,7 @@ const Actions = () => {
isConfirmDialog: true,
dialogProps: {
title: T.Lock,
dataCy: `modal-${VM_TEMPLATE_ACTIONS.LOCK}`,
children: MessageToConfirmAction,
},
onSubmit: (rows) => async () => {
@ -297,6 +303,7 @@ const Actions = () => {
isConfirmDialog: true,
dialogProps: {
title: T.Unlock,
dataCy: `modal-${VM_TEMPLATE_ACTIONS.UNLOCK}`,
children: MessageToConfirmAction,
},
onSubmit: (rows) => async () => {
@ -315,6 +322,7 @@ const Actions = () => {
options: [
{
dialogProps: {
dataCy: `modal-${VM_TEMPLATE_ACTIONS.DELETE}`,
title: (rows) => {
const isMultiple = rows?.length > 1
const { ID, NAME } = rows?.[0]?.original ?? {}

View File

@ -108,7 +108,7 @@ const InfoTabs = memo(({ template, gotoPage, unselect }) => {
/>
)}
<Typography color="text.primary" noWrap>
{`#${template?.ID} | ${template?.NAME}`}
{`#${template?.ID || ''} | ${template?.NAME || ''}`}
</Typography>
</Stack>
<VmTemplateTabs id={template?.ID} />

View File

@ -445,8 +445,9 @@ export const intersperse = (arr, sep) => {
* @param {string[]|object} knownAttributes - Attributes to check
* @returns {object} Returns object with unknown properties
*/
export const getUnknownAttributes = (obj, knownAttributes) => {
export const getUnknownAttributes = (obj = {}, knownAttributes) => {
const unknown = {}
const entries = Object.entries(obj)
const attributes = Array.isArray(knownAttributes)