blob: 23bfb691ed4e4b10e65a8ab484fa74ba426d7b71 [file] [log] [blame]
Ed Tanous9c729792024-03-23 14:56:34 -07001import { createApp } from 'vue';
2
Derick Montaguefded0d12019-12-11 06:16:40 -06003import App from './App.vue';
Ed Tanous9c729792024-03-23 14:56:34 -07004import i18n from './i18n';
5
Derick Montaguefded0d12019-12-11 06:16:40 -06006import router from './router';
Yoshie Muranaka8263d852020-10-16 07:58:06 -07007
Ed Tanous9c729792024-03-23 14:56:34 -07008//import { format } from 'date-fns-tz';
9
Yoshie Muranaka8263d852020-10-16 07:58:06 -070010//Do not change store import.
11//Exact match alias set to support
12//dotenv customizations.
Derick Montaguefded0d12019-12-11 06:16:40 -060013import store from './store';
Konstantinfb6c6de2023-06-14 17:23:14 +030014import eventBus from './eventBus';
Yoshie Muranaka8263d852020-10-16 07:58:06 -070015
Ed Tanous9c729792024-03-23 14:56:34 -070016import './assets/styles/bmc/helpers/_index.scss';
17import './assets/styles/bootstrap/_helpers.scss';
18
19import 'bootstrap/dist/css/bootstrap.css';
20import 'bootstrap-vue/dist/bootstrap-vue.css';
21
Derick Montaguea2988f42020-01-17 13:46:30 -060022import {
Ed Tanous9c729792024-03-23 14:56:34 -070023 BootstrapVue,
Derick Montague676f2fc2019-12-23 20:53:49 -060024 AlertPlugin,
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060025 BadgePlugin,
Derick Montaguea2988f42020-01-17 13:46:30 -060026 ButtonPlugin,
Yoshie Muranaka4b0fc1d2020-01-06 07:36:16 -080027 BVConfigPlugin,
Yoshie Muranaka92a0a4a2020-07-15 10:30:31 -070028 CardPlugin,
Derick Montaguea2988f42020-01-17 13:46:30 -060029 CollapsePlugin,
Yoshie Muranaka82cca542020-04-07 10:20:37 -070030 DropdownPlugin,
Derick Montaguee080a1a2019-12-04 16:30:08 -060031 FormPlugin,
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060032 FormCheckboxPlugin,
Yoshie Muranaka68bbba22020-05-18 09:49:37 -070033 FormDatepickerPlugin,
Yoshie Muranaka37393812020-03-24 15:25:24 -070034 FormFilePlugin,
Derick Montaguee080a1a2019-12-04 16:30:08 -060035 FormGroupPlugin,
36 FormInputPlugin,
Yoshie Muranaka463a5702019-12-04 09:09:36 -080037 FormRadioPlugin,
38 FormSelectPlugin,
Yoshie Muranaka532a4b02020-03-27 11:00:50 -070039 FormTagsPlugin,
Yoshie Muranakac4e38ab2020-04-09 12:41:27 -070040 InputGroupPlugin,
Yoshie Muranaka35080ac2020-01-17 15:38:57 -060041 LayoutPlugin,
Derick Montague42c19892020-01-17 16:10:34 -060042 LinkPlugin,
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060043 ListGroupPlugin,
Derick Montague42c19892020-01-17 16:10:34 -060044 ModalPlugin,
45 NavbarPlugin,
46 NavPlugin,
Yoshie Muranakaf9832b02020-05-12 12:04:46 -070047 PaginationPlugin,
Yoshie Muranaka3be801a2020-04-21 11:34:56 -070048 ProgressPlugin,
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -080049 TablePlugin,
Dixsie Wolmersc4b87572021-10-07 16:15:50 -050050 TabsPlugin,
Yoshie Muranaka1be6b412020-04-16 12:03:38 -070051 ToastPlugin,
Derick Montague602e98a2020-10-21 16:20:00 -050052 TooltipPlugin,
Derick Montaguefded0d12019-12-11 06:16:40 -060053} from 'bootstrap-vue';
Derick Montaguea2988f42020-01-17 13:46:30 -060054
Dixsie Wolmers97f41872020-02-23 15:56:16 -060055// Filters
Ed Tanous9c729792024-03-23 14:56:34 -070056/*
Derick Montague602e98a2020-10-21 16:20:00 -050057Vue.filter('shortTimeZone', function (value) {
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053058 const longTZ = value
59 .toString()
60 .match(/\((.*)\)/)
61 .pop();
62 const regexNotUpper = /[*a-z ]/g;
63 return longTZ.replace(regexNotUpper, '');
64});
65
Derick Montague602e98a2020-10-21 16:20:00 -050066Vue.filter('formatDate', function (value) {
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053067 const isUtcDisplay = store.getters['global/isUtcDisplay'];
68
Dixsie Wolmers97f41872020-02-23 15:56:16 -060069 if (value instanceof Date) {
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053070 if (isUtcDisplay) {
71 return value.toISOString().substring(0, 10);
72 }
73 const pattern = `yyyy-MM-dd`;
74 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
75 return format(value, pattern, { timezone });
Dixsie Wolmers97f41872020-02-23 15:56:16 -060076 }
77});
Dixsie Wolmers97d86b32019-12-02 05:07:57 -060078
Derick Montague602e98a2020-10-21 16:20:00 -050079Vue.filter('formatTime', function (value) {
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053080 const isUtcDisplay = store.getters['global/isUtcDisplay'];
81
Dixsie Wolmers97f41872020-02-23 15:56:16 -060082 if (value instanceof Date) {
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053083 if (isUtcDisplay) {
84 let timeOptions = {
85 timeZone: 'UTC',
Derick Montague07b85ef2021-07-09 20:00:35 -050086 hourCycle: 'h23',
Sukanya Pandeyfc16f3c2020-06-23 22:54:27 +053087 };
88 return `${value.toLocaleTimeString('default', timeOptions)} UTC`;
89 }
90 const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
91 const shortTz = Vue.filter('shortTimeZone')(value);
92 const pattern = `HH:mm:ss ('${shortTz}' O)`;
93 return format(value, pattern, { timezone }).replace('GMT', 'UTC');
Dixsie Wolmers97f41872020-02-23 15:56:16 -060094 }
95});
Ed Tanous9c729792024-03-23 14:56:34 -070096*/
97
98const app = createApp({
99 router,
100 store,
101 render: (h) => h(App),
102});
103app.use(i18n);
104
105app.use(router);
106app.use(store);
Dixsie Wolmers97f41872020-02-23 15:56:16 -0600107
108// Plugins
Ed Tanous9c729792024-03-23 14:56:34 -0700109app.use(BootstrapVue);
110app.use(AlertPlugin);
111app.use(BadgePlugin);
112app.use(ButtonPlugin);
113app.use(BVConfigPlugin, {
Derick Montague7f970a12020-03-02 17:56:09 -0600114 BFormText: { textVariant: 'secondary' },
Yoshie Muranaka4b0fc1d2020-01-06 07:36:16 -0800115 BTable: {
116 headVariant: 'light',
Derick Montague602e98a2020-10-21 16:20:00 -0500117 footVariant: 'light',
Yoshie Muranaka532a4b02020-03-27 11:00:50 -0700118 },
119 BFormTags: {
120 tagVariant: 'primary',
Derick Montague602e98a2020-10-21 16:20:00 -0500121 addButtonVariant: 'link-primary',
Yoshie Muranaka82cca542020-04-07 10:20:37 -0700122 },
123 BBadge: {
Derick Montague602e98a2020-10-21 16:20:00 -0500124 variant: 'primary',
125 },
Yoshie Muranaka4b0fc1d2020-01-06 07:36:16 -0800126});
Derick Montaguea2988f42020-01-17 13:46:30 -0600127
Ed Tanous9c729792024-03-23 14:56:34 -0700128app.use(CardPlugin);
129app.use(CollapsePlugin);
130app.use(DropdownPlugin);
131app.use(FormPlugin);
132app.use(FormCheckboxPlugin);
133app.use(FormDatepickerPlugin);
134app.use(FormFilePlugin);
135app.use(FormGroupPlugin);
136app.use(FormInputPlugin);
137app.use(FormRadioPlugin);
138app.use(FormSelectPlugin);
139app.use(FormTagsPlugin);
140app.use(InputGroupPlugin);
141app.use(LayoutPlugin);
142app.use(LayoutPlugin);
143app.use(LinkPlugin);
144app.use(ListGroupPlugin);
145app.use(ModalPlugin);
146app.use(NavbarPlugin);
147app.use(NavPlugin);
148app.use(PaginationPlugin);
149app.use(ProgressPlugin);
150app.use(TablePlugin);
151app.use(TabsPlugin);
152app.use(ToastPlugin);
153app.use(TooltipPlugin);
154
155app.mount('#app');
156app.prototype.$eventBus = eventBus;