singleActions.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('compute.perform_sync_status'),
  7. permission: 'instancebackups_perform_syncstatus',
  8. action: obj => {
  9. this.onManager('performAction', {
  10. steadyStatus: ['ready'],
  11. id: obj.id,
  12. managerArgs: {
  13. action: 'syncstatus',
  14. },
  15. })
  16. },
  17. meta: () => ({
  18. validate: true,
  19. }),
  20. },
  21. {
  22. label: i18n.t('compute.text_352'),
  23. actions: obj => {
  24. return [
  25. {
  26. label: i18n.t('compute.text_478'),
  27. permission: 'instancebackups_perform_recovery',
  28. action: obj => {
  29. this.createDialog('InstanceBackupRollbackDialog', {
  30. data: [obj],
  31. columns: this.columns,
  32. onManager: this.onManager,
  33. refresh: this.refresh,
  34. })
  35. },
  36. meta: obj => ({
  37. validate: obj.status === 'ready',
  38. tooltip: obj.status === 'ready' ? '' : i18n.t('compute.instance_backup_not_ready_alert'),
  39. }),
  40. },
  41. {
  42. label: this.$t('compute.unpack'),
  43. action: obj => {
  44. this.createDialog('UnpackDialog', {
  45. data: [obj],
  46. columns: this.columns,
  47. onManager: this.onManager,
  48. refresh: this.refresh,
  49. })
  50. },
  51. meta: obj => ({
  52. validate: obj.status === 'ready',
  53. tooltip: obj.status === 'ready' ? '' : i18n.t('compute.instance_backup_not_ready_alert'),
  54. }),
  55. },
  56. {
  57. label: i18n.t('compute.perform_delete'),
  58. permission: 'instancebackups_delete',
  59. action: obj => {
  60. this.createDialog('DeleteResDialog', {
  61. vm: this,
  62. data: [obj],
  63. columns: this.columns,
  64. title: i18n.t('compute.perform_delete'),
  65. onManager: this.onManager,
  66. name: i18n.t('compute.instance_backup'),
  67. alert: i18n.t('compute.instance_backup_delete_alert'),
  68. content: () => {
  69. const change = (bool) => {
  70. this.deleteResProps.force = bool
  71. }
  72. return <a-checkbox onInput={ change }>{ this.$t('compute.text_655') }</a-checkbox>
  73. },
  74. requestParams: this.deleteResProps,
  75. })
  76. },
  77. meta: obj => {
  78. return this.$getDeleteResult(obj)
  79. },
  80. },
  81. ]
  82. },
  83. },
  84. ]
  85. },
  86. }