Network.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :single-actions="singleActions" />
  6. </template>
  7. <script>
  8. import WindowsMixin from '@/mixins/windows'
  9. import ListMixin from '@/mixins/list'
  10. export default {
  11. name: 'NetworkSecgroupListForSecgroupSidepage',
  12. mixins: [WindowsMixin, ListMixin],
  13. props: {
  14. id: String,
  15. getParams: {
  16. type: Object,
  17. },
  18. },
  19. data () {
  20. return {
  21. list: this.$list.createList(this, {
  22. id: this.id,
  23. resource: 'guestnetworksecgroups',
  24. getParams: this.getParams,
  25. }),
  26. columns: [
  27. {
  28. field: 'guest',
  29. title: this.$t('dictionary.server'),
  30. slots: {
  31. default: ({ row }) => {
  32. return [<side-page-trigger permission='servers_get' name='VmInstanceSidePage' id={row.guest_id} vm={this}>{row.guest}</side-page-trigger>]
  33. },
  34. },
  35. },
  36. {
  37. field: 'network_index',
  38. title: this.$t('compute.network_index'),
  39. width: 80,
  40. },
  41. ],
  42. singleActions: [
  43. {
  44. label: this.$t('compute.text_723'),
  45. action: (obj) => {
  46. this.createDialog('VmSidepageRevokeNetworkSecgroupDialog', {
  47. detailData: { id: obj.guest_id },
  48. data: [obj],
  49. secgroupType: 'network',
  50. refresh: () => {
  51. this.$bus.$emit('secgroup-list-refresh')
  52. this.list.refresh()
  53. },
  54. })
  55. },
  56. },
  57. ],
  58. }
  59. },
  60. created () {
  61. this.list.fetchData()
  62. },
  63. }
  64. </script>