Adds w raw config view

This commit is contained in:
Alicia Sykes 2021-06-21 13:07:49 +01:00
parent 7ecb815ec3
commit 6d30b54612
3 changed files with 57 additions and 3 deletions

View File

@ -1,9 +1,9 @@
<template>
<div id="dashy">
<LoadingScreen :isLoading="isLoading" v-if="shouldShowSplash()" />
<Header :pageInfo="pageInfo" />
<Header :pageInfo="pageInfo" v-if="!shouldHidePageComponents()" />
<router-view />
<Footer v-if="showFooter" :text="getFooterText()" />
<Footer v-if="showFooter && !shouldHidePageComponents()" :text="getFooterText()" />
</div>
</template>
<script>
@ -48,12 +48,20 @@ export default {
return this.appConfig.showSplashScreen || !localStorage[localStorageKeys.HIDE_WELCOME_BANNER];
},
hideSplash() {
if (this.shouldShowSplash()) {
if (this.shouldShowSplash() && !this.shouldHidePageComponents()) {
setTimeout(() => { this.isLoading = false; }, splashScreenTime || 2000);
} else {
this.isLoading = false;
}
},
shouldHidePageComponents() {
return (['download'].includes(this.$route.name));
},
},
computed: {
currentRouteName() {
return this.$route.name;
},
},
mounted() {
this.hideSplash();

View File

@ -4,6 +4,7 @@ import Router from 'vue-router';
import Home from '@/views/Home.vue';
import Login from '@/views/Login.vue';
import Workspace from '@/views/Workspace.vue';
import DownloadConfig from '@/views/DownloadConfig.vue';
import { isLoggedIn } from '@/utils/Auth';
import { appConfig, pageInfo, sections } from '@/utils/ConfigAccumalator';
import { metaTagData } from '@/utils/defaults';
@ -58,6 +59,16 @@ const router = new Router({
name: 'about',
component: () => import(/* webpackChunkName: "about" */ './views/About.vue'),
},
{
path: '/download',
name: 'download',
component: DownloadConfig,
props: { appConfig, pageInfo, sections },
meta: {
title: pageInfo.title || 'Download Dashy Config',
metaTags: metaTagData,
},
},
],
});

View File

@ -0,0 +1,35 @@
<template>
<pre><code>{{ jsonParser(config) }}</code></pre>
</template>
<script>
import JsonToYaml from '@/utils/JsonToYaml';
export default {
name: 'DownloadConfig',
props: {
sections: Array,
appConfig: Object,
pageInfo: Object,
},
data() {
return {
config: {
appConfig: this.appConfig,
pageInfo: this.pageInfo,
sections: this.sections,
},
jsonParser: JsonToYaml,
};
},
};
</script>
<style scoped lang="scss">
pre {
background: var(--code-editor-background);
color: var(--code-editor-color);
padding: 1rem;
}
</style>