columns.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import PasswordFetcher from '@Compute/sections/PasswordFetcher'
  2. import { RDS_ACCOUNT_PRIVILEGES } from '@DB/constants'
  3. import { getStatusTableColumn, getNameDescriptionTableColumn } from '@/utils/common/tableColumn'
  4. export default {
  5. created () {
  6. this.columns = [
  7. getNameDescriptionTableColumn({
  8. vm: this,
  9. onManager: this.onManager,
  10. hideField: true,
  11. edit: false,
  12. slotCallback: row => {
  13. return (
  14. <side-page-trigger onTrigger={() => this.handleOpenSidepage(row)}>{row.name}</side-page-trigger>
  15. )
  16. },
  17. }),
  18. getStatusTableColumn({ statusModule: 'rdsAccount' }),
  19. {
  20. field: 'host',
  21. title: this.$t('db.text_344'),
  22. minWidth: 100,
  23. },
  24. {
  25. field: 'password',
  26. title: this.$t('db.text_195'),
  27. minWidth: 100,
  28. slots: {
  29. default: ({ row }) => {
  30. return [<PasswordFetcher serverId={row.id} resourceType='dbinstanceaccounts' />]
  31. },
  32. },
  33. },
  34. {
  35. field: 'dbinstanceprivileges',
  36. minWidth: 200,
  37. title: this.$t('db.text_196'),
  38. slots: {
  39. default: ({ row }) => {
  40. if (row.dbinstanceprivileges && row.dbinstanceprivileges.length > 0) {
  41. return row.dbinstanceprivileges.map(({ database, privileges }) => {
  42. return <div>{database} <span style="color:#666;margin:0 0 0 3px">({RDS_ACCOUNT_PRIVILEGES[privileges] ? RDS_ACCOUNT_PRIVILEGES[privileges] : privileges})</span></div>
  43. })
  44. }
  45. return '-'
  46. },
  47. },
  48. },
  49. ]
  50. },
  51. }