index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('dictionary.vpc')"
  5. icon="res-vpc"
  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 v-if="showActions">
  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. :hiddenActions="hiddenActions"
  24. taskResource="compute-tasks"
  25. @side-page-trigger-handle="sidePageTriggerHandle"
  26. @init-side-page-tab="initSidePageTab"
  27. @refresh="refresh"
  28. @single-refresh="singleRefresh"
  29. @tab-change="handleTabChange" />
  30. </base-side-page>
  31. </template>
  32. <script>
  33. import * as R from 'ramda'
  34. import SecgroupList from '@Compute/views/secgroup/components/List'
  35. import SidePageMixin from '@/mixins/sidePage'
  36. import WindowsMixin from '@/mixins/windows'
  37. import Actions from '@/components/PageList/Actions'
  38. import SingleActionsMixin from '../mixins/singleActions'
  39. import ColumnsMixin from '../mixins/columns'
  40. import RouteTableList from './RouteTable'
  41. import NetworkList from './Network'
  42. import VpcDetail from './Detail'
  43. import Topology from './Topology'
  44. export default {
  45. name: 'VpcSidePage',
  46. components: {
  47. VpcDetail,
  48. NetworkList,
  49. Actions,
  50. RouteTableList,
  51. Topology,
  52. SecgroupList,
  53. },
  54. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  55. data () {
  56. return {
  57. }
  58. },
  59. computed: {
  60. detailTabs () {
  61. const tabs = [
  62. { label: this.$t('network.text_67'), key: 'vpc-detail' },
  63. { label: this.$t('network.text_565'), key: 'network-list' },
  64. { label: this.$t('network.topology'), key: 'topology' },
  65. { label: this.$t('table.title.task'), key: 'task-drawer' },
  66. { label: this.$t('network.text_150'), key: 'event-drawer' },
  67. ]
  68. if (this.detailData.brand === 'Huawei' || this.detailData.brand === 'Aliyun' || this.detailData.brand === 'OpenStack') {
  69. tabs.splice(R.findIndex(R.propEq('key', 'topology'))(tabs), 0, { label: this.$t('dictionary.route_table'), key: 'route-table-list' })
  70. }
  71. if (this.detailData.cloud_env && this.detailData.cloud_env !== 'onpremise') {
  72. tabs.splice(R.findIndex(R.propEq('key', 'network-list'))(tabs), 0, { label: this.$t('dictionary.secgroup'), key: 'secgroup-list' })
  73. }
  74. return tabs
  75. },
  76. showActions () {
  77. return !this.$isScopedPolicyMenuHidden('slb_hidden_columns.perform_action')
  78. },
  79. getParams () {
  80. if (this.params.windowData.currentTab === 'network-list') {
  81. return {
  82. width_meta: true,
  83. vpc: this.detailData.id,
  84. details: true,
  85. }
  86. }
  87. if (this.params.windowData.currentTab === 'route-table-list') {
  88. return {
  89. vpc: this.detailData.id,
  90. }
  91. }
  92. if (this.params.windowData.currentTab === 'secgroup-list') {
  93. return {
  94. vpc_id: this.detailData.id,
  95. }
  96. }
  97. return null
  98. },
  99. listId () {
  100. switch (this.params.windowData.currentTab) {
  101. case 'event-drawer':
  102. return 'EventListForVpcSidePage'
  103. case 'network-list':
  104. return 'NetworkListForVpcSidePage'
  105. case 'route-table-list':
  106. return 'RouteTableListForVpcSidePage'
  107. case 'secgroup-list':
  108. return 'SecgroupListForVpcSidepage'
  109. default:
  110. return ''
  111. }
  112. },
  113. hiddenColumns () {
  114. return this.params.hiddenColumns
  115. },
  116. hiddenActions () {
  117. if (this.params.windowData.currentTab === 'secgroup-list') {
  118. return ['create']
  119. }
  120. return this.params.hiddenActions
  121. },
  122. },
  123. }
  124. </script>