import i18n from '@/locales'
import {
getNameDescriptionTableColumn,
getCopyWithContentTableColumn,
getRegionTableColumn,
getPublicScopeTableColumn,
} from '@/utils/common/tableColumn'
import {
getReserveResourceColumn,
} from '../utils/columns'
export default {
created () {
const DEVICE_MAP = {
'10de': 'nvidia',
1002: 'amd',
}
this.columns = [
getNameDescriptionTableColumn({
onManager: this.onManager,
hideField: true,
slotCallback: row => {
return (
this.handleOpenSidepage(row, 'gpu-detail') }>{ row.name }
)
},
}),
{
field: 'dev_type',
title: i18n.t('compute.text_481'),
width: 120,
showOverflow: 'ellipsis',
},
{
field: 'model',
title: i18n.t('compute.text_482'),
minWidth: 120,
showOverflow: 'ellipsis',
slots: {
default: ({ row }, h) => {
const device = row.vendor_device_id.split(':')[0]
if (!device) {
return row.model
}
return [
{ row.model }
,
]
},
},
formatter: ({ row }) => {
const device = row.vendor_device_id.split(':')[0]
if (!device) {
return row.model
}
return row.model
},
},
{
field: 'vendor_device_id',
title: 'PCI ID',
width: 120,
showOverflow: 'ellipsis',
slots: {
default: ({ row }, h) => {
if (row.vendor_device_id) {
if (row.vendor_device_id === '0000:0000') {
return row.vendor_device_id
} else {
const url = 'https://admin.pci-ids.ucw.cz/read/PC/' + row.vendor_device_id.replace(':', '/')
return [
,
]
}
}
},
},
formatter: ({ row }) => {
return row.vendor_device_id
},
},
{
field: 'addr',
title: 'PCI ADDR',
width: 100,
showOverflow: 'ellipsis',
formatter: function ({ row }) {
if (row.addr >= 0) {
return row.addr
}
return '-'
},
},
{
field: 'device_path',
title: i18n.t('compute.isolated_devices.device_path.title'),
width: 120,
showOverflow: 'ellipsis',
slots: {
default: ({ row }, h) => {
const ret = []
if (row.device_path) {
ret.push(
[
{row.device_path}
,
],
)
}
return ret
},
},
formatter: ({ row }) => {
return row.device_path
},
},
{
field: 'numa_node',
title: 'NUMA',
width: 80,
formatter: function ({ row }) {
if (row.numa_node >= 0) {
return row.numa_node
}
return '-'
},
},
{
field: 'guest',
title: this.$t('compute.associated_instances'),
minWidth: 100,
showOverflow: 'ellipsis',
slots: {
default: ({ row }, h) => {
if (this.isPreLoad && !row.guest) return []
return [
this.handleOpenSidepage(row, 'associated-instances') }>{ row.guest }
{row.guest_status ? : ''}
,
]
},
},
formatter: ({ row }) => {
return row.guest || '-'
},
},
getCopyWithContentTableColumn({
field: 'host',
title: i18n.t('compute.text_484'),
hideField: true,
slotCallback: row => {
if (this.isPreLoad && !(row.host && row.host_id)) return []
return row.host || row.host_id
},
}),
getReserveResourceColumn(),
getPublicScopeTableColumn({ resource: 'isolated_devices', vm: this, title: this.$t('compute.text_113') }),
getRegionTableColumn({ vm: this }),
]
},
}