singleActions.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import {
  2. getSetPublicAction,
  3. getDomainChangeOwnerAction,
  4. } from '@/utils/common/tableActions'
  5. export default {
  6. created () {
  7. this.singleActions = [
  8. {
  9. label: this.$t('common.text00043'),
  10. permission: 'cloudgroup_perform_syncstatus',
  11. action: (obj) => {
  12. this.onManager('performAction', {
  13. id: obj.id,
  14. steadyStatus: ['available'],
  15. managerArgs: {
  16. action: 'syncstatus',
  17. },
  18. })
  19. },
  20. },
  21. {
  22. label: this.$t('common.more'),
  23. actions: obj => {
  24. return [
  25. {
  26. label: this.$t('cloudenv.cloudgroup_single_action1'),
  27. permission: 'cloudgroup_perform_set_user',
  28. action: () => {
  29. this.createDialog('CloudgroupSetUserDialog', {
  30. data: [obj],
  31. onManager: this.onManager,
  32. columns: this.columns,
  33. })
  34. },
  35. meta: () => {
  36. if (this.$store.getters.isDomainMode && obj.domain_id !== this.$store.getters.userInfo.projectDomainId) {
  37. return {
  38. validate: false,
  39. tooltip: this.$t('table.validate.no_share_res_permission'),
  40. }
  41. }
  42. return {
  43. validate: obj.status === 'available',
  44. }
  45. },
  46. },
  47. {
  48. label: this.$t('cloudenv.cloudgroup_single_action2'),
  49. permission: 'cloudgroup_perform_set_policy',
  50. action: () => {
  51. this.createDialog('CloudgroupSetPolicyDialog', {
  52. data: [obj],
  53. onManager: this.onManager,
  54. columns: this.columns,
  55. success: () => {
  56. this.$bus.$emit('CloudpolicyListForCloudgroupSidepageRefresh')
  57. },
  58. })
  59. },
  60. meta: () => {
  61. if (this.$store.getters.isDomainMode && obj.domain_id !== this.$store.getters.userInfo.projectDomainId) {
  62. return {
  63. validate: false,
  64. tooltip: this.$t('table.validate.no_share_res_permission'),
  65. }
  66. }
  67. return {
  68. validate: obj.status === 'available',
  69. }
  70. },
  71. },
  72. getDomainChangeOwnerAction(this, {
  73. name: this.$t('dictionary.cloudgroup'),
  74. resource: 'cloudgroups',
  75. apiVersion: 'v1',
  76. hiddenExtra: true,
  77. }),
  78. getSetPublicAction(this, {
  79. name: this.$t('dictionary.cloudgroup'),
  80. scope: 'domain',
  81. resource: 'cloudgroups',
  82. apiVersion: 'v1',
  83. }),
  84. {
  85. label: this.$t('common.delete'),
  86. permission: 'cloudgroup_delete',
  87. action: () => {
  88. this.createDialog('DeleteResDialog', {
  89. vm: this,
  90. data: [obj],
  91. columns: this.columns,
  92. title: this.$t('cloudenv.cloudgroup_delete_tip'),
  93. name: this.$t('dictionary.cloudgroup'),
  94. onManager: this.onManager,
  95. })
  96. },
  97. meta: () => {
  98. if (this.$store.getters.isDomainMode && obj.domain_id !== this.$store.getters.userInfo.projectDomainId) {
  99. return {
  100. validate: false,
  101. tooltip: this.$t('table.validate.no_share_res_permission'),
  102. }
  103. }
  104. return this.$getDeleteResult(obj)
  105. },
  106. },
  107. ]
  108. },
  109. },
  110. ]
  111. },
  112. }