index.vue 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <base-side-page
  3. :title="$t('compute.container', [])"
  4. icon="res-vminstance"
  5. :res-name="detailData.name"
  6. :current-tab="params.windowData.currentTab"
  7. :tabs="filterDetailTabs"
  8. :loaded="loaded"
  9. @tab-change="handleTabChange"
  10. @cancel="cancelSidePage">
  11. <template v-slot:actions>
  12. <actions
  13. :options="singleActions"
  14. :row="detailData"
  15. button-type="link"
  16. button-size="small" />
  17. </template>
  18. <component
  19. :is="params.windowData.currentTab"
  20. :data="detailData"
  21. :serverColumns="columns"
  22. :res-id="data.id"
  23. :id="listId"
  24. :on-manager="onManager"
  25. :isPageDestroyed="isPageDestroyed"
  26. taskResource="compute-tasks"
  27. @refresh="refresh"
  28. @single-refresh="singleRefresh"
  29. @tab-change="handleTabChange" />
  30. </base-side-page>
  31. </template>
  32. <script>
  33. import SidePageMixin from '@/mixins/sidePage'
  34. import WindowsMixin from '@/mixins/windows'
  35. import Actions from '@/components/PageList/Actions'
  36. import Log from './Log'
  37. import Monitor from './Monitor'
  38. import Detail from './Detail'
  39. import SingleActionsMixin from '../mixins/singleActions'
  40. import ColumnsMixin from '../mixins/columns'
  41. export default {
  42. name: 'VmPodContainerSidePage',
  43. components: {
  44. Actions,
  45. Log,
  46. Monitor,
  47. Detail,
  48. },
  49. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  50. data () {
  51. const detailTabs = [
  52. { label: this.$t('compute.text_238'), key: 'detail' },
  53. { label: this.$t('k8s.text_325'), key: 'log' },
  54. { label: this.$t('compute.text_608'), key: 'monitor' },
  55. { label: this.$t('table.title.task'), key: 'task-drawer' },
  56. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  57. ]
  58. return {
  59. detailTabs,
  60. agent_status: '',
  61. agent_fail_reason: '',
  62. agent_fail_code: '',
  63. isPageDestroyed: false,
  64. }
  65. },
  66. computed: {
  67. listId () {
  68. switch (this.params.windowData.currentTab) {
  69. case 'monitor':
  70. return 'MonitorListForVmPodContainerSidepage'
  71. default:
  72. return ''
  73. }
  74. },
  75. filterDetailTabs () {
  76. return this.detailTabs.map(item => {
  77. if (!this.detailData.id) {
  78. return {
  79. ...item,
  80. disabled: true,
  81. }
  82. }
  83. return item
  84. })
  85. },
  86. },
  87. created () { },
  88. beforeDestroy () {
  89. this.isPageDestroyed = true
  90. },
  91. methods: {},
  92. }
  93. </script>