Detail.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <detail
  3. :on-manager="onManager"
  4. :data="data"
  5. resource="secgroups"
  6. :base-info="baseInfo"
  7. status-module="secgroup" />
  8. </template>
  9. <script>
  10. import {
  11. getUserTagColumn,
  12. getExtTagColumn,
  13. } from '@/utils/common/detailColumn'
  14. import WindowsMixin from '@/mixins/windows'
  15. import { getBrandTableColumn, getPublicScopeTableColumn, getRegionTableColumn, getCopyWithContentTableColumn } from '@/utils/common/tableColumn'
  16. export default {
  17. name: 'SecgroupDetail',
  18. mixins: [WindowsMixin],
  19. props: {
  20. onManager: {
  21. type: Function,
  22. required: true,
  23. },
  24. data: {
  25. type: Object,
  26. required: true,
  27. },
  28. columns: Array,
  29. hiddenColumns: Array,
  30. },
  31. data () {
  32. return {
  33. PUBLIC_SCOPE_ZH: {
  34. system: this.$t('shareScope.system'),
  35. project: this.$t('shareScope.project'),
  36. none: this.$t('compute.text_1029'),
  37. domain: this.$t('shareScope.domain'),
  38. },
  39. baseInfo: [
  40. getBrandTableColumn(),
  41. getUserTagColumn({ onManager: this.onManager, resource: 'secgroup', columns: () => this.columns, tipName: this.$t('dictionary.secgroup') }),
  42. getExtTagColumn({ onManager: this.onManager, resource: 'secgroup', columns: () => this.columns, tipName: this.$t('dictionary.secgroup') }),
  43. getPublicScopeTableColumn({ vm: this, resource: 'secgroups' }),
  44. {
  45. field: 'guest_cnt',
  46. title: this.$t('compute.text_1023'),
  47. formatter: ({ row }) => {
  48. const guestList = []
  49. if (row.admin_guest_cnt && this.$store.getters.isAdminMode) {
  50. guestList.push(<span> + {row.admin_guest_cnt} <help-tooltip name="secgroupAdminGuestCnt" /></span>)
  51. }
  52. if (row.system_guest_cnt && this.$store.getters.isAdminMode) {
  53. guestList.push(<span> + {row.system_guest_cnt} <help-tooltip name="secgroupSystemGuestCnt" /></span>)
  54. }
  55. return <span><a onClick={ () => this.$emit('tab-change', 'associated-instances') }>{row.guest_cnt}</a>{...guestList}</span>
  56. },
  57. hidden: () => this.hiddenColumns.includes('guest_cnt'),
  58. },
  59. {
  60. field: 'total_cnt',
  61. title: this.$t('compute.associated_instances'),
  62. slots: {
  63. default: ({ row }) => {
  64. return <span><a onClick={ () => this.$emit('tab-change', 'associated-instances') }>{row.total_cnt}</a></span>
  65. },
  66. },
  67. hidden: () => this.hiddenColumns.includes('total_cnt'),
  68. },
  69. getRegionTableColumn(),
  70. getCopyWithContentTableColumn({
  71. field: 'vpc',
  72. title: 'VPC',
  73. }),
  74. getCopyWithContentTableColumn({
  75. field: 'global_vpc',
  76. title: this.$t('common_307'),
  77. message: (row) => {
  78. return row.brand === 'Google' ? row.global_vpc || '-' : '-'
  79. },
  80. }),
  81. ],
  82. }
  83. },
  84. }
  85. </script>