blob: 64ba7fc6fd3816ef6f38c80c1ace58bf81a9f18c [file] [log] [blame]
Dixsie Wolmers97d86b32019-12-02 05:07:57 -06001<template>
Dixsie Wolmersf65ee342020-01-22 19:47:56 -06002 <div>
Dixsie Wolmers9d40e302020-02-13 13:29:40 -06003 <div v-if="eventLogData.length == 0">
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -08004 {{ $t('pageOverview.events.noHighEventsMsg') }}
Dixsie Wolmers9d40e302020-02-13 13:29:40 -06005 </div>
6 <div v-else>
7 <!-- TODO: link to event log -->
Yoshie Muranakaf12e0602020-03-04 10:08:59 -08008 <b-button variant="link" href="#" class="float-right">
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -08009 {{ $t('pageOverview.events.viewAllButton') }}
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060010 </b-button>
11 <b-table
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060012 per-page="5"
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070013 sort-by="date"
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060014 sort-desc
15 stacked="sm"
16 :items="eventLogData"
17 :fields="fields"
18 >
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070019 <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 }}
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060025 </template>
26 </b-table>
27 </div>
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060028 </div>
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060029</template>
30
31<script>
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070032import StatusIcon from '@/components/Global/StatusIcon';
33
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060034export default {
Derick Montague09e45cd2020-01-23 15:45:57 -060035 name: 'Events',
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070036 components: { StatusIcon },
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060037 data() {
38 return {
39 fields: [
40 {
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070041 key: 'id',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080042 label: this.$t('pageOverview.events.id')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060043 },
44 {
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070045 key: 'severity',
46 label: this.$t('pageOverview.events.severity')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060047 },
48 {
Yoshie Muranakace9a3ef2020-05-06 14:33:22 -070049 key: 'type',
50 label: this.$t('pageOverview.events.type')
51 },
52 {
53 key: 'date',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080054 label: this.$t('pageOverview.events.date')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060055 },
56 {
57 key: 'description',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080058 label: this.$t('pageOverview.events.description')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060059 }
60 ]
61 };
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060062 },
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060063 computed: {
64 eventLogData() {
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080065 return this.$store.getters['eventLog/highPriorityEvents'];
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060066 }
67 },
Derick Montague09e45cd2020-01-23 15:45:57 -060068 created() {
Yoshie Muranaka598bf7e2020-05-01 12:26:00 -070069 this.$store.dispatch('eventLog/getEventLogData').finally(() => {
70 this.$root.$emit('overview::events::complete');
71 });
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060072 }
73};
74</script>