index.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('network.text_20')"
  5. icon="res-lbagent"
  6. :res-name="detailData.name"
  7. :actions="params.actions"
  8. :current-tab="params.windowData.currentTab"
  9. :tabs="detailTabs"
  10. :loaded="loaded"
  11. @tab-change="handleTabChange">
  12. <template v-slot:actions>
  13. <actions :options="singleActions" :row="detailData" button-type="link" button-size="small" />
  14. </template>
  15. <component
  16. :is="params.windowData.currentTab"
  17. :id="listId"
  18. :res-id="detailData.id"
  19. :data="detailData"
  20. :getParams="getParams"
  21. :on-manager="onManager"
  22. :columns="columns"
  23. @side-page-trigger-handle="sidePageTriggerHandle"
  24. @init-side-page-tab="initSidePageTab"
  25. @refresh="refresh"
  26. @single-refresh="singleRefresh"
  27. @tab-change="handleTabChange" />
  28. </base-side-page>
  29. </template>
  30. <script>
  31. import SidePageMixin from '@/mixins/sidePage'
  32. import WindowsMixin from '@/mixins/windows'
  33. import Actions from '@/components/PageList/Actions'
  34. import SingleActionsMixin from '../mixins/singleActions'
  35. import ColumnsMixin from '../mixins/columns'
  36. import AgentDetail from './Detail'
  37. import Asbook from './Asbook'
  38. export default {
  39. name: 'AgentSidePage',
  40. components: {
  41. AgentDetail,
  42. Asbook,
  43. Actions,
  44. },
  45. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  46. computed: {
  47. detailTabs () {
  48. const tabs = [
  49. { label: this.$t('network.text_67'), key: 'agent-detail' },
  50. { label: this.$t('network.text_150'), key: 'event-drawer' },
  51. ]
  52. if (this.detailData.deployment && this.detailData.deployment.ansible_playbook) {
  53. tabs.splice(1, 0, { label: this.$t('network.text_151'), key: 'asbook' })
  54. }
  55. return tabs
  56. },
  57. getParams () {
  58. return null
  59. },
  60. listId () {
  61. switch (this.params.windowData.currentTab) {
  62. case 'event-drawer':
  63. return 'EventListForAgentSidePage'
  64. default:
  65. return ''
  66. }
  67. },
  68. },
  69. watch: {
  70. detailTabs (tabs) {
  71. if (tabs.length === 2 && this.params.windowData.currentTab === 'asbook') {
  72. this.handleTabChange('agent-detail')
  73. }
  74. },
  75. },
  76. }
  77. </script>