List.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns"
  5. :single-actions="singleActions">
  6. <template v-slot:group-actions-append>
  7. <cluster-namespace :getParams.sync="list.getParams" :ignoreNamespace="true" @refresh="fetchData" class="ml-3" />
  8. </template>
  9. </page-list>
  10. </template>
  11. <script>
  12. import ClusterNamespace from '@K8S/sections/ClusterNamespace'
  13. import { getNameFilter, getStatusFilter, getProjectDomainFilter } from '@/utils/common/tableFilter'
  14. import WindowsMixin from '@/mixins/windows'
  15. import ListMixin from '@/mixins/list'
  16. import ColumnsMixin from '../mixins/columns'
  17. import SingleActionsMixin from '../mixins/singleActions'
  18. export default {
  19. name: 'K8SNodeList',
  20. components: {
  21. ClusterNamespace,
  22. },
  23. mixins: [WindowsMixin, ListMixin, ColumnsMixin, SingleActionsMixin],
  24. props: {
  25. id: String,
  26. getParams: {
  27. type: Object,
  28. default: () => ({}),
  29. },
  30. },
  31. data () {
  32. const filter = {}
  33. if (this.$route.query.status) {
  34. filter.status = [this.$route.query.status]
  35. }
  36. if (this.$route.query.domain) {
  37. filter.domain = [this.$route.query.domain]
  38. }
  39. return {
  40. list: this.$list.createList(this, {
  41. id: this.id,
  42. resource: 'k8s_nodes',
  43. apiVersion: 'v1',
  44. getParams: this.getParams,
  45. filterOptions: {
  46. name: getNameFilter(),
  47. status: getStatusFilter({ statusMoule: 'kubecluster' }),
  48. project_domain: getProjectDomainFilter(),
  49. },
  50. filter,
  51. }),
  52. }
  53. },
  54. created () {
  55. this.fetchData()
  56. },
  57. methods: {
  58. fetchData () {
  59. if (this.list.getParams.cluster) {
  60. this.list.fetchData()
  61. }
  62. },
  63. handleOpenSidepage (row) {
  64. this.sidePageTriggerHandle(this, 'K8SNodeSidePage', {
  65. id: row.id,
  66. resource: 'k8s_nodes',
  67. apiVersion: 'v1',
  68. getParams: this.list.getParams,
  69. }, {
  70. list: this.list,
  71. })
  72. },
  73. },
  74. }
  75. </script>