index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <base-side-page
  3. @cancel="cancelSidePage"
  4. :title="$t('compute.text_105')"
  5. icon="res-secgroup"
  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. :res-id="data.id"
  18. :data="detailData"
  19. :getParams="getParams"
  20. res-type="secgroup"
  21. :on-manager="onManager"
  22. :columns="columns"
  23. :hidden-columns="hiddenColumns"
  24. taskResource="compute-tasks"
  25. @refresh="refresh"
  26. @single-refresh="singleRefresh"
  27. @tab-change="handleTabChange" />
  28. </base-side-page>
  29. </template>
  30. <script>
  31. import * as R from 'ramda'
  32. import SidePageMixin from '@/mixins/sidePage'
  33. import WindowsMixin from '@/mixins/windows'
  34. import Actions from '@/components/PageList/Actions'
  35. import SingleActionsMixin from '../mixins/singleActions'
  36. import ColumnsMixin from '../mixins/columns'
  37. import AssociatedInstances from './AssociatedInstances'
  38. import SecgroupDetail from './Detail'
  39. import InDirection from './InDirection'
  40. import OutDirection from './OutDirection'
  41. export default {
  42. name: 'SecGroupSidePage',
  43. components: {
  44. SecgroupDetail,
  45. Actions,
  46. OutDirection,
  47. InDirection,
  48. AssociatedInstances,
  49. },
  50. mixins: [SidePageMixin, WindowsMixin, ColumnsMixin, SingleActionsMixin],
  51. data () {
  52. let detailTabs = [
  53. { label: this.$t('compute.text_238'), key: 'secgroup-detail' },
  54. { label: this.$t('compute.text_993'), key: 'in-direction' },
  55. { label: this.$t('compute.text_994'), key: 'out-direction' },
  56. { label: this.$t('compute.associated_instances'), key: 'associated-instances' },
  57. { label: this.$t('table.title.task'), key: 'task-drawer' },
  58. { label: this.$t('compute.text_240'), key: 'event-drawer' },
  59. ]
  60. if (this.params.hiddenSidepageTabs && this.params.hiddenSidepageTabs.includes('associated-instances')) {
  61. detailTabs = R.remove(R.findIndex(R.propEq('key', 'associated-instances'))(detailTabs), 1, detailTabs)
  62. }
  63. if (this.params.row && this.params.row.brand && this.params.row.brand.toLowerCase() === 'ucloud') {
  64. detailTabs = R.remove(R.findIndex(R.propEq('key', 'out-direction'))(detailTabs), 1, detailTabs)
  65. }
  66. return {
  67. detailTabs,
  68. }
  69. },
  70. computed: {
  71. getParams () {
  72. if (this.params.windowData.currentTab === 'in-direction') {
  73. return {
  74. type: 'in',
  75. id: this.data.id,
  76. listId: 'LIST_Secgroup_Inlist',
  77. }
  78. } else if (this.params.windowData.currentTab === 'out-direction') {
  79. return {
  80. type: 'out',
  81. id: this.data.id,
  82. listId: 'LIST_Secgroup_Outlist',
  83. }
  84. } else if (this.params.windowData.currentTab === 'associated-instances') {
  85. return {
  86. secgroup_id: this.detailData.id,
  87. brand: this.detailData.brand,
  88. }
  89. }
  90. return null
  91. },
  92. hiddenActions () {
  93. return this.params.hiddenActions || []
  94. },
  95. hiddenColumns () {
  96. return this.params.hiddenColumns || []
  97. },
  98. },
  99. created () {
  100. if (this.params.tab) this.handleTabChange(this.params.tab)
  101. },
  102. }
  103. </script>