1<template> 2 <div> 3 <div v-if="eventLogData.length == 0"> 4 {{ $t('pageOverview.events.noHighEventsMsg') }} 5 </div> 6 <div v-else> 7 <b-button variant="link" to="/health/event-logs" class="float-right"> 8 {{ $t('pageOverview.events.viewAllButton') }} 9 </b-button> 10 <b-table 11 per-page="5" 12 sort-by="date" 13 sort-desc 14 stacked="sm" 15 :items="eventLogData" 16 :fields="fields" 17 > 18 <template v-slot:cell(severity)="{ value }"> 19 <status-icon status="danger" /> 20 {{ value }} 21 </template> 22 <template v-slot:cell(date)="{ value }"> 23 {{ value | formatDate }} {{ value | formatTime }} 24 </template> 25 </b-table> 26 </div> 27 </div> 28</template> 29 30<script> 31import StatusIcon from '@/components/Global/StatusIcon'; 32 33export default { 34 name: 'Events', 35 components: { StatusIcon }, 36 data() { 37 return { 38 fields: [ 39 { 40 key: 'id', 41 label: this.$t('pageOverview.events.id') 42 }, 43 { 44 key: 'severity', 45 label: this.$t('pageOverview.events.severity') 46 }, 47 { 48 key: 'type', 49 label: this.$t('pageOverview.events.type') 50 }, 51 { 52 key: 'date', 53 label: this.$t('pageOverview.events.date') 54 }, 55 { 56 key: 'description', 57 label: this.$t('pageOverview.events.description') 58 } 59 ] 60 }; 61 }, 62 computed: { 63 eventLogData() { 64 return this.$store.getters['eventLog/highPriorityEvents']; 65 } 66 }, 67 created() { 68 this.$store.dispatch('eventLog/getEventLogData').finally(() => { 69 this.$root.$emit('overview::events::complete'); 70 }); 71 } 72}; 73</script> 74