KickstartComplate.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('compute.kickstart_complete_action')}}</div>
  4. <div slot="body">
  5. <a-alert class="mb-2" type="warning">
  6. <div slot="message">{{$t('compute.kickstart_complete_tip_2')}}</div>
  7. </a-alert>
  8. <dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="$t('compute.kickstart_complete_action')" />
  9. <dialog-table :data="params.data" :columns="columns" />
  10. </div>
  11. <div slot="footer">
  12. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  13. <a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
  14. </div>
  15. </base-dialog>
  16. </template>
  17. <script>
  18. import DialogMixin from '@/mixins/dialog'
  19. import WindowsMixin from '@/mixins/windows'
  20. export default {
  21. name: 'VmKickstartComplateDialog',
  22. mixins: [DialogMixin, WindowsMixin],
  23. data () {
  24. return {
  25. loading: false,
  26. }
  27. },
  28. computed: {
  29. columns () {
  30. const fields = ['name', 'instance_type', 'brand']
  31. return this.params.columns.filter(item => {
  32. const { field } = item
  33. return fields.indexOf(field) > -1
  34. })
  35. },
  36. },
  37. methods: {
  38. async handleConfirm () {
  39. this.loading = true
  40. try {
  41. await this.params.onManager('performAction', {
  42. id: this.params.data[0].id,
  43. steadyStatus: ['running', 'ready'],
  44. managerArgs: {
  45. action: 'kickstart-complete',
  46. },
  47. })
  48. this.cancelDialog()
  49. } finally {
  50. this.loading = false
  51. }
  52. },
  53. },
  54. }
  55. </script>