singleActions.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. import { getSetPublicAction, getDomainChangeOwnerAction } from '@/utils/common/tableActions'
  2. import i18n from '@/locales'
  3. export default {
  4. created () {
  5. this.singleActions = [
  6. {
  7. label: this.$t('network.text_719'),
  8. permission: 'dns_zones_add_vpcs',
  9. action: (obj) => {
  10. this.createDialog('AssociateVpcDialog', {
  11. title: this.$t('network.text_719'),
  12. data: [obj],
  13. resData: obj,
  14. columns: this.columns,
  15. onManager: this.onManager,
  16. refresh: this.refresh,
  17. })
  18. },
  19. meta: (obj) => {
  20. const ret = this.$isOwner(obj)
  21. if (!ret.validate) return ret
  22. if (obj.zone_type === 'PublicZone') {
  23. ret.validate = false
  24. ret.tooltip = i18n.t('common_662')
  25. return ret
  26. }
  27. if (obj.status !== 'available') {
  28. ret.validate = false
  29. ret.tooltip = i18n.t('network.text_730')
  30. return ret
  31. }
  32. if (obj.cloud_env === 'onpremise') {
  33. ret.validate = false
  34. ret.tooltip = i18n.t('network.text_652')
  35. }
  36. return ret
  37. },
  38. },
  39. {
  40. label: this.$t('network.text_129'),
  41. permission: 'dns_zones_syncstatus',
  42. actions: obj => {
  43. return [
  44. {
  45. label: this.$t('network.text_201'),
  46. action: () => {
  47. this.onManager('performAction', {
  48. steadyStatus: ['available'],
  49. id: obj.id,
  50. managerArgs: {
  51. action: 'syncstatus',
  52. },
  53. })
  54. },
  55. meta: () => {
  56. const ret = this.$isOwner(obj)
  57. if (!ret.validate) return ret
  58. return ret
  59. },
  60. },
  61. // {
  62. // label: this.$t('network.text_721'),
  63. // permission: 'dns_zones_sync_recordsets',
  64. // action: () => {
  65. // this.createDialog('DeleteResDialog', {
  66. // vm: this,
  67. // title: this.$t('network.text_721'),
  68. // name: this.$t('dictionary.dns_zone'),
  69. // data: [obj],
  70. // columns: this.columns,
  71. // onManager: this.onManager,
  72. // alert: this.$t('network.text_761'),
  73. // ok: () => {
  74. // this.onManager('performAction', {
  75. // steadyStatus: ['available'],
  76. // id: obj.id,
  77. // managerArgs: {
  78. // action: 'sync-recordsets',
  79. // },
  80. // })
  81. // },
  82. // })
  83. // },
  84. // meta: () => {
  85. // const ret = this.$isOwner(obj)
  86. // if (!ret.validate) return ret
  87. // return {
  88. // validate: !['sync_record_sets'].includes(obj.status),
  89. // }
  90. // },
  91. // },
  92. getDomainChangeOwnerAction(this, {
  93. name: this.$t('dictionary.dns_zone'),
  94. resource: 'dns_zones',
  95. }),
  96. getSetPublicAction(this, {
  97. name: this.$t('dictionary.dns_zone'),
  98. scope: 'domain',
  99. resource: 'dns_zones',
  100. ignorel3PermissionEnable: true,
  101. }),
  102. {
  103. label: this.$t('network.text_131'),
  104. permission: 'dns_zones_delete',
  105. action: () => {
  106. this.createDialog('DeleteResDialog', {
  107. vm: this,
  108. title: this.$t('network.text_131'),
  109. name: this.$t('dictionary.dns_zone'),
  110. data: [obj],
  111. columns: this.columns,
  112. onManager: this.onManager,
  113. alert: this.$t('network.text_762'),
  114. })
  115. },
  116. meta: () => {
  117. const ret = this.$isOwner(obj)
  118. if (!ret.validate) return ret
  119. return this.$getDeleteResult(obj)
  120. },
  121. },
  122. ]
  123. },
  124. },
  125. ]
  126. },
  127. }