Detail.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <detail
  3. :on-manager="onManager"
  4. :data="data"
  5. :base-info="baseInfo" />
  6. </template>
  7. <script>
  8. import WindowsMixin from '@/mixins/windows'
  9. import { getEnabledTableColumn, getCopyWithContentTableColumn } from '@/utils/common/tableColumn'
  10. export default {
  11. name: 'TapServiceDetail',
  12. mixins: [WindowsMixin],
  13. props: {
  14. data: {
  15. type: Object,
  16. required: true,
  17. },
  18. onManager: {
  19. type: Function,
  20. required: true,
  21. },
  22. cloudEnv: {
  23. type: String,
  24. },
  25. },
  26. data () {
  27. return {
  28. baseInfo: [
  29. getEnabledTableColumn(),
  30. {
  31. title: this.$t('compute.text_175'),
  32. field: 'type',
  33. formatter: ({ row }) => {
  34. if (row.type === 'host') {
  35. return this.$t('compute.host_port')
  36. }
  37. if (row.type === 'guest') {
  38. return this.$t('compute.guest_port')
  39. }
  40. return '-'
  41. },
  42. },
  43. {
  44. title: this.$t('compute.target_name'),
  45. field: 'target',
  46. slots: {
  47. default: ({ row }) => {
  48. return <list-body-cell-wrap copy row={ row } field='target' title={ row.target } hideField={ true }>
  49. <side-page-trigger permission={row.type === 'host' ? 'hosts_get' : 'server_get'} name={row.type === 'host' ? 'HostSidePage' : 'VmInstanceSidePage'} id={row.target_id} vm={this}>{ row.target }</side-page-trigger>
  50. </list-body-cell-wrap>
  51. },
  52. },
  53. },
  54. {
  55. title: this.$t('compute.target_ip'),
  56. field: 'target_ips',
  57. slots: {
  58. default: ({ row }) => {
  59. const { target_ips = '' } = row
  60. const ips = target_ips.split(',')
  61. return ips.map(ip => {
  62. return <list-body-cell-wrap copy field='ip' row={{ ip }} title={ip} />
  63. })
  64. },
  65. },
  66. },
  67. getCopyWithContentTableColumn({
  68. field: 'mac_addr',
  69. title: this.$t('compute.target_mac'),
  70. hideField: true,
  71. message: (row) => {
  72. return row.mac_addr
  73. },
  74. slotCallback: (row) => {
  75. return row.mac_addr
  76. },
  77. }),
  78. {
  79. title: this.$t('compute.flow_count'),
  80. field: 'flow_count',
  81. },
  82. ],
  83. }
  84. },
  85. }
  86. </script>