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

F #5422: Add icons to capacity section (#2096)

This commit is contained in:
Sergio Betanzos 2022-05-27 11:34:30 +02:00 committed by GitHub
parent dc1804c4f5
commit dfd3094815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,16 +15,17 @@
* ------------------------------------------------------------------------- */
import { ReactElement, useMemo } from 'react'
import PropTypes from 'prop-types'
import { Edit as EditIcon } from 'iconoir-react'
import { Edit, Server, Cpu } from 'iconoir-react'
import { Stack, Typography } from '@mui/material'
import { useResizeMutation } from 'client/features/OneApi/vm'
import ButtonToTriggerForm from 'client/components/Forms/ButtonToTriggerForm'
import { ResizeCapacityForm } from 'client/components/Forms/Vm'
import { List } from 'client/components/Tabs/Common'
import { MemoryIcon } from 'client/components/Icons'
import { Tr, Translate } from 'client/components/HOC'
import { isVCenter, isAvailableAction } from 'client/models/VirtualMachine'
import { isAvailableAction } from 'client/models/VirtualMachine'
import { formatNumberByCurrency, jsonToXml } from 'client/models/Helper'
import { prettyBytes } from 'client/utils'
import { T, VM, VM_ACTIONS } from 'client/constants'
@ -44,7 +45,7 @@ const CapacityPanel = ({ vm = {}, actions }) => {
MEMORY,
CPU_COST,
MEMORY_COST,
TOPOLOGY: { CORES = '-', SOCKETS = '-' } = {},
TOPOLOGY: { CORES, SOCKETS } = {},
} = vm?.TEMPLATE || {}
const memoryCost = useMemo(() => {
@ -63,16 +64,24 @@ const CapacityPanel = ({ vm = {}, actions }) => {
const info = [
{
icon: <Server />,
name: T.PhysicalCpu,
value: CPU,
dataCy: 'cpu',
},
{
icon: <Cpu />,
name: T.VirtualCpu,
value: VCPU,
dataCy: 'vcpu',
},
isVCenter(vm) && {
{
icon: <MemoryIcon />,
name: T.Memory,
value: prettyBytes(+MEMORY, 'MB'),
dataCy: 'memory',
},
![CORES, SOCKETS].includes(undefined) && {
name: T.VirtualCores,
value: [
`${Tr(T.Cores)} x ${CORES}`,
@ -80,11 +89,6 @@ const CapacityPanel = ({ vm = {}, actions }) => {
].join(' | '),
dataCy: 'virtualcores',
},
{
name: T.Memory,
value: prettyBytes(+MEMORY, 'MB'),
dataCy: 'memory',
},
{
name: T.CostCpu,
value: cpuCost,
@ -147,7 +151,7 @@ const PanelHeader = ({ vm = {}, actions = [] }) => {
<ButtonToTriggerForm
buttonProps={{
'data-cy': 'resize-capacity',
icon: <EditIcon />,
icon: <Edit />,
tooltip: <Translate word={T.Resize} />,
}}
options={[