columns.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import i18n from '@/locales'
  2. import router from '@/router'
  3. export const getTypeTableColumn = () => {
  4. return {
  5. field: 'type',
  6. title: i18n.t('k8s.text_34'),
  7. slots: {
  8. default: ({ row }, h) => {
  9. const typeMap = {
  10. common: i18n.t('k8s.repo.type.common'),
  11. custom: i18n.t('k8s.repo.type.custom'),
  12. harbor: 'Harbor',
  13. }
  14. return typeMap[row.type] || row.type
  15. },
  16. },
  17. }
  18. }
  19. export const getCredentialTableColumn = () => {
  20. return {
  21. field: 'credential_id',
  22. title: i18n.t('k8s.repo.credential'),
  23. minWidth: 100,
  24. slots: {
  25. default: ({ row }, h) => {
  26. if (row.credential_id) {
  27. return [<a-tag color="green" style="cursor: pointer;" onClick={() => router.push(`/credentials/?type=container_image&id=${row.credential_id}`)}>{row.credential_id}</a-tag>]
  28. }
  29. return [<a-tag>{i18n.t('k8s.repo.credential.none')}</a-tag>]
  30. },
  31. },
  32. }
  33. }
  34. export const getUrlTableColumn = () => {
  35. return {
  36. field: 'url',
  37. title: i18n.t('k8s.repo.url'),
  38. minWidth: 240,
  39. slots: {
  40. default: ({ row }, h) => {
  41. return [
  42. <a-tooltip title={`${row.url}`}>
  43. <a-tag class="d-block text-truncate mb-1" style="max-width: 400px;">{row.url}</a-tag>
  44. </a-tooltip>,
  45. ]
  46. },
  47. },
  48. }
  49. }