Detail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <detail
  3. :on-manager="onManager"
  4. :data="data"
  5. :base-info="baseInfo"
  6. resource="dns_zones"
  7. statusModule="dnszone"
  8. :hidden-keys="['status']"
  9. :nameProps="{edit: false}" />
  10. </template>
  11. <script>
  12. import {
  13. getZoneTypeTableColumns,
  14. } from '../utils/columns'
  15. export default {
  16. name: 'DnsZoneDetail',
  17. props: {
  18. data: {
  19. type: Object,
  20. required: true,
  21. },
  22. onManager: {
  23. type: Function,
  24. required: true,
  25. },
  26. },
  27. data () {
  28. return {
  29. baseInfo: [
  30. {
  31. field: 'custom_status',
  32. title: this.$t('common.status') + ' ',
  33. slots: {
  34. default: ({ row }, h) => {
  35. return [
  36. <div class='text-truncate'>
  37. <div class="d-flex align-items-center">
  38. <status status={row.status} statusModule={'dnszone'}>
  39. {
  40. row.status === 'pending' ? <a-popover slot="icon">
  41. <template slot="content">
  42. {row.registrar ? <div class="d-flex"><span style="flex: 0 0 150px">{this.$t('network.dnszone.registrar')}:</span><span>{row.registrar}<copy class="ml-1" message={row.registrar} /></span></div> : null}
  43. {row.name_servers && row.name_servers.length > 0
  44. ? <div class="d-flex">
  45. <span style="flex: 0 0 150px">{this.$t('network.dnszone.add_name_servers')}:</span>
  46. <span style="flex: 1">
  47. {row.name_servers.map((server, index) => (
  48. <div key={index}>
  49. {server}<copy class="ml-1" message={server} />
  50. </div>
  51. ))}
  52. </span>
  53. </div>
  54. : null}
  55. {row.original_name_servers && row.original_name_servers.length > 0
  56. ? <div class="d-flex">
  57. <span style="flex: 0 0 150px">{this.$t('network.dnszone.del_name_servers')}:</span>
  58. <span style="flex: 1">
  59. {row.original_name_servers.map((server, index) => (
  60. <div key={index}>
  61. {server}<copy class="ml-1" message={server} />
  62. </div>
  63. ))}
  64. </span>
  65. </div>
  66. : null}
  67. </template>
  68. <icon type="dashboard-alert-sum" class="ml-1" style={{ color: 'red' }} />
  69. </a-popover> : null
  70. }
  71. </status>
  72. </div>
  73. </div>,
  74. ]
  75. },
  76. },
  77. formatter: ({ row }) => {
  78. return this.$te(`status.dnszone.${row.status}`) ? this.$t(`status.dnszone.${row.status}`) : row.status
  79. },
  80. },
  81. getZoneTypeTableColumns(),
  82. {
  83. field: 'dns_record_count',
  84. title: this.$t('network.text_718'),
  85. formatter: ({ row }) => {
  86. return <a onClick={ () => this.$emit('tab-change', 'dns-recordset-list-for-dns-zone-sidepage') }>{row.dns_record_count}</a>
  87. },
  88. },
  89. {
  90. field: 'vpc_count',
  91. title: this.$t('network.text_719'),
  92. formatter: ({ row }) => {
  93. if (row.zone_type === 'PublicZone' || row.cloud_env === 'onpremise') return row.vpc_count
  94. return <a onClick={ () => this.$emit('tab-change', 'dns-associate-vpc-list') }>{row.vpc_count}</a>
  95. },
  96. },
  97. ],
  98. }
  99. },
  100. }
  101. </script>