Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 1 | import Vue from 'vue'; |
| 2 | import App from './App.vue'; |
| 3 | import router from './router'; |
Yoshie Muranaka | 8263d85 | 2020-10-16 07:58:06 -0700 | [diff] [blame] | 4 | |
| 5 | //Do not change store import. |
| 6 | //Exact match alias set to support |
| 7 | //dotenv customizations. |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 8 | import store from './store'; |
Konstantin | fb6c6de | 2023-06-14 17:23:14 +0300 | [diff] [blame] | 9 | import eventBus from './eventBus'; |
Yoshie Muranaka | 8263d85 | 2020-10-16 07:58:06 -0700 | [diff] [blame] | 10 | |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 11 | import { |
Derick Montague | 676f2fc | 2019-12-23 20:53:49 -0600 | [diff] [blame] | 12 | AlertPlugin, |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 13 | BadgePlugin, |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 14 | ButtonPlugin, |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 15 | BVConfigPlugin, |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 16 | CardPlugin, |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 17 | CollapsePlugin, |
Yoshie Muranaka | 82cca54 | 2020-04-07 10:20:37 -0700 | [diff] [blame] | 18 | DropdownPlugin, |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 19 | FormPlugin, |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 20 | FormCheckboxPlugin, |
Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 21 | FormDatepickerPlugin, |
Yoshie Muranaka | 3739381 | 2020-03-24 15:25:24 -0700 | [diff] [blame] | 22 | FormFilePlugin, |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 23 | FormGroupPlugin, |
| 24 | FormInputPlugin, |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 25 | FormRadioPlugin, |
| 26 | FormSelectPlugin, |
Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 27 | FormTagsPlugin, |
Yoshie Muranaka | c4e38ab | 2020-04-09 12:41:27 -0700 | [diff] [blame] | 28 | InputGroupPlugin, |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 29 | LayoutPlugin, |
Derick Montague | 42c1989 | 2020-01-17 16:10:34 -0600 | [diff] [blame] | 30 | LinkPlugin, |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 31 | ListGroupPlugin, |
Derick Montague | 42c1989 | 2020-01-17 16:10:34 -0600 | [diff] [blame] | 32 | ModalPlugin, |
| 33 | NavbarPlugin, |
| 34 | NavPlugin, |
Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 35 | PaginationPlugin, |
Yoshie Muranaka | 3be801a | 2020-04-21 11:34:56 -0700 | [diff] [blame] | 36 | ProgressPlugin, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 37 | TablePlugin, |
Dixsie Wolmers | c4b8757 | 2021-10-07 16:15:50 -0500 | [diff] [blame] | 38 | TabsPlugin, |
Yoshie Muranaka | 1be6b41 | 2020-04-16 12:03:38 -0700 | [diff] [blame] | 39 | ToastPlugin, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 40 | TooltipPlugin, |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 41 | } from 'bootstrap-vue'; |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 42 | import Vuelidate from 'vuelidate'; |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 43 | import i18n from './i18n'; |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 44 | import { format } from 'date-fns-tz'; |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 45 | |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 46 | // Filters |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 47 | Vue.filter('shortTimeZone', function (value) { |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 48 | const longTZ = value |
| 49 | .toString() |
| 50 | .match(/\((.*)\)/) |
| 51 | .pop(); |
| 52 | const regexNotUpper = /[*a-z ]/g; |
| 53 | return longTZ.replace(regexNotUpper, ''); |
| 54 | }); |
| 55 | |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 56 | Vue.filter('formatDate', function (value) { |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 57 | const isUtcDisplay = store.getters['global/isUtcDisplay']; |
| 58 | |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 59 | if (value instanceof Date) { |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 60 | if (isUtcDisplay) { |
| 61 | return value.toISOString().substring(0, 10); |
| 62 | } |
| 63 | const pattern = `yyyy-MM-dd`; |
| 64 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 65 | return format(value, pattern, { timezone }); |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 66 | } |
| 67 | }); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 68 | |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 69 | Vue.filter('formatTime', function (value) { |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 70 | const isUtcDisplay = store.getters['global/isUtcDisplay']; |
| 71 | |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 72 | if (value instanceof Date) { |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 73 | if (isUtcDisplay) { |
| 74 | let timeOptions = { |
| 75 | timeZone: 'UTC', |
Derick Montague | 07b85ef | 2021-07-09 20:00:35 -0500 | [diff] [blame] | 76 | hourCycle: 'h23', |
Sukanya Pandey | fc16f3c | 2020-06-23 22:54:27 +0530 | [diff] [blame] | 77 | }; |
| 78 | return `${value.toLocaleTimeString('default', timeOptions)} UTC`; |
| 79 | } |
| 80 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone; |
| 81 | const shortTz = Vue.filter('shortTimeZone')(value); |
| 82 | const pattern = `HH:mm:ss ('${shortTz}' O)`; |
| 83 | return format(value, pattern, { timezone }).replace('GMT', 'UTC'); |
Dixsie Wolmers | 97f4187 | 2020-02-23 15:56:16 -0600 | [diff] [blame] | 84 | } |
| 85 | }); |
| 86 | |
| 87 | // Plugins |
Derick Montague | 676f2fc | 2019-12-23 20:53:49 -0600 | [diff] [blame] | 88 | Vue.use(AlertPlugin); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 89 | Vue.use(BadgePlugin); |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 90 | Vue.use(ButtonPlugin); |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 91 | Vue.use(BVConfigPlugin, { |
Derick Montague | 7f970a1 | 2020-03-02 17:56:09 -0600 | [diff] [blame] | 92 | BFormText: { textVariant: 'secondary' }, |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 93 | BTable: { |
| 94 | headVariant: 'light', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 95 | footVariant: 'light', |
Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 96 | }, |
| 97 | BFormTags: { |
| 98 | tagVariant: 'primary', |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 99 | addButtonVariant: 'link-primary', |
Yoshie Muranaka | 82cca54 | 2020-04-07 10:20:37 -0700 | [diff] [blame] | 100 | }, |
| 101 | BBadge: { |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 102 | variant: 'primary', |
| 103 | }, |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 104 | }); |
Yoshie Muranaka | 92a0a4a | 2020-07-15 10:30:31 -0700 | [diff] [blame] | 105 | Vue.use(CardPlugin); |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 106 | Vue.use(CollapsePlugin); |
Yoshie Muranaka | 82cca54 | 2020-04-07 10:20:37 -0700 | [diff] [blame] | 107 | Vue.use(DropdownPlugin); |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 108 | Vue.use(FormPlugin); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 109 | Vue.use(FormCheckboxPlugin); |
Yoshie Muranaka | 68bbba2 | 2020-05-18 09:49:37 -0700 | [diff] [blame] | 110 | Vue.use(FormDatepickerPlugin); |
Yoshie Muranaka | 3739381 | 2020-03-24 15:25:24 -0700 | [diff] [blame] | 111 | Vue.use(FormFilePlugin); |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 112 | Vue.use(FormGroupPlugin); |
| 113 | Vue.use(FormInputPlugin); |
Yoshie Muranaka | 463a570 | 2019-12-04 09:09:36 -0800 | [diff] [blame] | 114 | Vue.use(FormRadioPlugin); |
| 115 | Vue.use(FormSelectPlugin); |
Yoshie Muranaka | 532a4b0 | 2020-03-27 11:00:50 -0700 | [diff] [blame] | 116 | Vue.use(FormTagsPlugin); |
Yoshie Muranaka | c4e38ab | 2020-04-09 12:41:27 -0700 | [diff] [blame] | 117 | Vue.use(InputGroupPlugin); |
Derick Montague | e080a1a | 2019-12-04 16:30:08 -0600 | [diff] [blame] | 118 | Vue.use(LayoutPlugin); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 119 | Vue.use(LayoutPlugin); |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 120 | Vue.use(LinkPlugin); |
Dixsie Wolmers | 97d86b3 | 2019-12-02 05:07:57 -0600 | [diff] [blame] | 121 | Vue.use(ListGroupPlugin); |
Yoshie Muranaka | 35080ac | 2020-01-17 15:38:57 -0600 | [diff] [blame] | 122 | Vue.use(ModalPlugin); |
Derick Montague | 42c1989 | 2020-01-17 16:10:34 -0600 | [diff] [blame] | 123 | Vue.use(NavbarPlugin); |
| 124 | Vue.use(NavPlugin); |
Yoshie Muranaka | f9832b0 | 2020-05-12 12:04:46 -0700 | [diff] [blame] | 125 | Vue.use(PaginationPlugin); |
Yoshie Muranaka | 3be801a | 2020-04-21 11:34:56 -0700 | [diff] [blame] | 126 | Vue.use(ProgressPlugin); |
Derick Montague | 42c1989 | 2020-01-17 16:10:34 -0600 | [diff] [blame] | 127 | Vue.use(TablePlugin); |
Dixsie Wolmers | c4b8757 | 2021-10-07 16:15:50 -0500 | [diff] [blame] | 128 | Vue.use(TabsPlugin); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 129 | Vue.use(ToastPlugin); |
Yoshie Muranaka | 1be6b41 | 2020-04-16 12:03:38 -0700 | [diff] [blame] | 130 | Vue.use(TooltipPlugin); |
Yoshie Muranaka | 4b0fc1d | 2020-01-06 07:36:16 -0800 | [diff] [blame] | 131 | Vue.use(Vuelidate); |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 132 | |
Derick Montague | a2988f4 | 2020-01-17 13:46:30 -0600 | [diff] [blame] | 133 | new Vue({ |
| 134 | router, |
| 135 | store, |
Dixsie Wolmers | cbcd213 | 2020-01-30 20:58:37 -0600 | [diff] [blame] | 136 | i18n, |
Derick Montague | 602e98a | 2020-10-21 16:20:00 -0500 | [diff] [blame] | 137 | render: (h) => h(App), |
Derick Montague | fded0d1 | 2019-12-11 06:16:40 -0600 | [diff] [blame] | 138 | }).$mount('#app'); |
Konstantin | fb6c6de | 2023-06-14 17:23:14 +0300 | [diff] [blame] | 139 | Vue.prototype.$eventBus = eventBus; |