| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- import {
- getNameDescriptionTableColumn,
- getStatusTableColumn,
- } from '@/utils/common/tableColumn'
- import {
- getNameFilter,
- } from '@/utils/common/tableFilter'
- import { sizestr, percentstr } from '@/utils/utils'
- import { BRAND_MAP } from '@/constants'
- export default {
- computed: {
- resourceProps () {
- return {
- list: this.$list.createList(this, {
- id: 'VmHostsListForTransferDialog',
- resource: 'hosts',
- getParams: {
- baremetal: false,
- brand: BRAND_MAP.OneCloud.key,
- },
- filterOptions: {
- id: {
- label: this.$t('table.title.id'),
- },
- name: getNameFilter(),
- any_ip: {
- label: 'IP',
- },
- },
- }),
- columns: [
- getNameDescriptionTableColumn({
- hideField: true,
- addLock: true,
- addBackup: true,
- edit: false,
- editDesc: false,
- minWidth: 120,
- slotCallback: row => {
- return [
- <list-body-cell-wrap field='name' row={row} />,
- ]
- },
- }),
- getStatusTableColumn({
- statusModule: 'host',
- minWidth: 100,
- }),
- {
- field: 'custom_ip',
- title: 'IP',
- minWidth: 200,
- showOverflow: 'ellipsis',
- slots: {
- default: ({ row }) => {
- const cellWrap = []
- if (row.access_ip) {
- if (row.ipmi_ip) {
- cellWrap.push(
- <div class="d-flex">
- <list-body-cell-wrap row={row} field="access_ip" copy><span class="text-color-help">{this.$t('compute.text_1319')}</span></list-body-cell-wrap>
- </div>,
- )
- } else {
- cellWrap.push(
- <div class="d-flex">
- <list-body-cell-wrap row={row} field="access_ip" copy></list-body-cell-wrap>
- </div>,
- )
- }
- }
- if (row.ipmi_ip) {
- if (row.access_ip) {
- cellWrap.push(
- <div class="d-flex">
- <list-body-cell-wrap row={row} field="ipmi_ip" copy><span class="text-color-help">{this.$t('compute.text_1320')}</span></list-body-cell-wrap>
- </div>,
- )
- } else {
- cellWrap.push(
- <div class="d-flex">
- <list-body-cell-wrap row={row} field="ipmi_ip" copy></list-body-cell-wrap>
- </div>,
- )
- }
- }
- return cellWrap
- },
- },
- },
- {
- field: 'cpu_count',
- title: this.$t('compute.text_563'),
- minWidth: 100,
- showOverflow: 'title',
- sortFields: ['cpu_count', ''],
- sortByList: ['', 'order_by_cpu_commit_rate'],
- slots: {
- default: ({ row }) => {
- if (row.cpu_commit_rate === undefined) return [<data-loading />]
- return row.cpu_count ? `${row.cpu_count}/${percentstr(row.cpu_commit_rate)}` : 'N/A'
- },
- },
- },
- {
- field: 'mem_size',
- title: this.$t('compute.text_564'),
- minWidth: 100,
- sortFields: ['mem_size', ''],
- sortByList: ['', 'order_by_mem_commit_rate'],
- slots: {
- default: ({ row }) => {
- if (row.mem_commit_rate === undefined) return [<data-loading />]
- return row.mem_size ? `${sizestr(row.mem_size, 'M', 1024)}/${percentstr(row.mem_commit_rate)}` : 'N/A'
- },
- },
- },
- {
- field: 'storage',
- title: this.$t('compute.text_565'),
- minWidth: 80,
- sortByList: ['order_by_storage', 'order_by_storage_commit_rate'],
- slots: {
- default: ({ row }) => {
- if (row.storage === undefined) return [<data-loading />]
- return row.storage ? `${sizestr(row.storage, 'M', 1024)}/${percentstr(row.storage_commit_rate)}` : 'N/A'
- },
- },
- },
- {
- field: 'model',
- title: this.$t('compute.text_580'),
- minWidth: 100,
- formatter: ({ cellValue, row }) => {
- return ((row.sys_info || {}).model) || '-'
- },
- },
- {
- field: 'nonsystem_guests',
- sortBy: 'order_by_server_count',
- title: '#VM',
- minWidth: 80,
- sortable: true,
- slots: {
- default: ({ row }, h) => {
- if (row.nonsystem_guests === undefined) return [<data-loading />]
- return `${row.nonsystem_guests}`
- },
- },
- },
- ],
- }
- },
- },
- methods: {},
- }
|