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 |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 12 | per-page="5" |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 13 | sort-by="date" |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 14 | sort-desc |
| 15 | stacked="sm" |
| 16 | :items="eventLogData" |
| 17 | :fields="fields" |
| 18 | > |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 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 }} |
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> |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 32 | import StatusIcon from '@/components/Global/StatusIcon'; |
| 33 | |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 34 | export default { |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 35 | name: 'Events', |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 36 | components: { StatusIcon }, |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 37 | data() { |
| 38 | return { |
| 39 | fields: [ |
| 40 | { |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 41 | key: 'id', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 42 | label: this.$t('pageOverview.events.id') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 43 | }, |
| 44 | { |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 45 | key: 'severity', |
| 46 | label: this.$t('pageOverview.events.severity') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 47 | }, |
| 48 | { |
Yoshie Muranaka | ce9a3ef | 2020-05-06 14:33:22 -0700 | [diff] [blame^] | 49 | key: 'type', |
| 50 | label: this.$t('pageOverview.events.type') |
| 51 | }, |
| 52 | { |
| 53 | key: 'date', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 54 | label: this.$t('pageOverview.events.date') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 55 | }, |
| 56 | { |
| 57 | key: 'description', |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 58 | label: this.$t('pageOverview.events.description') |
Dixsie Wolmers | 9d40e30 | 2020-02-13 13:29:40 -0600 | [diff] [blame] | 59 | } |
| 60 | ] |
| 61 | }; |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 62 | }, |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 63 | computed: { |
| 64 | eventLogData() { |
Yoshie Muranaka | 1ace1d9 | 2020-02-06 13:47:28 -0800 | [diff] [blame] | 65 | return this.$store.getters['eventLog/highPriorityEvents']; |
Dixsie Wolmers | f65ee34 | 2020-01-22 19:47:56 -0600 | [diff] [blame] | 66 | } |
| 67 | }, |
Derick Montague | 09e45cd | 2020-01-23 15:45:57 -0600 | [diff] [blame] | 68 | created() { |
Yoshie Muranaka | 598bf7e | 2020-05-01 12:26:00 -0700 | [diff] [blame] | 69 | this.$store.dispatch('eventLog/getEventLogData').finally(() => { |
| 70 | this.$root.$emit('overview::events::complete'); |
| 71 | }); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 72 | } |
| 73 | }; |
| 74 | </script> |