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