Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 1 | <template> |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 2 | <div> |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 3 | <div v-if="eventLogData.length == 0"> |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 4 | {{ $t('pageOverview.events.noHighEventsMsg') }} |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 5 | </div> |
| 6 | <div v-else> |
| 7 | <!-- TODO: link to event log --> |
Yoshie Muranaka | f12e060 | 2020-03-04 10:08:59 -0800 | [diff] [blame] | 8 | <b-button variant="link" href="#" class="float-right"> |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 9 | {{ $t('pageOverview.events.viewAllButton') }} |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 10 | </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 Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 21 | <div class="date-column"> |
| 22 | {{ data.value | formatDate }} <br /> |
| 23 | {{ data.value | formatTime }} |
| 24 | </div> |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 25 | </template> |
| 26 | </b-table> |
| 27 | </div> |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 28 | </div> |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 29 | </template> |
| 30 | |
| 31 | <script> |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 32 | export default { |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 33 | name: 'Events', |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 34 | data() { |
| 35 | return { |
| 36 | fields: [ |
| 37 | { |
| 38 | key: 'logId', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 39 | label: this.$t('pageOverview.events.id') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 40 | }, |
| 41 | { |
| 42 | key: 'eventID', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 43 | label: this.$t('pageOverview.events.refCode') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 44 | }, |
| 45 | { |
| 46 | key: 'timestamp', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 47 | label: this.$t('pageOverview.events.date') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 48 | }, |
| 49 | { |
| 50 | key: 'description', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 51 | label: this.$t('pageOverview.events.description') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 52 | } |
| 53 | ] |
| 54 | }; |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 55 | }, |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 56 | computed: { |
| 57 | eventLogData() { |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 58 | return this.$store.getters['eventLog/highPriorityEvents']; |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 59 | } |
| 60 | }, |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 61 | created() { |
| 62 | this.getEventLogData(); |
| 63 | }, |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 64 | methods: { |
| 65 | getEventLogData() { |
Derick Montague | e2fd156 | 2019-12-20 13:26:53 -0600 | [diff] [blame] | 66 | this.$store.dispatch('eventLog/getEventLogData'); |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 67 | } |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 68 | } |
| 69 | }; |
| 70 | </script> |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 71 | |
| 72 | <style lang="scss" scoped> |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 73 | .date-column { |
| 74 | min-width: 200px; |
| 75 | } |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 76 | </style> |