import React from 'react';
import Progress from 'components/Progress';
import { Tooltip } from 'antd';
export const hypervisorColumns = [
{
title: t('Hostname'),
dataIndex: 'service_host',
},
{
title: t('Type'),
dataIndex: 'hypervisor_type',
},
{
title: t('CPU (Core)'),
dataIndex: 'vcpus_used_percent',
render: (value, record) =>
record.hypervisor_type === 'ironic' ? (
<Tooltip
title={t('vCPUs and RAM are not used for bare metal scheduling.')}
>
<span>-</span>
</Tooltip>
) : (
<Tooltip title={`${t(record.cpu_type || 'vCPU')}: ${record.vcpus_used} / ${record.vcpus}`}>
<Progress
value={value}
label={`${record.vcpus_used} / ${record.vcpus}`}
/>
</Tooltip>
),
width: 180,
stringify: (value, record) =>
record.hypervisor_type === 'ironic'
? '-'
: `${value}% (${t(record.cpu_type || 'vCPU')}: ${record.vcpus_used} / ${record.vcpus})`,
},
{
title: t('Configured Memory (GiB)'),
dataIndex: 'memory_mb_percent',
render: (value, record) =>
record.hypervisor_type === 'ironic' ? (
<Tooltip
title={t('vCPUs and RAM are not used for bare metal scheduling.')}
>
<span>-</span>
</Tooltip>
) : (
<Progress
value={value}
label={`${record.memory_mb_used_gb} / ${record.memory_mb_gb}`}
/>
),
width: 180,
stringify: (value, record) =>
record.hypervisor_type === 'ironic'
? '-'
: `${value}% (${t('Used')}: ${record.memory_mb_used_gb} / ${t(
'Total'
)}: ${record.memory_mb_gb})`,
},
{
title: t('Instances'),
dataIndex: 'running_vms',
},
];
export const hypervisorFilters = [
{
label: t('Hostname'),
name: 'service_host',
},
{
label: t('Type'),
name: 'hypervisor_type',
},
];