6 `theme-${config.theme}`,
7 isDark ? 'is-dark' : 'is-light',
8 !config.footer ? 'no-footer' : '',
11 <DynamicTheme :themes="config.colors" />
13 <section v-if="config.header" class="first-line is-hidden-touch">
14 <div v-cloak class="container">
16 <img v-if="config.logo" :src="config.logo" alt="dashboard logo" />
17 <i v-if="config.icon" :class="config.icon"></i>
19 <div class="dashboard-title">
20 <span class="headline">{{ config.subtitle }}</span>
21 <h1>{{ config.title }}</h1>
29 @navbar:toggle="showMenu = !showMenu"
30 :navigateToFirstService="navigateToFirstService"
31 :filterServices="filterServices"
33 <DarkMode @updated="isDark = $event" />
37 <section id="main-section" class="section">
38 <div v-cloak class="container">
40 v-if="config.connectivityCheck"
41 @network:status-update="offline = $event"
44 <!-- Optional messages -->
45 <Message :item="config.message" />
47 <div class="columns is-multiline">
48 <template v-for="group in services">
49 <h2 v-if="group.name" class="column is-full group-title">
50 <i v-if="group.icon" :class="group.icon"></i>
54 v-for="item in group.items"
57 class="column is-half-tablet is-one-third-widescreen is-half-desktop"
65 <footer class="footer">
66 <div class="container">
68 class="content has-text-centered"
70 v-html="config.footer"
78 const jsyaml = require("js-yaml");
79 const merge = require("lodash.merge");
81 import Navbar from "./components/Navbar.vue";
82 import ConnectivityChecker from "./components/ConnectivityChecker.vue";
83 import Service from "./components/Service.vue";
84 import Message from "./components/Message.vue";
85 import DarkMode from "./components/DarkMode.vue";
86 import DynamicTheme from "./components/DynamicTheme.vue";
88 import defaultConfig from "./assets/defaults.yml";
110 created: async function () {
111 const defaults = jsyaml.load(defaultConfig);
112 let config = await this.getConfig();
113 this.config = merge(defaults, config);
114 this.services = this.config.services;
115 document.title = `${this.config.title} | ${this.config.subtitle}`;
118 getConfig: function (path = "config.yml") {
119 return fetch(path).then((response) => {
121 throw Error(response.statusText);
128 return jsyaml.load(body);
130 .then(function (config) {
131 if (config.externalConfig) {
132 return that.getConfig(config.externalConfig);
137 return this.handleErrors("⚠️ Error loading configuration", error);
141 matchesFilter: function (item) {
143 item.name.toLowerCase().includes(this.filter) ||
144 (item.tag && item.tag.toLowerCase().includes(this.filter))
147 navigateToFirstService: function (target) {
149 const service = this.services[0].items[0];
150 window.open(service.url, target || service.target || "_self");
152 console.warning("fail to open service");
155 filterServices: function (filter) {
156 this.filter = filter;
159 this.services = this.config.services;
163 const searchResultItems = [];
164 for (const group of this.config.services) {
165 for (const item of group.items) {
166 if (this.matchesFilter(item)) {
167 searchResultItems.push(item);
175 icon: "fas fa-search",
176 items: searchResultItems,
180 handleErrors: function (title, content) {