singleActions.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import i18n from '@/locales'
  2. export default {
  3. created () {
  4. this.singleActions = [
  5. {
  6. label: i18n.t('compute.perform_sync_status'),
  7. permission: 'diskbackups_perform_syncstatus',
  8. action: obj => {
  9. this.onManager('performAction', {
  10. steadyStatus: ['running', '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_478'),
  23. permission: 'diskbackups_perform_recovery',
  24. action: obj => {
  25. this.createDialog('DiskBackupRollbackDialog', {
  26. data: [obj],
  27. columns: this.columns,
  28. onManager: this.onManager,
  29. refresh: this.refresh,
  30. })
  31. },
  32. meta: obj => ({
  33. validate: obj.status === 'ready',
  34. tooltip: obj.status === 'ready' ? '' : i18n.t('compute.instance_backup_not_ready_alert'),
  35. }),
  36. },
  37. {
  38. label: i18n.t('compute.perform_delete'),
  39. permission: 'diskbackups_delete',
  40. action: obj => {
  41. this.createDialog('DeleteResDialog', {
  42. vm: this,
  43. data: [obj],
  44. columns: this.columns,
  45. title: i18n.t('compute.perform_delete'),
  46. onManager: this.onManager,
  47. name: i18n.t('compute.disk_backup'),
  48. content: () => {
  49. const change = (bool) => {
  50. this.deleteResProps.force = bool
  51. }
  52. return <a-checkbox onInput={ change }>{ this.$t('compute.text_655') }</a-checkbox>
  53. },
  54. requestParams: this.deleteResProps,
  55. })
  56. },
  57. meta: obj => {
  58. return this.$getDeleteResult(obj)
  59. },
  60. },
  61. ]
  62. },
  63. }