blob: af86e797204d664f1b812224ad2e82c0ae015fa7 [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 -->
8 <b-button variant="link" href="#">
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
12 head-variant="dark"
13 per-page="5"
14 sort-by="logId"
15 sort-desc
16 stacked="sm"
17 :items="eventLogData"
18 :fields="fields"
19 >
20 <template v-slot:cell(timestamp)="data">
Dixsie Wolmers97f41872020-02-23 15:56:16 -060021 <div class="date-column">
22 {{ data.value | formatDate }} <br />
23 {{ data.value | formatTime }}
24 </div>
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>
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060032export default {
Derick Montague09e45cd2020-01-23 15:45:57 -060033 name: 'Events',
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060034 data() {
35 return {
36 fields: [
37 {
38 key: 'logId',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080039 label: this.$t('pageOverview.events.id')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060040 },
41 {
42 key: 'eventID',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080043 label: this.$t('pageOverview.events.refCode')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060044 },
45 {
46 key: 'timestamp',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080047 label: this.$t('pageOverview.events.date')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060048 },
49 {
50 key: 'description',
Yoshie Muranaka547b5fc2020-02-24 15:42:40 -080051 label: this.$t('pageOverview.events.description')
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060052 }
53 ]
54 };
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060055 },
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060056 computed: {
57 eventLogData() {
Yoshie Muranaka1ace1d92020-02-06 13:47:28 -080058 return this.$store.getters['eventLog/highPriorityEvents'];
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060059 }
60 },
Derick Montague09e45cd2020-01-23 15:45:57 -060061 created() {
62 this.getEventLogData();
63 },
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060064 methods: {
65 getEventLogData() {
Derick Montaguee2fd1562019-12-20 13:26:53 -060066 this.$store.dispatch('eventLog/getEventLogData');
Dixsie Wolmersf65ee342020-01-22 19:47:56 -060067 }
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060068 }
69};
70</script>
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060071
72<style lang="scss" scoped>
73.btn {
74 @include float-right;
75}
Dixsie Wolmers97f41872020-02-23 15:56:16 -060076
77.date-column {
78 min-width: 200px;
79}
Dixsie Wolmers9d40e302020-02-13 13:29:40 -060080</style>