xref: /openbmc/webui-vue/src/main.js (revision 8e4b5c3f)
1import Vue from 'vue';
2import App from './App.vue';
3import router from './router';
4import store from './store';
5import {
6  AlertPlugin,
7  BadgePlugin,
8  ButtonPlugin,
9  BVConfigPlugin,
10  CollapsePlugin,
11  DropdownPlugin,
12  FormPlugin,
13  FormCheckboxPlugin,
14  FormFilePlugin,
15  FormGroupPlugin,
16  FormInputPlugin,
17  FormRadioPlugin,
18  FormSelectPlugin,
19  FormTagsPlugin,
20  InputGroupPlugin,
21  LayoutPlugin,
22  LinkPlugin,
23  ListGroupPlugin,
24  ModalPlugin,
25  NavbarPlugin,
26  NavPlugin,
27  ProgressPlugin,
28  TablePlugin,
29  ToastPlugin,
30  TooltipPlugin
31} from 'bootstrap-vue';
32import Vuelidate from 'vuelidate';
33import i18n from './i18n';
34
35// Filters
36Vue.filter('formatDate', function(value) {
37  if (value instanceof Date) {
38    return value.toISOString().substring(0, 10);
39  }
40});
41
42Vue.filter('formatTime', function(value) {
43  const timeOptions = {
44    hour: 'numeric',
45    minute: 'numeric',
46    second: 'numeric',
47    timeZoneName: 'short'
48  };
49  if (value instanceof Date) {
50    return value.toLocaleTimeString('default', timeOptions);
51  }
52});
53
54// Plugins
55Vue.use(AlertPlugin);
56Vue.use(BadgePlugin);
57Vue.use(ButtonPlugin);
58Vue.use(BVConfigPlugin, {
59  BFormText: { textVariant: 'secondary' },
60  BTable: {
61    headVariant: 'light',
62    footVariant: 'light'
63  },
64  BFormTags: {
65    tagVariant: 'primary',
66    addButtonVariant: 'link-primary'
67  },
68  BBadge: {
69    variant: 'primary'
70  }
71});
72Vue.use(CollapsePlugin);
73Vue.use(DropdownPlugin);
74Vue.use(FormPlugin);
75Vue.use(FormCheckboxPlugin);
76Vue.use(FormFilePlugin);
77Vue.use(FormGroupPlugin);
78Vue.use(FormInputPlugin);
79Vue.use(FormRadioPlugin);
80Vue.use(FormSelectPlugin);
81Vue.use(FormTagsPlugin);
82Vue.use(InputGroupPlugin);
83Vue.use(LayoutPlugin);
84Vue.use(LayoutPlugin);
85Vue.use(LinkPlugin);
86Vue.use(ListGroupPlugin);
87Vue.use(ModalPlugin);
88Vue.use(NavbarPlugin);
89Vue.use(NavPlugin);
90Vue.use(ProgressPlugin);
91Vue.use(TablePlugin);
92Vue.use(ToastPlugin);
93Vue.use(TooltipPlugin);
94Vue.use(Vuelidate);
95
96new Vue({
97  router,
98  store,
99  i18n,
100  render: h => h(App)
101}).$mount('#app');
102