columns.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // import AccessInfo from '../components/AccessInfo'
  2. import { ACL_TYPE, STORAGE_CLASS } from '@Storage/constants/index.js'
  3. import { getNameDescriptionTableColumn, getStatusTableColumn, getBrandTableColumn, getRegionTableColumn, getAccountTableColumn, getProjectTableColumn, getPublicScopeTableColumn, getTagTableColumn, getTimeTableColumn } from '@/utils/common/tableColumn'
  4. import i18n from '@/locales'
  5. export default {
  6. created () {
  7. this.columns = [
  8. getNameDescriptionTableColumn({
  9. onManager: this.onManager,
  10. hideField: true,
  11. formRules: [
  12. { required: true, message: i18n.t('storage.text_56') },
  13. { validator: this.$validate('bucketName') },
  14. ],
  15. slotCallback: row => {
  16. return (
  17. <side-page-trigger onTrigger={ () => this.handleOpenSidepage(row) }>{ row.name_cn ? `${row.name}(${row.name_cn})` : row.name }</side-page-trigger>
  18. )
  19. },
  20. hidden: () => {
  21. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.name')
  22. },
  23. }),
  24. getStatusTableColumn({
  25. statusModule: 'bucket',
  26. vm: this,
  27. hidden: () => {
  28. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.status')
  29. },
  30. }),
  31. getTagTableColumn({
  32. onManager: this.onManager,
  33. resource: 'buckets',
  34. columns: () => this.columns,
  35. tipName: this.$t('dictionary.bucket'),
  36. hidden: () => {
  37. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.metadata')
  38. },
  39. }),
  40. {
  41. field: 'storage_class',
  42. title: i18n.t('storage.text_38'),
  43. width: 120,
  44. formatter: ({ row }) => {
  45. return row.storage_class ? STORAGE_CLASS[row.storage_class] || row.storage_class : '-'
  46. },
  47. hidden: () => {
  48. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.storage_class')
  49. },
  50. },
  51. {
  52. field: 'acl',
  53. title: i18n.t('storage.text_93'),
  54. width: 120,
  55. formatter: ({ row }) => {
  56. return ACL_TYPE[row.acl] || row.acl || '-'
  57. },
  58. hidden: () => {
  59. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.acl')
  60. },
  61. },
  62. // {
  63. // field: 'access-info',
  64. // title: i18n.t('storage.text_91'),
  65. // width: 120,
  66. // slots: {
  67. // default: ({ row }) => {
  68. // return [
  69. // <AccessInfo row={row} />,
  70. // ]
  71. // },
  72. // },
  73. // },
  74. getBrandTableColumn({
  75. hidden: () => {
  76. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.brand')
  77. },
  78. }),
  79. getAccountTableColumn({
  80. hidden: () => {
  81. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.account')
  82. },
  83. }),
  84. getPublicScopeTableColumn({
  85. vm: this,
  86. resource: 'buckets',
  87. hidden: () => {
  88. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.public_scope')
  89. },
  90. }),
  91. getProjectTableColumn({
  92. hidden: () => {
  93. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.tenant')
  94. },
  95. }),
  96. getRegionTableColumn({
  97. hidden: () => {
  98. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.region')
  99. },
  100. }),
  101. getTimeTableColumn({
  102. hidden: () => {
  103. return this.$isScopedPolicyMenuHidden('oss_hidden_columns.created_at')
  104. },
  105. }),
  106. ]
  107. },
  108. }