column.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import i18n from '@/locales'
  2. export const getVpcTableColumn = (vm) => {
  3. return {
  4. field: 'vpc',
  5. title: i18n.t('network.local_vpc'),
  6. minWidth: 120,
  7. showOverflow: 'ellipsis',
  8. slots: {
  9. default: ({ row }, h) => {
  10. return [
  11. <side-page-trigger name='VpcSidePage' id={row.vpc_id} vm={vm}>{row.vpc}</side-page-trigger>,
  12. ]
  13. },
  14. },
  15. }
  16. }
  17. export const getPeerVpcTableColumn = () => {
  18. return {
  19. field: 'peer_vpc_name',
  20. title: i18n.t('network.peer_vpc'),
  21. minWidth: 120,
  22. showOverflow: 'ellipsis',
  23. slots: {
  24. default: ({ row }) => {
  25. return row.peer_vpc_name || row.peer_vpc_id || row.ext_peer_vpc_id
  26. },
  27. },
  28. }
  29. }
  30. export const getExtPeerAccountTableColumn = () => {
  31. return {
  32. field: 'ext_peer_account_id',
  33. title: i18n.t('network.peer_account'),
  34. minWidth: 120,
  35. showOverflow: 'title',
  36. slots: {
  37. default: ({ row }, h) => {
  38. const text = !row.peer_vpc_name ? `${row.peer_account_id || row.ext_peer_account_id}(${i18n.t('network.cross_account')})` : i18n.t('network.same_account')
  39. return [
  40. <list-body-cell-wrap copy field='ext_peer_account_id' row={row} hideField='true' message={text}>
  41. { text }
  42. </list-body-cell-wrap>,
  43. ]
  44. },
  45. },
  46. }
  47. }