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