singleActions.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.pM = new this.$Manager('cloudproviders')
  5. const ownerDomain = obj => this.$store.getters.isAdminMode || obj.cloudaccount_domain_id === this.$store.getters.userInfo.projectDomainId
  6. this.singleActions = [
  7. {
  8. label: i18n.t('cloudenv.text_363'),
  9. action: obj => {
  10. this.createDialog('cloudproviderregionsSetAutoSyncDialog', {
  11. data: [obj],
  12. columns: this.columns,
  13. refresh: this.refresh,
  14. cloudproviderId: this.cloudproviderId,
  15. })
  16. },
  17. meta: obj => {
  18. return {
  19. validate: ownerDomain(obj),
  20. }
  21. },
  22. },
  23. {
  24. label: i18n.t('common.sync_resource'),
  25. permission: 'cloudaccounts_perform_sync',
  26. action: obj => {
  27. this.createDialog('FullSyncResourceDialog', {
  28. title: this.$t('common.sync_resource'),
  29. name: this.$t('cloudenv.text_10'),
  30. action: this.$t('common.sync_resource'),
  31. steadyStatus: this.list.steadyStatus,
  32. data: [obj],
  33. columns: this.columns,
  34. callback: () => {
  35. this.list.refresh()
  36. },
  37. })
  38. },
  39. meta: obj => {
  40. const isIdle = obj.sync_status === 'idle'
  41. if (obj.enable_auto_sync && obj.cloudprovider_sync_status !== 'idle') {
  42. return {
  43. validate: false,
  44. tooltip: i18n.t('cloudenv.text_313'),
  45. }
  46. }
  47. return {
  48. validate: isIdle,
  49. tooltip: !isIdle && i18n.t('cloudenv.text_368', [this.$t('status.cloudaccountSyncStatus')[obj.sync_status]]),
  50. }
  51. },
  52. },
  53. {
  54. label: i18n.t('cloudenv.text_463'),
  55. action: obj => {
  56. this.createDialog('cloudproviderregionsSyncResourceInfoDialog', {
  57. title: this.$t('cloudenv.text_463'),
  58. name: this.$t('cloudenv.text_10'),
  59. data: [obj],
  60. })
  61. },
  62. },
  63. ]
  64. },
  65. }