xref: /openbmc/webui-vue/src/router/routes.js (revision 883a0d59)
1import AppLayout from '@/layouts/AppLayout.vue';
2import ChangePassword from '@/views/ChangePassword';
3import ConsoleLayout from '@/layouts/ConsoleLayout.vue';
4import DateTime from '@/views/Settings/DateTime';
5import EventLogs from '@/views/Logs/EventLogs';
6import FactoryReset from '@/views/Operations/FactoryReset';
7import Firmware from '@/views/Operations/Firmware';
8import Inventory from '@/views/HardwareStatus/Inventory';
9import Kvm from '@/views/Operations/Kvm';
10import KvmConsole from '@/views/Operations/Kvm/KvmConsole';
11import Sessions from '../views/SecurityAndAccess/Sessions';
12import Ldap from '@/views/SecurityAndAccess/Ldap';
13import UserManagement from '@/views/SecurityAndAccess/UserManagement';
14import Login from '@/views/Login';
15import LoginLayout from '@/layouts/LoginLayout';
16import Network from '@/views/Settings/Network';
17import Overview from '@/views/Overview';
18import PageNotFound from '@/views/PageNotFound';
19import PostCodeLogs from '@/views/Logs/PostCodeLogs';
20import PowerRestorePolicy from '@/views/Settings/PowerRestorePolicy';
21import ProfileSettings from '@/views/ProfileSettings';
22import RebootBmc from '@/views/Operations/RebootBmc';
23import Policies from '@/views/SecurityAndAccess/Policies';
24import KeyClear from '@/views/Operations/KeyClear';
25import Sensors from '@/views/HardwareStatus/Sensors';
26import SerialOverLan from '@/views/Operations/SerialOverLan';
27import SerialOverLanConsole from '@/views/Operations/SerialOverLan/SerialOverLanConsole';
28import ServerPowerOperations from '@/views/Operations/ServerPowerOperations';
29import Certificates from '@/views/SecurityAndAccess/Certificates';
30import VirtualMedia from '@/views/Operations/VirtualMedia';
31import Power from '@/views/ResourceManagement/Power';
32import SnmpAlerts from '@/views/Settings/SnmpAlerts';
33import i18n from '@/i18n';
34
35const roles = {
36  administrator: 'Administrator',
37  operator: 'Operator',
38  readonly: 'ReadOnly',
39  noaccess: 'NoAccess',
40};
41
42const routes = [
43  {
44    path: '/login',
45    component: LoginLayout,
46    children: [
47      {
48        path: '',
49        name: 'login',
50        component: Login,
51        meta: {
52          title: i18n.global.t('appPageTitle.login'),
53        },
54      },
55      {
56        path: '/change-password',
57        name: 'change-password',
58        component: ChangePassword,
59        meta: {
60          title: i18n.global.t('appPageTitle.changePassword'),
61          requiresAuth: true,
62        },
63      },
64    ],
65  },
66  {
67    path: '/console',
68    component: ConsoleLayout,
69    meta: {
70      requiresAuth: true,
71    },
72    children: [
73      {
74        path: 'serial-over-lan-console',
75        name: 'serial-over-lan-console',
76        component: SerialOverLanConsole,
77        meta: {
78          title: i18n.global.t('appPageTitle.serialOverLan'),
79        },
80      },
81      {
82        path: 'kvm',
83        name: 'kvm-console',
84        component: KvmConsole,
85        meta: {
86          title: i18n.global.t('appPageTitle.kvm'),
87        },
88      },
89    ],
90  },
91  {
92    path: '/',
93    meta: {
94      requiresAuth: true,
95    },
96    component: AppLayout,
97    children: [
98      {
99        path: '',
100        name: 'overview',
101        component: Overview,
102        meta: {
103          title: i18n.global.t('appPageTitle.overview'),
104        },
105      },
106      {
107        path: '/profile-settings',
108        name: 'profile-settings',
109        component: ProfileSettings,
110        meta: {
111          title: i18n.global.t('appPageTitle.profileSettings'),
112        },
113      },
114      {
115        path: '/logs/event-logs',
116        name: 'event-logs',
117        component: EventLogs,
118        meta: {
119          title: i18n.global.t('appPageTitle.eventLogs'),
120        },
121      },
122      {
123        path: '/logs/post-code-logs',
124        name: 'post-code-logs',
125        component: PostCodeLogs,
126        meta: {
127          title: i18n.global.t('appPageTitle.postCodeLogs'),
128        },
129      },
130      {
131        path: '/hardware-status/inventory',
132        name: 'inventory',
133        component: Inventory,
134        meta: {
135          title: i18n.global.t('appPageTitle.inventory'),
136        },
137      },
138      {
139        path: '/hardware-status/sensors',
140        name: 'sensors',
141        component: Sensors,
142        meta: {
143          title: i18n.global.t('appPageTitle.sensors'),
144        },
145      },
146      {
147        path: '/security-and-access/sessions',
148        name: 'sessions',
149        component: Sessions,
150        meta: {
151          title: i18n.global.t('appPageTitle.sessions'),
152        },
153      },
154      {
155        path: '/security-and-access/ldap',
156        name: 'ldap',
157        component: Ldap,
158        meta: {
159          title: i18n.global.t('appPageTitle.ldap'),
160        },
161      },
162      {
163        path: '/security-and-access/user-management',
164        name: 'user-management',
165        component: UserManagement,
166        meta: {
167          title: i18n.global.t('appPageTitle.userManagement'),
168        },
169      },
170      {
171        path: '/security-and-access/policies',
172        name: 'policies',
173        component: Policies,
174        meta: {
175          title: i18n.global.t('appPageTitle.policies'),
176        },
177      },
178      {
179        path: '/security-and-access/certificates',
180        name: 'certificates',
181        component: Certificates,
182        meta: {
183          title: i18n.global.t('appPageTitle.certificates'),
184        },
185      },
186      {
187        path: '/settings/date-time',
188        name: 'date-time',
189        component: DateTime,
190        meta: {
191          title: i18n.global.t('appPageTitle.dateTime'),
192        },
193      },
194      {
195        path: '/settings/snmp-alerts',
196        name: 'snmp-alerts',
197        component: SnmpAlerts,
198        meta: {
199          title: i18n.global.t('appPageTitle.snmpAlerts'),
200        },
201      },
202      {
203        path: '/operations/factory-reset',
204        name: 'factory-reset',
205        component: FactoryReset,
206        meta: {
207          title: i18n.global.t('appPageTitle.factoryReset'),
208        },
209      },
210      {
211        path: '/operations/key-clear',
212        name: 'key-clear',
213        component: KeyClear,
214        meta: {
215          title: i18n.global.t('appPageTitle.keyClear'),
216        },
217      },
218      {
219        path: '/operations/kvm',
220        name: 'kvm',
221        component: Kvm,
222        meta: {
223          title: i18n.global.t('appPageTitle.kvm'),
224        },
225      },
226      {
227        path: '/operations/firmware',
228        name: 'firmware',
229        component: Firmware,
230        meta: {
231          title: i18n.global.t('appPageTitle.firmware'),
232        },
233      },
234      {
235        path: '/settings/network',
236        name: 'network',
237        component: Network,
238        meta: {
239          title: i18n.global.t('appPageTitle.network'),
240        },
241      },
242      {
243        path: '/settings/power-restore-policy',
244        name: 'power-restore-policy',
245        component: PowerRestorePolicy,
246        meta: {
247          title: i18n.global.t('appPageTitle.powerRestorePolicy'),
248        },
249      },
250      {
251        path: '/resource-management/power',
252        name: 'power',
253        component: Power,
254        meta: {
255          title: i18n.global.t('appPageTitle.power'),
256        },
257      },
258      {
259        path: '/operations/reboot-bmc',
260        name: 'reboot-bmc',
261        component: RebootBmc,
262        meta: {
263          title: i18n.global.t('appPageTitle.rebootBmc'),
264        },
265      },
266      {
267        path: '/operations/serial-over-lan',
268        name: 'serial-over-lan',
269        component: SerialOverLan,
270        meta: {
271          title: i18n.global.t('appPageTitle.serialOverLan'),
272          exclusiveToRoles: [roles.administrator],
273        },
274      },
275      {
276        path: '/operations/server-power-operations',
277        name: 'server-power-operations',
278        component: ServerPowerOperations,
279        meta: {
280          title: i18n.global.t('appPageTitle.serverPowerOperations'),
281        },
282      },
283      {
284        path: '/operations/virtual-media',
285        name: 'virtual-media',
286        component: VirtualMedia,
287        meta: {
288          title: i18n.global.t('appPageTitle.virtualMedia'),
289          exclusiveToRoles: [roles.administrator],
290        },
291      },
292      {
293        path: '*',
294        name: 'page-not-found',
295        component: PageNotFound,
296        meta: {
297          title: i18n.global.t('appPageTitle.pageNotFound'),
298        },
299      },
300    ],
301  },
302];
303
304export { routes as default, roles };
305