From bc54529444ce187560670c5898f22b6a81afca48 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Tue, 25 Feb 2020 19:43:34 -0500 Subject: [PATCH] remove sidebar, use app-icon style navigation --- package.json | 1 - src/_helpers/router.js | 67 ++++++++----------- src/_store/system.module.js | 118 ++++++++++++++++++---------------- src/account/DashboardPage.vue | 57 ++++++++++++++++ src/account/HomePage.vue | 7 +- src/app/App.vue | 16 +++-- src/index.html | 14 ++++ src/index.js | 2 - 8 files changed, 177 insertions(+), 105 deletions(-) create mode 100644 src/account/DashboardPage.vue diff --git a/package.json b/package.json index 6a6fac5..de710dc 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "vue-datetime": "^1.0.0-beta.11", "vue-router": "^3.0.6", "vue-select": "^3.4.0", - "vue-sidebar-menu": "^4.4.3", "vuex": "^3.1.1" }, "devDependencies": { diff --git a/src/_helpers/router.js b/src/_helpers/router.js index 5ba7de9..616f0be 100644 --- a/src/_helpers/router.js +++ b/src/_helpers/router.js @@ -1,13 +1,13 @@ import Vue from 'vue'; import Router from 'vue-router'; -import HomePage from '../account/HomePage' import ActivationPage from '../auth/ActivationPage' import ModelSetupPage from '../admin/ModelSetupPage' import RegisterPage from '../auth/RegisterPage' import LoginPage from '../auth/LoginPage' import LogoutPage from '../auth/LogoutPage' import MultifactorAuthPage from '../auth/MultifactorAuthPage' +import DashboardPage from '../account/DashboardPage' import ProfilePage from '../account/profile/ProfilePage' import ActionPage from '../account/profile/ActionPage' import PolicyPage from '../account/profile/PolicyPage' @@ -57,50 +57,39 @@ const newNetworkChildren = [ export const router = new Router({ mode: 'history', routes: [ + { path: '', component: DashboardPage }, + { path: '/', component: DashboardPage }, + + { path: '/me', component: ProfilePage }, + { path: '/me/policy', component: PolicyPage }, + { path: '/me/action', component: ActionPage }, + { path: '/me/changePassword', component: ChangePasswordPage }, + { path: '/me/setPassword/:code', component: SetPasswordPage }, + { path: '/me/keys', component: SshKeysPage }, + { path: '/me/bills', component: BillsPage }, + { path: '/me/payment', component: PaymentMethodsPage, children: paymentMethodsChildren }, + { path: '/devices', component: DevicesPage }, + { path: '/apps', component: AppsPage }, + { path: '/app/:app', component: AppPage }, + { path: '/app/:app/config/:view', component: AppConfigPage }, + { path: '/app/:app/config/:view/:item', component: AppConfigPage }, + { path: '/app/:app/view/:view', component: AppDataViewPage }, + { path: '/app/:app/site/:site', component: AppSitePage }, + { path: '/app/:app/site/:site/view/:view', component: AppDataViewPage }, + { path: '/notifications', component: NotificationsPage }, { - path: '/', component: HomePage, + path: '/bubbles', component: NetworksPage , children: [ { - path: '', component: NetworksPage, - children: [ - { - path: '', component: NewNetworkPage, - children: newNetworkChildren - }, - ] - }, - { path: '/me', component: ProfilePage }, - { path: '/me/policy', component: PolicyPage }, - { path: '/me/action', component: ActionPage }, - { path: '/me/changePassword', component: ChangePasswordPage }, - { path: '/me/setPassword/:code', component: SetPasswordPage }, - { path: '/me/keys', component: SshKeysPage }, - { path: '/me/bills', component: BillsPage }, - { path: '/me/payment', component: PaymentMethodsPage, children: paymentMethodsChildren }, - { path: '/devices', component: DevicesPage }, - { path: '/apps', component: AppsPage }, - { path: '/app/:app', component: AppPage }, - { path: '/app/:app/config/:view', component: AppConfigPage }, - { path: '/app/:app/config/:view/:item', component: AppConfigPage }, - { path: '/app/:app/view/:view', component: AppDataViewPage }, - { path: '/app/:app/site/:site', component: AppSitePage }, - { path: '/app/:app/site/:site/view/:view', component: AppDataViewPage }, - { path: '/notifications', component: NotificationsPage }, - { - path: '/bubbles', component: NetworksPage , - children: [ - { - path: '', component: NewNetworkPage, - children: newNetworkChildren - }, - ] - }, - { path: '/new_bubble', component: NewNetworkPage, + path: '', component: NewNetworkPage, children: newNetworkChildren }, - { path: '/bubble/:id', component: NetworkPage } ] }, + { path: '/new_bubble', component: NewNetworkPage, + children: newNetworkChildren + }, + { path: '/bubble/:id', component: NetworkPage }, { path: '/action', component: ActionPage }, { path: '/activate', component: ActivationPage }, @@ -119,7 +108,7 @@ export const router = new Router({ { path: '/admin/accounts/:id/payment', component: PaymentMethodsPage, children: paymentMethodsChildren }, { path: '/admin/model', component: ModelSetupPage }, - // otherwise redirect to home + // otherwise redirect to dashboard { path: '*', redirect: '/' } ] }); diff --git a/src/_store/system.module.js b/src/_store/system.module.js index b3a3564..a60ad98 100644 --- a/src/_store/system.module.js +++ b/src/_store/system.module.js @@ -8,6 +8,7 @@ const state = { allowRegistration: false, paymentsEnabled: false, sageLauncher: false, + bubbleNode: null, entityClasses: [], locales: ['en_US'], cloudConfigs: {}, @@ -142,84 +143,93 @@ const actions = { }; const getters = { - menu: function () { + dashboardApps: function () { const configs = state.configs; const messages = state.messages; - const menu = [{ - href: '/', - title: messages.label_menu_dashboard, - icon: messages.label_menu_dashboard_icon - }, { + const isAdmin = account.state.user.admin === true; + const dashApps = []; + dashApps.push({ href: '/me', title: messages.label_menu_account, - icon: messages.label_menu_account_icon - // }, { - // href: '/notifications', - // title: messages.label_menu_notifications, - // icon: messages.label_menu_notifications_icon - }]; + icon: messages.label_menu_account_icon, + index: 0 + }); if (configs.sageLauncher) { - menu.splice(2, 0, { - href: '/me/bubbles', + dashApps.push({ + href: '/bubbles', title: messages.label_menu_networks, - icon: messages.label_menu_networks_icon + icon: messages.label_menu_networks_icon, + index: 1 }); - if (account.state.user.admin === true) { - menu.splice(3, 0, { - href: '/apps', - title: messages.label_menu_apps, - icon: messages.label_menu_apps_icon - }); - } } else { - menu.splice(2, 0, { + dashApps.push({ href: '/devices', title: messages.label_menu_devices, - icon: messages.label_menu_devices_icon + icon: messages.label_menu_devices_icon, + index: 2 }); - menu.splice(3, 0, { + dashApps.push({ href: '/apps', title: messages.label_menu_apps, - icon: messages.label_menu_apps_icon + icon: messages.label_menu_apps_icon, + index: 3 }); } - if (account.state.user.admin === true) { - const admin_menu = { - href: '/admin', - title: messages.label_menu_admin, - icon: messages.label_menu_admin_icon, - child: [{ - href: '/admin/accounts', - title: messages.label_menu_admin_users, - icon: messages.label_menu_admin_users_icon - }, { - href: '/admin/model', - title: messages.label_menu_admin_model, - icon: messages.label_menu_admin_model_icon - }] - }; - menu.splice(1, 0, admin_menu); - if (configs.sageLauncher) { - admin_menu.child.push({ - href: '/admin/bubbles', - title: messages.label_menu_admin_networks, - icon: messages.label_menu_admin_networks_icon - }); - } + if (isAdmin && configs.sageLauncher) { + const adminApps = [{ + href: '/', + title: messages.label_menu_dashboard, + icon: messages.label_menu_dashboard_icon, + index: 0 + }]; + adminApps.push({ + href: '/admin/accounts', + title: messages.label_menu_admin_users, + icon: messages.label_menu_admin_users_icon, + index: 1 + }); + adminApps.push({ + href: '/admin/model', + title: messages.label_menu_admin_model, + icon: messages.label_menu_admin_model_icon, + index: 2 + }); + adminApps.push({ + href: '/admin/bubbles', + title: messages.label_menu_admin_networks, + icon: messages.label_menu_admin_networks_icon, + index: 3 + }); if (configs.paymentsEnabled) { - admin_menu.child.push({ + adminApps.push({ href: '/admin/bills', title: messages.label_menu_admin_bills, - icon: messages.label_menu_admin_bills_icon + icon: messages.label_menu_admin_bills_icon, + index: 4 }); } + dashApps.push({ + href: '/?app=admin', + title: messages.label_menu_admin, + icon: messages.label_menu_admin_icon, + index: 4, + apps: adminApps + }); + } else if (isAdmin) { + dashApps.push({ + href: '/admin/accounts', + title: messages.label_menu_admin_users, + icon: messages.label_menu_admin_users_icon, + index: 4 + }); } - menu.push({ + dashApps.push({ href: '/logout', title: messages.label_menu_logout, - icon: messages.label_menu_logout_icon + icon: messages.label_menu_logout_icon, + index: 1000 }); - return menu; + return dashApps; }, promoCodesEnabled: function () { return state.promoCodePolicy === 'required' || state.promoCodePolicy === 'optional'; }, promoCodeRequired: function () { return state.promoCodePolicy === 'required'; } diff --git a/src/account/DashboardPage.vue b/src/account/DashboardPage.vue new file mode 100644 index 0000000..4e91ef0 --- /dev/null +++ b/src/account/DashboardPage.vue @@ -0,0 +1,57 @@ + + + \ No newline at end of file diff --git a/src/account/HomePage.vue b/src/account/HomePage.vue index f528454..778bcd0 100644 --- a/src/account/HomePage.vue +++ b/src/account/HomePage.vue @@ -1,14 +1,15 @@