Alert.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <node-alert-list :get-params="params" :data="data" :alertType="params.type" />
  3. </template>
  4. <script>
  5. import { KVM_MONITOR_OPTS, VMWARE_MONITOR_OPTS } from '../constants.js'
  6. import NodeAlertList from '@Compute/views/node-alert/components/List'
  7. // import { metricItems } from '@Compute/views/node-alert/constants'
  8. export default {
  9. name: 'HostNodeAlertListSidepage',
  10. components: {
  11. NodeAlertList,
  12. },
  13. props: {
  14. data: {
  15. type: Object,
  16. required: true,
  17. },
  18. },
  19. data () {
  20. return {
  21. params: {
  22. details: true,
  23. type: 'host',
  24. node_id: this.data.id,
  25. },
  26. }
  27. },
  28. computed: {
  29. isKvm () { // KVM型 宿主机
  30. return this.$itemData.data.host_type === 'hypervisor'
  31. },
  32. metricOpts () {
  33. const opts = this.isKvm ? KVM_MONITOR_OPTS : VMWARE_MONITOR_OPTS
  34. return opts.map(val => {
  35. const metric = {
  36. value: val.seleteItem,
  37. label: `${val.label}(${val.seleteItem})`,
  38. }
  39. return metric
  40. })
  41. },
  42. },
  43. }
  44. </script>