mirror of https://github.com/Lissy93/dashy.git
parent
fea51a1a75
commit
83dcc37985
|
@ -19,7 +19,17 @@ import { metaTagData, startingView, routePaths } from '@/utils/defaults';
|
||||||
import ErrorHandler from '@/utils/ErrorHandler';
|
import ErrorHandler from '@/utils/ErrorHandler';
|
||||||
|
|
||||||
// Import data from users conf file. Note that rebuild is required for this to update.
|
// Import data from users conf file. Note that rebuild is required for this to update.
|
||||||
import { pages, pageInfo, appConfig } from '../public/conf.yml';
|
import conf from '../public/conf.yml';
|
||||||
|
|
||||||
|
if (!conf) {
|
||||||
|
ErrorHandler('You\'ve not got any data in your config file yet.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Assign top-level config fields, check not null
|
||||||
|
const config = conf || {};
|
||||||
|
const pages = config.pages || [];
|
||||||
|
const pageInfo = config.pageInfo || {};
|
||||||
|
const appConfig = config.appConfig || {};
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
const progress = new Progress({ color: 'var(--progress-bar)' });
|
const progress = new Progress({ color: 'var(--progress-bar)' });
|
||||||
|
|
|
@ -56,9 +56,11 @@ const store = new Vuex.Store({
|
||||||
return state.config;
|
return state.config;
|
||||||
},
|
},
|
||||||
pageInfo(state) {
|
pageInfo(state) {
|
||||||
|
if (!state.config) return {};
|
||||||
return state.config.pageInfo || {};
|
return state.config.pageInfo || {};
|
||||||
},
|
},
|
||||||
appConfig(state) {
|
appConfig(state) {
|
||||||
|
if (!state.config) return {};
|
||||||
return state.config.appConfig || {};
|
return state.config.appConfig || {};
|
||||||
},
|
},
|
||||||
sections(state) {
|
sections(state) {
|
||||||
|
@ -140,8 +142,9 @@ const store = new Vuex.Store({
|
||||||
state.config = config;
|
state.config = config;
|
||||||
},
|
},
|
||||||
[SET_REMOTE_CONFIG](state, config) {
|
[SET_REMOTE_CONFIG](state, config) {
|
||||||
if (!config.appConfig) config.appConfig = {};
|
const notNullConfig = config || {};
|
||||||
state.remoteConfig = config;
|
if (!notNullConfig.appConfig) notNullConfig.appConfig = {};
|
||||||
|
state.remoteConfig = notNullConfig;
|
||||||
},
|
},
|
||||||
[SET_LANGUAGE](state, lang) {
|
[SET_LANGUAGE](state, lang) {
|
||||||
const newConfig = state.config;
|
const newConfig = state.config;
|
||||||
|
|
|
@ -31,7 +31,11 @@ export default class ConfigAccumulator {
|
||||||
appConfig() {
|
appConfig() {
|
||||||
let appConfigFile = {};
|
let appConfigFile = {};
|
||||||
// Set app config from file
|
// Set app config from file
|
||||||
if (this.conf) appConfigFile = this.conf.appConfig || buildConf.appConfig || {};
|
if (this.conf && this.conf.appConfig) {
|
||||||
|
appConfigFile = this.conf.appConfig;
|
||||||
|
} else if (buildConf && buildConf.appConfig) {
|
||||||
|
appConfigFile = buildConf.appConfig;
|
||||||
|
}
|
||||||
// Fill in defaults if anything missing
|
// Fill in defaults if anything missing
|
||||||
let usersAppConfig = defaultAppConfig;
|
let usersAppConfig = defaultAppConfig;
|
||||||
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
if (localStorage[localStorageKeys.APP_CONFIG]) {
|
||||||
|
|
Loading…
Reference in New Issue