X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FApp.vue;h=9b4803f2d04005e1092c3846ee9baa68998f8acf;hb=584f2b4b32e69865d9561f1537142791710f676d;hp=d97df0cc18d1f5ad5ff1af3ba5f8c8b1a059619c;hpb=ed8b17e0df7ffa64e392bacbd2abf6492fdfb3f1;p=github%2Fbastienwirtz%2Fhomer.git diff --git a/src/App.vue b/src/App.vue index d97df0c..9b4803f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,7 +13,9 @@
@@ -39,6 +41,7 @@

+ {{ group.name }}

@@ -85,12 +93,17 @@ >

+ {{ group.name }}

@@ -149,28 +162,41 @@ export default { }; }, created: async function () { - const defaults = jsyaml.load(defaultConfig); - let config; - try { - config = await this.getConfig(); - } catch (error) { - console.log(error); - config = this.handleErrors("⚠️ Error loading configuration", error); - } - this.config = merge(defaults, config); - this.services = this.config.services; - document.title = - this.config.documentTitle || - `${this.config.title} | ${this.config.subtitle}`; - if (this.config.stylesheet) { - let stylesheet = ""; - for (const file of this.config.stylesheet) { - stylesheet += `@import "${file}";`; - } - this.createStylesheet(stylesheet); - } + this.buildDashboard(); + window.onhashchange = this.buildDashboard; }, methods: { + buildDashboard: async function () { + const defaults = jsyaml.load(defaultConfig); + let config; + try { + config = await this.getConfig(); + const path = + window.location.hash.substring(1) != "" + ? window.location.hash.substring(1) + : null; + + if (path) { + let pathConfig = await this.getConfig(`assets/${path}.yml`); // the slash (/) is included in the pathname + config = Object.assign(config, pathConfig); + } + } catch (error) { + console.log(error); + config = this.handleErrors("⚠️ Error loading configuration", error); + } + this.config = merge(defaults, config); + this.services = this.config.services; + document.title = + this.config.documentTitle || + `${this.config.title} | ${this.config.subtitle}`; + if (this.config.stylesheet) { + let stylesheet = ""; + for (const file of this.config.stylesheet) { + stylesheet += `@import "${file}";`; + } + this.createStylesheet(stylesheet); + } + }, getConfig: function (path = "assets/config.yml") { return fetch(path).then((response) => { if (response.redirected) { @@ -199,6 +225,7 @@ export default { matchesFilter: function (item) { return ( item.name.toLowerCase().includes(this.filter) || + (item.subtitle && item.subtitle.toLowerCase().includes(this.filter)) || (item.tag && item.tag.toLowerCase().includes(this.filter)) ); },