Restart.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{this.params.title}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('dictionary.dbinstances')" :count="params.data.length" :action="params.title" />
  6. <dialog-table :data="params.data" :columns="params.columns.slice(0, 3)" />
  7. </div>
  8. <div slot="footer">
  9. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t("dialog.ok") }}</a-button>
  10. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  11. </div>
  12. </base-dialog>
  13. </template>
  14. <script>
  15. import DialogMixin from '@/mixins/dialog'
  16. import WindowsMixin from '@/mixins/windows'
  17. export default {
  18. name: 'RDSRestartdialog',
  19. mixins: [DialogMixin, WindowsMixin],
  20. data () {
  21. return {
  22. loading: false,
  23. }
  24. },
  25. methods: {
  26. async handleConfirm () {
  27. this.loading = true
  28. try {
  29. if (this.params.data && this.params.data.length > 1) {
  30. const ids = this.params.data.map(({ id }) => id)
  31. await this.params.onManager('batchPerformAction', {
  32. id: ids,
  33. steadyStatus: ['running'],
  34. managerArgs: {
  35. action: 'reboot',
  36. },
  37. })
  38. } else {
  39. await this.params.onManager('performAction', {
  40. id: this.params.data[0].id,
  41. steadyStatus: ['running'],
  42. managerArgs: {
  43. action: 'reboot',
  44. },
  45. })
  46. }
  47. this.cancelDialog()
  48. this.params.refresh()
  49. } catch (error) {
  50. throw error
  51. } finally {
  52. this.loading = false
  53. }
  54. },
  55. },
  56. }
  57. </script>