summaryrefslogtreecommitdiff
path: root/src/router
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-09-03 21:19:28 +0300
committerGunnar Mills <gmills@us.ibm.com>2020-09-25 03:00:26 +0300
commit816d947ef553feacc3d3a5c8e6fc91c8dc2976ba (patch)
tree11135bc8fba51cfec0bbccc20e144e9f1fbb183a /src/router
parent9b22b49232da67bd15e04193006ce881a93265c0 (diff)
downloadwebui-vue-816d947ef553feacc3d3a5c8e6fc91c8dc2976ba.tar.xz
Create separate file for Vue Router routes
Separating routes into its own JS file to allow for easier env customizations. Update store resolve path to make sure right env stores modules are imported in every file. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I5c646c81fab54085198b2e179be80c954258f51c
Diffstat (limited to 'src/router')
-rw-r--r--src/router/index.js252
-rw-r--r--src/router/routes.js251
2 files changed, 253 insertions, 250 deletions
diff --git a/src/router/index.js b/src/router/index.js
index 68340452..6db80b70 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -1,258 +1,10 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
-import store from '../store/index';
-import AppLayout from '../layouts/AppLayout.vue';
-import LoginLayout from '@/layouts/LoginLayout';
-import ConsoleLayout from '@/layouts/ConsoleLayout.vue';
-import Overview from '@/views/Overview';
-import ProfileSettings from '@/views/ProfileSettings';
-import EventLogs from '@/views/Health/EventLogs';
-import HardwareStatus from '@/views/Health/HardwareStatus';
-import Sensors from '@/views/Health/Sensors';
-import Ldap from '@/views/AccessControl/Ldap';
-import LocalUserManagement from '@/views/AccessControl/LocalUserManagement';
-import SslCertificates from '@/views/AccessControl/SslCertificates';
-import DateTimeSettings from '@/views/Configuration/DateTimeSettings';
-import Firmware from '@/views/Configuration/Firmware';
-import Kvm from '@/views/Control/Kvm';
-import ManagePowerUsage from '@/views/Control/ManagePowerUsage';
-import NetworkSettings from '@/views/Configuration/NetworkSettings';
-import PageNotFound from '@/views/PageNotFound';
-import RebootBmc from '@/views/Control/RebootBmc';
-import ServerLed from '@/views/Control/ServerLed';
-import SerialOverLan from '@/views/Control/SerialOverLan';
-import ServerPowerOperations from '@/views/Control/ServerPowerOperations';
-import Unauthorized from '@/views/Unauthorized';
-import Login from '@/views/Login';
-import ChangePassword from '@/views/ChangePassword';
-import SerialOverLanConsole from '@/views/Control/SerialOverLan/SerialOverLanConsole';
-import KvmConsole from '@/views/Control/Kvm/KvmConsole';
-import VirtualMedia from '@/views/Control/VirtualMedia';
+import store from '../store';
+import routes from './routes';
Vue.use(VueRouter);
-// Meta title is translated using i18n in App.vue and PageTitle.Vue
-// Example meta: {title: 'appPageTitle.overview'}
-const routes = [
- {
- path: '/login',
- component: LoginLayout,
- children: [
- {
- path: '',
- name: 'login',
- component: Login,
- meta: {
- title: 'appPageTitle.login'
- }
- },
- {
- path: '/change-password',
- name: 'change-password',
- component: ChangePassword,
- meta: {
- title: 'appPageTitle.changePassword',
- requiresAuth: true
- }
- }
- ]
- },
- {
- path: '/console',
- component: ConsoleLayout,
- meta: {
- requiresAuth: true
- },
- children: [
- {
- path: 'serial-over-lan-console',
- name: 'serial-over-lan-console',
- component: SerialOverLanConsole,
- meta: {
- title: 'appPageTitle.serialOverLan'
- }
- },
- {
- path: 'kvm',
- name: 'kvm-console',
- component: KvmConsole,
- meta: {
- title: 'appPageTitle.kvm'
- }
- }
- ]
- },
- {
- path: '/',
- meta: {
- requiresAuth: true
- },
- component: AppLayout,
- children: [
- {
- path: '',
- name: 'overview',
- component: Overview,
- meta: {
- title: 'appPageTitle.overview'
- }
- },
- {
- path: '/profile-settings',
- name: 'profile-settings',
- component: ProfileSettings,
- meta: {
- title: 'appPageTitle.profileSettings'
- }
- },
- {
- path: '/health/event-logs',
- name: 'event-logs',
- component: EventLogs,
- meta: {
- title: 'appPageTitle.eventLogs'
- }
- },
- {
- path: '/health/hardware-status',
- name: 'hardware-status',
- component: HardwareStatus,
- meta: {
- title: 'appPageTitle.hardwareStatus'
- }
- },
- {
- path: '/health/sensors',
- name: 'sensors',
- component: Sensors,
- meta: {
- title: 'appPageTitle.sensors'
- }
- },
- {
- path: '/access-control/ldap',
- name: 'ldap',
- component: Ldap,
- meta: {
- title: 'appPageTitle.ldap'
- }
- },
- {
- path: '/access-control/local-user-management',
- name: 'local-users',
- component: LocalUserManagement,
- meta: {
- title: 'appPageTitle.localUserManagement'
- }
- },
- {
- path: '/access-control/ssl-certificates',
- name: 'ssl-certificates',
- component: SslCertificates,
- meta: {
- title: 'appPageTitle.sslCertificates'
- }
- },
- {
- path: '/configuration/date-time-settings',
- name: 'date-time-settings',
- component: DateTimeSettings,
- meta: {
- title: 'appPageTitle.dateTimeSettings'
- }
- },
- {
- path: '/configuration/firmware',
- name: 'firmware',
- component: Firmware,
- meta: {
- title: 'appPageTitle.firmware'
- }
- },
- {
- path: '/control/kvm',
- name: 'kvm',
- component: Kvm,
- meta: {
- title: 'appPageTitle.kvm'
- }
- },
- {
- path: '/control/manage-power-usage',
- name: 'manage-power-usage',
- component: ManagePowerUsage,
- meta: {
- title: 'appPageTitle.managePowerUsage'
- }
- },
- {
- path: '/configuration/network-settings',
- name: 'network-settings',
- component: NetworkSettings,
- meta: {
- title: 'appPageTitle.networkSettings'
- }
- },
- {
- path: '/control/reboot-bmc',
- name: 'reboot-bmc',
- component: RebootBmc,
- meta: {
- title: 'appPageTitle.rebootBmc'
- }
- },
- {
- path: '/control/server-led',
- name: 'server-led',
- component: ServerLed,
- meta: {
- title: 'appPageTitle.serverLed'
- }
- },
- {
- path: '/control/serial-over-lan',
- name: 'serial-over-lan',
- component: SerialOverLan,
- meta: {
- title: 'appPageTitle.serialOverLan'
- }
- },
- {
- path: '/control/server-power-operations',
- name: 'server-power-operations',
- component: ServerPowerOperations,
- meta: {
- title: 'appPageTitle.serverPowerOperations'
- }
- },
- {
- path: '/control/virtual-media',
- name: 'virtual-media',
- component: VirtualMedia,
- meta: {
- title: 'appPageTitle.virtualMedia'
- }
- },
- {
- path: '/unauthorized',
- name: 'unauthorized',
- component: Unauthorized,
- meta: {
- title: 'appPageTitle.unauthorized'
- }
- },
- {
- path: '*',
- name: 'page-not-found',
- component: PageNotFound,
- meta: {
- title: 'appPageTitle.pageNotFound'
- }
- }
- ]
- }
-];
-
const router = new VueRouter({
base: process.env.BASE_URL,
routes,
diff --git a/src/router/routes.js b/src/router/routes.js
new file mode 100644
index 00000000..d187713a
--- /dev/null
+++ b/src/router/routes.js
@@ -0,0 +1,251 @@
+import AppLayout from '@/layouts/AppLayout.vue';
+import ChangePassword from '@/views/ChangePassword';
+import ConsoleLayout from '@/layouts/ConsoleLayout.vue';
+import DateTimeSettings from '@/views/Configuration/DateTimeSettings';
+import EventLogs from '@/views/Health/EventLogs';
+import Firmware from '@/views/Configuration/Firmware';
+import HardwareStatus from '@/views/Health/HardwareStatus';
+import Kvm from '@/views/Control/Kvm';
+import KvmConsole from '@/views/Control/Kvm/KvmConsole';
+import Ldap from '@/views/AccessControl/Ldap';
+import LocalUserManagement from '@/views/AccessControl/LocalUserManagement';
+import Login from '@/views/Login';
+import LoginLayout from '@/layouts/LoginLayout';
+import ManagePowerUsage from '@/views/Control/ManagePowerUsage';
+import NetworkSettings from '@/views/Configuration/NetworkSettings';
+import Overview from '@/views/Overview';
+import PageNotFound from '@/views/PageNotFound';
+import ProfileSettings from '@/views/ProfileSettings';
+import RebootBmc from '@/views/Control/RebootBmc';
+import Sensors from '@/views/Health/Sensors';
+import SerialOverLan from '@/views/Control/SerialOverLan';
+import SerialOverLanConsole from '@/views/Control/SerialOverLan/SerialOverLanConsole';
+import ServerLed from '@/views/Control/ServerLed';
+import ServerPowerOperations from '@/views/Control/ServerPowerOperations';
+import SslCertificates from '@/views/AccessControl/SslCertificates';
+import Unauthorized from '@/views/Unauthorized';
+import VirtualMedia from '@/views/Control/VirtualMedia';
+
+// Meta title is translated using i18n in App.vue and PageTitle.Vue
+// Example meta: {title: 'appPageTitle.overview'}
+const routes = [
+ {
+ path: '/login',
+ component: LoginLayout,
+ children: [
+ {
+ path: '',
+ name: 'login',
+ component: Login,
+ meta: {
+ title: 'appPageTitle.login'
+ }
+ },
+ {
+ path: '/change-password',
+ name: 'change-password',
+ component: ChangePassword,
+ meta: {
+ title: 'appPageTitle.changePassword',
+ requiresAuth: true
+ }
+ }
+ ]
+ },
+ {
+ path: '/console',
+ component: ConsoleLayout,
+ meta: {
+ requiresAuth: true
+ },
+ children: [
+ {
+ path: 'serial-over-lan-console',
+ name: 'serial-over-lan-console',
+ component: SerialOverLanConsole,
+ meta: {
+ title: 'appPageTitle.serialOverLan'
+ }
+ },
+ {
+ path: 'kvm',
+ name: 'kvm-console',
+ component: KvmConsole,
+ meta: {
+ title: 'appPageTitle.kvm'
+ }
+ }
+ ]
+ },
+ {
+ path: '/',
+ meta: {
+ requiresAuth: true
+ },
+ component: AppLayout,
+ children: [
+ {
+ path: '',
+ name: 'overview',
+ component: Overview,
+ meta: {
+ title: 'appPageTitle.overview'
+ }
+ },
+ {
+ path: '/profile-settings',
+ name: 'profile-settings',
+ component: ProfileSettings,
+ meta: {
+ title: 'appPageTitle.profileSettings'
+ }
+ },
+ {
+ path: '/health/event-logs',
+ name: 'event-logs',
+ component: EventLogs,
+ meta: {
+ title: 'appPageTitle.eventLogs'
+ }
+ },
+ {
+ path: '/health/hardware-status',
+ name: 'hardware-status',
+ component: HardwareStatus,
+ meta: {
+ title: 'appPageTitle.hardwareStatus'
+ }
+ },
+ {
+ path: '/health/sensors',
+ name: 'sensors',
+ component: Sensors,
+ meta: {
+ title: 'appPageTitle.sensors'
+ }
+ },
+ {
+ path: '/access-control/ldap',
+ name: 'ldap',
+ component: Ldap,
+ meta: {
+ title: 'appPageTitle.ldap'
+ }
+ },
+ {
+ path: '/access-control/local-user-management',
+ name: 'local-users',
+ component: LocalUserManagement,
+ meta: {
+ title: 'appPageTitle.localUserManagement'
+ }
+ },
+ {
+ path: '/access-control/ssl-certificates',
+ name: 'ssl-certificates',
+ component: SslCertificates,
+ meta: {
+ title: 'appPageTitle.sslCertificates'
+ }
+ },
+ {
+ path: '/configuration/date-time-settings',
+ name: 'date-time-settings',
+ component: DateTimeSettings,
+ meta: {
+ title: 'appPageTitle.dateTimeSettings'
+ }
+ },
+ {
+ path: '/configuration/firmware',
+ name: 'firmware',
+ component: Firmware,
+ meta: {
+ title: 'appPageTitle.firmware'
+ }
+ },
+ {
+ path: '/control/kvm',
+ name: 'kvm',
+ component: Kvm,
+ meta: {
+ title: 'appPageTitle.kvm'
+ }
+ },
+ {
+ path: '/control/manage-power-usage',
+ name: 'manage-power-usage',
+ component: ManagePowerUsage,
+ meta: {
+ title: 'appPageTitle.managePowerUsage'
+ }
+ },
+ {
+ path: '/configuration/network-settings',
+ name: 'network-settings',
+ component: NetworkSettings,
+ meta: {
+ title: 'appPageTitle.networkSettings'
+ }
+ },
+ {
+ path: '/control/reboot-bmc',
+ name: 'reboot-bmc',
+ component: RebootBmc,
+ meta: {
+ title: 'appPageTitle.rebootBmc'
+ }
+ },
+ {
+ path: '/control/server-led',
+ name: 'server-led',
+ component: ServerLed,
+ meta: {
+ title: 'appPageTitle.serverLed'
+ }
+ },
+ {
+ path: '/control/serial-over-lan',
+ name: 'serial-over-lan',
+ component: SerialOverLan,
+ meta: {
+ title: 'appPageTitle.serialOverLan'
+ }
+ },
+ {
+ path: '/control/server-power-operations',
+ name: 'server-power-operations',
+ component: ServerPowerOperations,
+ meta: {
+ title: 'appPageTitle.serverPowerOperations'
+ }
+ },
+ {
+ path: '/control/virtual-media',
+ name: 'virtual-media',
+ component: VirtualMedia,
+ meta: {
+ title: 'appPageTitle.virtualMedia'
+ }
+ },
+ {
+ path: '/unauthorized',
+ name: 'unauthorized',
+ component: Unauthorized,
+ meta: {
+ title: 'appPageTitle.unauthorized'
+ }
+ },
+ {
+ path: '*',
+ name: 'page-not-found',
+ component: PageNotFound,
+ meta: {
+ title: 'appPageTitle.pageNotFound'
+ }
+ }
+ ]
+ }
+];
+
+export default routes;