BMCLog.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <page-list
  3. :list="list"
  4. :columns="columns" />
  5. </template>
  6. <script>
  7. import { getCopyWithContentTableColumn, getStatusTableColumn } from '@/utils/common/tableColumn'
  8. import DialogMixin from '@/mixins/dialog'
  9. import WindowsMixin from '@/mixins/windows'
  10. export default {
  11. name: 'BMClogList',
  12. mixins: [DialogMixin, WindowsMixin],
  13. props: {
  14. getParams: {
  15. type: [Function, Object],
  16. },
  17. },
  18. data () {
  19. return {
  20. list: this.$list.createList(this, {
  21. id: 'BMClogListForPhysicalmachineSidePage',
  22. resource: 'baremetalevents',
  23. apiVersion: 'v1',
  24. getParams: this.getParams,
  25. }),
  26. columns: [
  27. {
  28. field: 'id',
  29. title: 'ID',
  30. },
  31. getStatusTableColumn({ field: 'severity', title: this.$t('compute.text_746'), statusModule: 'severity' }),
  32. // {
  33. // field: 'severity',
  34. // title: '严重性',
  35. // formatter: ({ row }) => {
  36. // let text = '未知'
  37. // switch (row.severity) {
  38. // case 'OK':
  39. // text = '正常'
  40. // break
  41. // case 'WARNING':
  42. // text = '警告'
  43. // break
  44. // case 'Critical':
  45. // text = '严重'
  46. // break
  47. // default:
  48. // break
  49. // }
  50. // return text
  51. // },
  52. // },
  53. {
  54. field: 'type',
  55. title: this.$t('compute.text_175'),
  56. formatter: ({ row }) => {
  57. if (row.type === 'system') {
  58. return this.$t('compute.text_855')
  59. } else if (row.type === 'manager') {
  60. return 'BMC'
  61. }
  62. return '-'
  63. },
  64. },
  65. {
  66. field: 'created',
  67. title: this.$t('compute.text_856'),
  68. formatter: ({ row }) => {
  69. return this.$moment(row.created).format(this.$t('compute.text_857'))
  70. },
  71. },
  72. getCopyWithContentTableColumn({ field: 'message', title: this.$t('compute.text_858') }),
  73. ],
  74. }
  75. },
  76. created () {
  77. this.list.fetchData()
  78. },
  79. }
  80. </script>