singleActions.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('db.text_45'),
  7. permission: 'rds_dbinstances_perform_recovery',
  8. action: (obj) => {
  9. this.createDialog('RDSBackupRecovery', {
  10. title: i18n.t('db.text_45'),
  11. data: [obj],
  12. rdsItem: this.data,
  13. columns: this.columns,
  14. onManager: this.onManager,
  15. refresh: this.refresh,
  16. success: () => {
  17. this.destroySidePages()
  18. },
  19. })
  20. },
  21. meta: (obj) => {
  22. let validate = true
  23. let tooltip = ''
  24. if (obj.status !== 'ready') {
  25. validate = false
  26. tooltip = i18n.t('db.text_224')
  27. }
  28. if (obj.provider === 'Qcloud') {
  29. validate = false
  30. tooltip = this.$t('db.text_343')
  31. }
  32. if (obj.provider === 'Aliyun' && (obj.backup_method === 'Logical' || obj.backup_method === 'Snapshot')) {
  33. validate = false
  34. tooltip = i18n.t('db.text_375')
  35. }
  36. return {
  37. validate: validate,
  38. tooltip: tooltip,
  39. }
  40. },
  41. },
  42. {
  43. label: i18n.t('db.text_69'),
  44. permission: 'rds_dbinstancebackups_perform_syncstatus',
  45. action: obj => {
  46. this.onManager('performAction', {
  47. steadyStatus: ['running', 'ready'],
  48. id: obj.id,
  49. managerArgs: {
  50. action: 'syncstatus',
  51. },
  52. })
  53. },
  54. meta: () => ({
  55. validate: true,
  56. }),
  57. },
  58. {
  59. label: i18n.t('db.text_42'),
  60. permission: 'rds_dbinstancebackups_delete',
  61. action: (obj) => {
  62. this.createDialog('DeleteResDialog', {
  63. title: i18n.t('db.text_42'),
  64. name: i18n.t('db.text_44'),
  65. data: [obj],
  66. columns: this.columns,
  67. onManager: this.onManager,
  68. refresh: this.refresh,
  69. })
  70. },
  71. meta: (obj) => {
  72. if (obj.brand === 'Aliyun') {
  73. return {
  74. validate: false,
  75. tooltip: i18n.t('db.text_214'),
  76. }
  77. }
  78. return {
  79. validate: true,
  80. }
  81. },
  82. },
  83. ]
  84. },
  85. }