index.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <base-side-page
  3. ref="sidePage"
  4. @cancel="cancelSidePage"
  5. :title="$t('compute.text_113')"
  6. icon="passthrough"
  7. :res-name="detailData.name"
  8. :actions="params.actions"
  9. :current-tab="params.windowData.currentTab"
  10. :tabs="detailTabs"
  11. :loaded="loaded"
  12. @tab-change="handleTabChange">
  13. <template v-slot:actions>
  14. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  15. </template>
  16. <component
  17. :is="params.windowData.currentTab"
  18. :res-id="detailData.id"
  19. :id="listId"
  20. :data="detailData"
  21. :on-manager="onManager"
  22. :getParams="getParams" />
  23. </base-side-page>
  24. </template>
  25. <script>
  26. import SidePageMixin from '@/mixins/sidePage'
  27. import WindowsMixin from '@/mixins/windows'
  28. import Actions from '@/components/PageList/Actions'
  29. import AssociatedInstances from './AssociatedInstances'
  30. import SingleActionsMixin from '../mixins/singleActions'
  31. import ColumnsMixin from '../mixins/columns'
  32. import GpuDetail from './Detail'
  33. export default {
  34. name: 'GpuSidePage',
  35. components: {
  36. GpuDetail,
  37. Actions,
  38. AssociatedInstances,
  39. },
  40. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  41. data () {
  42. return {
  43. detailTabs: [
  44. { label: this.$t('compute.text_238'), key: 'gpu-detail' },
  45. { label: this.$t('compute.associated_instances'), key: 'associated-instances' },
  46. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  47. ],
  48. }
  49. },
  50. computed: {
  51. getParams () {
  52. if (this.params.windowData.currentTab === 'servers-list') {
  53. return {
  54. filter: `id.equals(${this.detailData.guest_id})`,
  55. }
  56. }
  57. return null
  58. },
  59. listId () {
  60. switch (this.params.windowData.currentTab) {
  61. case 'event-drawer':
  62. return 'EventListForGpuSidePage'
  63. case 'associated-instances':
  64. return 'AssociatedGpusForGpuSidePage'
  65. default:
  66. return ''
  67. }
  68. },
  69. },
  70. created () {
  71. if (this.params.tab) this.handleTabChange(this.params.tab)
  72. this.$bus.$on('gpu-sidepage-refresh', () => {
  73. this.fetchData()
  74. })
  75. },
  76. }
  77. </script>