columns.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import {
  2. getNameDescriptionTableColumn,
  3. getStatusTableColumn,
  4. getCopyWithContentTableColumn,
  5. getRegionTableColumn,
  6. getBrandTableColumn,
  7. getAccountTableColumn,
  8. getPublicScopeTableColumn,
  9. getProjectDomainTableColumn,
  10. getTagTableColumn,
  11. getTimeTableColumn,
  12. } from '@/utils/common/tableColumn'
  13. import i18n from '@/locales'
  14. export default {
  15. created () {
  16. this.columns = [
  17. getNameDescriptionTableColumn({
  18. onManager: this.onManager,
  19. hideField: true,
  20. slotCallback: row => {
  21. return (
  22. <side-page-trigger onTrigger={ () => this.handleOpenSidepage(row) }>{ row.name }</side-page-trigger>
  23. )
  24. },
  25. hidden: () => {
  26. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.name')
  27. },
  28. }),
  29. getStatusTableColumn({
  30. statusModule: 'vpc',
  31. vm: this,
  32. hidden: () => {
  33. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.status')
  34. },
  35. }),
  36. getTagTableColumn({
  37. onManager: this.onManager,
  38. resource: 'vpcs',
  39. columns: () => this.columns,
  40. editCheck: (row) => (row.provider || '').toLowerCase() !== 'bingocloud',
  41. hidden: () => {
  42. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.metadata')
  43. },
  44. }),
  45. getCopyWithContentTableColumn({
  46. field: 'cidr_block',
  47. title: i18n.t('network.vpc.cidr_block.ipv4.label'),
  48. width: 180,
  49. sortable: true,
  50. hidden: () => {
  51. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.cidr_block')
  52. },
  53. }),
  54. getCopyWithContentTableColumn({
  55. field: 'cidr_block6',
  56. title: i18n.t('network.vpc.cidr_block.ipv6.label'),
  57. width: 180,
  58. sortable: true,
  59. hidden: () => {
  60. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.cidr_block6')
  61. },
  62. }),
  63. {
  64. field: 'external_access_mode',
  65. title: this.$t('network.external_access_mode_label'),
  66. formatter: ({ row }) => {
  67. if (row.external_access_mode === 'none') return this.$t('status.enabled.false')
  68. return this.$t('status.enabled.true')
  69. },
  70. },
  71. {
  72. field: 'wire_count',
  73. title: i18n.t('network.text_571'),
  74. width: 100,
  75. sortable: true,
  76. hidden: () => {
  77. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.wire_count')
  78. },
  79. },
  80. {
  81. field: 'network_count',
  82. title: i18n.t('network.text_682'),
  83. width: 80,
  84. sortable: true,
  85. slots: {
  86. default: ({ row }) => {
  87. if (row.network_count <= 0) return row.network_count
  88. return [
  89. <side-page-trigger name='VpcSidePage' id={row.id} tab='network-list' vm={this}>{row.network_count}</side-page-trigger>,
  90. ]
  91. },
  92. },
  93. hidden: () => {
  94. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.network_count')
  95. },
  96. },
  97. getBrandTableColumn({
  98. hidden: () => {
  99. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.brand')
  100. },
  101. }),
  102. getAccountTableColumn({
  103. hidden: () => {
  104. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.account')
  105. },
  106. }),
  107. getPublicScopeTableColumn({
  108. vm: this,
  109. resource: 'vpcs',
  110. hidden: () => {
  111. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.public_scope')
  112. },
  113. }),
  114. getProjectDomainTableColumn({
  115. hidden: () => {
  116. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.tenant')
  117. },
  118. }),
  119. getRegionTableColumn({
  120. hidden: () => {
  121. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.region')
  122. },
  123. }),
  124. getTimeTableColumn({
  125. hidden: () => {
  126. return this.$isScopedPolicyMenuHidden('vpc_hidden_columns.created_at')
  127. },
  128. }),
  129. ]
  130. },
  131. }