singleActions.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import { mapGetters } from 'vuex'
  2. import { getDomainChangeOwnerAction, getSetPublicAction } from '@/utils/common/tableActions'
  3. import i18n from '@/locales'
  4. export default {
  5. created () {
  6. this.singleActions = [
  7. {
  8. label: i18n.t('network.text_201'),
  9. permission: 'network_globalvpcs_perform_syncstatus',
  10. action: obj => {
  11. this.onManager('performAction', {
  12. steadyStatus: ['running', 'ready'],
  13. id: obj.id,
  14. managerArgs: {
  15. action: 'syncstatus',
  16. },
  17. })
  18. },
  19. meta: (obj) => {
  20. if (!this.isPower(obj)) {
  21. return {
  22. validate: false,
  23. tooltip: i18n.t('network.text_627'),
  24. }
  25. }
  26. return {
  27. validate: true,
  28. }
  29. },
  30. },
  31. {
  32. label: i18n.t('network.text_129'),
  33. actions: obj => {
  34. return [
  35. getDomainChangeOwnerAction(this, {
  36. name: this.$t('dictionary.globalvpc'),
  37. resource: 'globalvpcs',
  38. }, {
  39. permission: 'network_globalvpcs_perform_change_owner',
  40. }),
  41. getSetPublicAction(this, {
  42. name: this.$t('dictionary.globalvpc'),
  43. scope: 'domain',
  44. resource: 'globalvpcs',
  45. }, {
  46. permission: 'network_globalvpcs_perform_public',
  47. }),
  48. {
  49. label: i18n.t('network.text_131'),
  50. permission: 'network_globalvpcs_delete',
  51. action: (obj) => {
  52. this.createDialog('DeleteResDialog', {
  53. vm: this,
  54. name: this.$t('dictionary.globalvpc'),
  55. title: i18n.t('network.text_131'),
  56. data: [obj],
  57. columns: this.columns,
  58. onManager: this.onManager,
  59. // alert: '提示:请确保存储桶下所有目录和文件已删空,删除后数据不可恢复和访问。',
  60. })
  61. },
  62. meta: obj => this.$getDeleteResult(obj),
  63. },
  64. ]
  65. },
  66. },
  67. ]
  68. },
  69. computed: {
  70. ...mapGetters(['isAdminMode', 'isDomainMode', 'userInfo']),
  71. },
  72. methods: {
  73. isPower (obj) {
  74. if (this.isAdminMode) return true
  75. if (this.isDomainMode) return obj.domain_id === this.userInfo.projectDomainId
  76. return false
  77. },
  78. },
  79. }