Detail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <detail
  3. :showDesc="false"
  4. :showName="false"
  5. :hiddenKeys="['project_domain', 'tenant', 'created_at', 'updated_at']"
  6. :onManager="onManager"
  7. :data="data"
  8. :base-info="baseInfo" />
  9. </template>
  10. <script>
  11. import { k8sStatusColumn } from '@K8S/utils/tableColumns'
  12. export default {
  13. name: 'K8sServiceDetail',
  14. props: {
  15. data: {
  16. type: Object,
  17. required: true,
  18. },
  19. onManager: {
  20. type: Function,
  21. required: true,
  22. },
  23. },
  24. data () {
  25. return {
  26. baseInfo: [
  27. {
  28. field: 'name',
  29. title: this.$t('k8s.text_41'),
  30. slots: {
  31. default: ({ row }) => {
  32. return [
  33. <div class='text-truncate'>
  34. <list-body-cell-wrap copy row={ this.data } onManager={ this.onManager } field='name' title={ row.name } />
  35. </div>,
  36. ]
  37. },
  38. },
  39. },
  40. k8sStatusColumn(),
  41. {
  42. field: 'cluster',
  43. title: this.$t('k8s.text_19'),
  44. },
  45. {
  46. field: 'namespace',
  47. title: this.$t('k8s.text_23'),
  48. },
  49. {
  50. field: 'type',
  51. title: this.$t('k8s.text_34'),
  52. },
  53. {
  54. field: 'clusterIP',
  55. title: 'clusterIP',
  56. },
  57. {
  58. field: 'sessionAffinity',
  59. title: this.$t('k8s.text_344'),
  60. },
  61. {
  62. field: 'internalEndpoint',
  63. title: this.$t('k8s.text_342'),
  64. minWidth: 200,
  65. slots: {
  66. default: ({ row }) => {
  67. if (row.internalEndpoint && row.internalEndpoint.ports && row.internalEndpoint.ports.length) {
  68. return row.internalEndpoint.ports.map(v => {
  69. return <div>{ `${row.internalEndpoint.host}:${v.port} ${v.protocol}` }</div>
  70. })
  71. }
  72. return '-'
  73. },
  74. },
  75. },
  76. {
  77. field: 'externalEndpoints',
  78. title: this.$t('k8s.text_343'),
  79. slots: {
  80. default: ({ row }) => {
  81. if (row.externalEndpoints && row.externalEndpoints.length) {
  82. return row.externalEndpoints.map(v => {
  83. return <div>{ v.host }</div>
  84. })
  85. }
  86. return '-'
  87. },
  88. },
  89. },
  90. {
  91. field: 'type',
  92. title: this.$t('k8s.text_34'),
  93. },
  94. {
  95. field: 'creationTimestamp',
  96. title: this.$t('k8s.text_74'),
  97. formatter: ({ row }) => {
  98. return (row.creationTimestamp && this.$moment(row.creationTimestamp).format()) || '-'
  99. },
  100. },
  101. ],
  102. }
  103. },
  104. }
  105. </script>