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