π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
β‘ New state options for sub-config
Alicia Sykesa1bf7a69311a
diff --git a/src/components/PageStrcture/Footer.vue b/src/components/PageStrcture/Footer.vueindex 005d5ab5..b4d3883d 100644--- a/src/components/PageStrcture/Footer.vue+++ b/src/components/PageStrcture/Footer.vue@@ -10,7 +10,8 @@Get the <a :href="defaultInfo.repoUrl">Source Code</a>.</span><span>- Using: {{ $store.state.currentConfigId || 'Default Config' }}+ Using:+ {{ $store.state.currentConfigInfo? $store.state.currentConfigInfo.confId : 'Default Config' }}</span></footer></template>diff --git a/src/mixins/ConfigSaving.js b/src/mixins/ConfigSaving.jsindex 50c41fac..9357038d 100644--- a/src/mixins/ConfigSaving.js+++ b/src/mixins/ConfigSaving.js@@ -21,7 +21,7 @@ export default {return;}// 1. Get the config, and strip appConfig if is sub-page- const isSubPag = !!this.$store.state.currentConfigInfo;+ const isSubPag = !!this.$store.state.currentConfigInfo.confId;const jsonConfig = config;if (isSubPag) delete jsonConfig.appConfig;jsonConfig.sections = jsonConfig.sections.map(({ filteredItems, ...section }) => section);diff --git a/src/router.js b/src/router.jsindex c9b7f5ad..57d43783 100644--- a/src/router.js+++ b/src/router.js@@ -14,27 +14,8 @@ import Home from '@/views/Home.vue';// Import helper functions, config data and defaultsimport { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth';-import { metaTagData, startingView, routePaths } from '@/utils/defaults';+import { metaTagData, startingView as defaultStartingView, routePaths } from '@/utils/defaults';import ErrorHandler from '@/utils/ErrorHandler';-import Keys from '@/utils/StoreMutations';-// import $store from '@/store';--// Import data from users conf file. Note that rebuild is required for this to update.-// import conf from '../public/conf.yml';--// this.$store.dispatch(Keys.INITIALIZE_CONFIG, undefined);-// const conf = $store.getters.config;--// if (!conf) {-// ErrorHandler('You\'ve not got any data in your config file yet.');-// }--// console.log($store.state.config);--// Assign top-level config fields, check not null-// const config = conf || {};-const pageInfo = {};-const appConfig = {};Vue.use(Router);const progress = new Progress({ color: 'var(--progress-bar)' });@@ -47,18 +28,15 @@ const isAuthenticated = () => {return (!authEnabled || userLoggedIn || guestEnabled);};-// appConfig.auth, appConfig.startingView, appConfig.routingMode, pageInfo.title--/* Get the users chosen starting view from app config, or return default */-const getStartingView = () => appConfig.startingView || startingView;+// Get the default starting view from environmental variable+const startingView = process.env.VUE_APP_STARTING_VIEW || defaultStartingView;/*** Returns the component that should be rendered at the base path,* Defaults to Home, but the user can change this to Workspace of Minimal*/const getStartingComponent = () => {- const usersPreference = getStartingView();- switch (usersPreference) {+ switch (startingView) {case 'minimal': return () => import('./views/Minimal.vue');case 'workspace': return () => import('./views/Workspace.vue');default: return Home;@@ -66,13 +44,14 @@ const getStartingComponent = () => {};/* Returns the meta tags for each route */-const makeMetaTags = (defaultTitle) => ({- title: pageInfo.title || defaultTitle,- metaTags: metaTagData,-});+const makeMetaTags = (defaultTitle) => {+ const userTitle = process.env.VUE_APP_TITLE || '';+ const title = userTitle ? `${userTitle} | ${defaultTitle}` : defaultTitle;+ return { title, metaTags: metaTagData };+};/* Routing mode, can be either 'hash', 'history' or 'abstract' */-const mode = appConfig.routingMode || 'history';+const mode = process.env.VUE_APP_ROUTING_MODE || 'history';/* List of all routes, props, components and metadata */const router = new Router({@@ -81,7 +60,7 @@ const router = new Router({// ...makeMultiPageRoutes(pages),{ // The default view can be customized by the userpath: '/',- name: `landing-page-${getStartingView()}`,+ name: `landing-page-${startingView}`,component: getStartingComponent(),meta: makeMetaTags('Home Page'),},@@ -157,10 +136,6 @@ const router = new Router({* */router.beforeEach(async (to, from, next) => {progress.start();- router.app.$store.dispatch(Keys.INITIALIZE_CONFIG, null).then((finished) => {- console.log('Done!', finished);- });- await console.log('router.app.$store', router.app.$store.getters.config);if (to.name !== 'login' && !isAuthenticated()) next({ name: 'login' });else next();});diff --git a/src/utils/ConfigAccumalator.js b/src/utils/ConfigAccumalator.jsindex 25c1c45a..337d5c4f 100644--- a/src/utils/ConfigAccumalator.js+++ b/src/utils/ConfigAccumalator.js@@ -16,8 +16,6 @@ import ErrorHandler from '@/utils/ErrorHandler';import { applyItemId } from '@/utils/SectionHelpers';import $store from '@/store';-// import buildConf from '../../public/conf.yml';-export default class ConfigAccumulator {constructor() {this.conf = $store.state.config;