RemoveBastion.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <base-dialog @cancel="cancelDialog">
  3. <div slot="header">{{$t('compute.remove_from_bastion')}}</div>
  4. <div slot="body">
  5. <dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="$t('compute.remove_from_bastion')" />
  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: 'VmRemoveFromBastionDialog',
  19. components: {
  20. },
  21. mixins: [DialogMixin, WindowsMixin],
  22. data () {
  23. return {
  24. loading: false,
  25. formItemLayout: {
  26. wrapperCol: {
  27. span: 18,
  28. },
  29. labelCol: {
  30. span: 6,
  31. },
  32. },
  33. }
  34. },
  35. computed: {
  36. },
  37. methods: {
  38. async handleConfirm () {
  39. this.loading = true
  40. try {
  41. for (const item of this.params.data) {
  42. await new this.$Manager('bastion_servers').delete({
  43. id: item.metadata.bastion_server,
  44. })
  45. }
  46. this.params.refresh()
  47. this.cancelDialog()
  48. } finally {
  49. this.loading = false
  50. }
  51. },
  52. },
  53. }
  54. </script>