styling, restructure
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Timo Hocker 2020-08-30 15:28:27 +02:00
parent ca305dff73
commit cf5c17bf59
9 changed files with 198 additions and 51 deletions

View File

@ -1,34 +1,15 @@
<template>
<div id="app">
<p
id="build-info"
v-text="version"
/>
<Style />
<router-view />
</div>
</template>
<script>
import version from '../version';
import Style from './Style.vue';
export default {
data () {
return { version: `build: ${version}` };
}
};
export default { components: { Style } };
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#build-info {
font-size: 10pt;
text-align: left;
}
<style scoped>
</style>

89
src/Style.vue Normal file
View File

@ -0,0 +1,89 @@
<template>
<div :class="classes" />
</template>
<script>
import Vuex from 'vuex';
export default {
computed: {
classes () {
if (this.theme !== '')
return { [this.theme]: true };
return {};
},
...Vuex.mapState ({ theme: (state) => state.theme })
}
};
</script>
<style>
:root {
/* generated with adobe color (compound) */
--Color-A: #1254B8;
--Color-B: #355585;
--Color-C: #00D8EB;
--Color-D: #F0632F;
--Color-E: #BD311E;
--Color-0: #000;
--Color-1: #222;
--color-background: var(--Color-0);
--color-background-1: var(--Color-1);
--color-foreground: var(--Color-B);
--color-contrast: var(--Color-A);
--color-high-contrast: var(--Color-C);
--color-focus: var(--Color-D);
--color-accent: var(--Color-E);
--background: var(--color-background);
--background-1: var(--color-background-1);
--container-border: 1px solid var(--color-high-contrast);
--sub-container-border: 1px solid var(--color-contrast);
--accent-border: 1px solid var(--color-accent);
--font-family: Avenir, Helvetica, Arial, sans-serif;
}
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: var(--background);
color: var(--color-foreground);
font-family: var(--font-family);
}
button {
border: var(--accent-border);
background: inherit;
color: inherit;
cursor: pointer;
transition:
border-color ease-in-out .1s,
color ease-in-out .1s;
}
button:hover {
border-color: var(--color-focus);
color: var(--color-focus);
}
input {
border: var(--accent-border);
background: inherit;
color: inherit;
}
select {
border: var(--accent-border);
background: inherit;
color: inherit;
}
select > option {
background: var(--background-1);
color: var(--color-foreground);
font-weight: bold;
}
</style>

View File

@ -18,13 +18,19 @@
<script>
import Vuex from 'vuex';
import { copy_object } from '@sapphirecode/utilities';
import ViewComponent from '../components/ViewComponent.vue';
import ConfigEditor from '../components/ConfigEditor.vue';
import default_config from '../default';
import default_template from '../template';
import ViewComponent from './ViewComponent.vue';
import ConfigEditor from './ConfigEditor.vue';
export default {
components: { ViewComponent, ConfigEditor },
props: {
app: {
type: Number,
required: true
}
},
data () {
return {
config: copy_object (default_config),
@ -55,7 +61,7 @@ export default {
},
fetch_log () {
this.get_log ({
app_id: this.$route.params.id,
app_id: this.app,
sources: this.saved_config.sources
});
},
@ -72,8 +78,4 @@ export default {
width: 100%;
height: 100%;
}
p {
display: inline-block;
}
</style>

View File

@ -196,7 +196,7 @@ export default {
}
.editor {
border: 1px solid black;
border: var(--sub-container-border);
margin-left: 10px;
grid-column: editor;
}

View File

@ -39,7 +39,6 @@ export default {
<style>
.table_view {
overflow: auto;
border: 1px solid blue;
width: max-content;
max-width: 100%;
max-height: 100vh;
@ -51,11 +50,12 @@ table {
}
tr:nth-child(odd) {
background-color: #ddd;
background-color: var(--color-background-1);
color: var(--color-accent);
}
td {
border: 1px solid black;
margin: 0;
border: var(--sub-container-border);
padding: 3px;
}
</style>

View File

@ -32,6 +32,5 @@ export default {
};
</script>
<style>
<style scoped>
</style>

View File

@ -9,7 +9,6 @@
import Vue from 'vue';
import VueRouter from 'vue-router';
import AppView from '../views/AppView.vue';
import NotFound from '../views/NotFound.vue';
import Home from '../views/Home.vue';
@ -23,8 +22,7 @@ const routes = [
},
{
path: '/app/:id',
name: 'AppView',
component: AppView
redirect: '/'
},
{
path: '/404',

View File

@ -8,10 +8,12 @@
import Vue from 'vue';
import Vuex from 'vuex';
import version from '../../version';
Vue.use (Vuex);
export default new Vuex.Store ({
state: { log: {} },
state: { log: {}, version, theme: '' },
mutations: {
set_log (state, log) {
state.log = log;

View File

@ -1,21 +1,49 @@
<template>
<ul>
<li
v-for="(app,key) in apps"
:key="key"
>
<a
:href="'/app/' + app.id"
<div class="main_view">
<div class="app_list">
<div
v-for="(app,key) in apps"
:key="key"
class="app_list_item"
@click="active = app.id"
v-text="app.name"
/>
</li>
</ul>
</div>
<div class="data_view">
<AppView
v-if="active !== null"
class="data_view_display"
:app="active"
/>
<p
v-else
class="info"
>
Select an app to view its Reports
</p>
</div>
<div class="footer">
<p
class="build_info"
v-text="version"
/>
</div>
</div>
</template>
<script>
import Vuex from 'vuex';
import AppView from '../components/AppView.vue';
export default {
components: { AppView },
data () {
return { apps: [] };
return { apps: [], active: null };
},
computed: {
...Vuex.mapState (
{ version: ({ version }) => `appreports build: ${version}` }
)
},
async mounted () {
this.apps = await fetch ('/app')
@ -25,5 +53,53 @@ export default {
</script>
<style>
.main_view {
display: grid;
grid-template-areas:
'sidebar main'
'footer footer';
grid-template-columns: minmax(min-content,max-content) 1fr;
grid-template-rows: minmax(80vh, auto) 1fr;
}
.app_list {
grid-area: sidebar;
border: var(--container-border);
}
.app_list_item {
cursor: pointer;
margin: 0;
padding: 5px;
border: var(--sub-container-border);
transition: .1s color ease-in-out;
}
.app_list_item:hover {
color: var(--color-focus);
}
.app_list_item:active {
color: var(--color-accent);
}
.data_view {
grid-area: main;
border: var(--container-border);
padding: 10px;
}
.footer {
grid-area: footer;
}
.info {
color: var(--color-focus);
}
.build_info {
font-size: 10pt;
text-align: left;
}
</style>