advent22/ui/src/components/ConfigView.vue

215 lines
5.6 KiB
Vue
Raw Normal View History

2023-09-10 03:10:22 +00:00
<template>
2023-09-10 03:38:24 +00:00
<BulmaDrawer header="Konfiguration">
2023-09-10 03:25:12 +00:00
<div class="card-content">
2023-09-10 03:38:24 +00:00
<div class="columns">
<div class="column is-one-third">
<div class="content">
<h4>Rätsel</h4>
<dl>
<dt>Titel</dt>
2023-09-12 13:59:47 +00:00
<!-- TODO -->
<dd>Adventskalender 2023</dd>
<dt>Lösung</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.puzzle.solution }}</dd>
2023-09-10 03:10:22 +00:00
<dt>Reihenfolge</dt>
2023-09-12 07:27:59 +00:00
<dd>
<template
2023-09-12 14:55:08 +00:00
v-for="(day_part, index) in admin_config_model.puzzle
.day_parts"
:key="`part-${index}`"
2023-09-12 07:27:59 +00:00
>
<span>
2023-09-12 14:55:08 +00:00
<template v-if="index > 0"> &ndash; </template>
2023-09-12 07:27:59 +00:00
{{ day_part.day }}:
</span>
<span class="is-family-monospace">{{ day_part.part }}</span>
</template>
</dd>
2023-09-10 03:10:22 +00:00
<dt>Offene Türchen</dt>
2023-09-12 13:59:47 +00:00
<!-- TODO -->
<dd>10</dd>
2023-09-10 03:10:22 +00:00
<dt>Nächstes Türchen in</dt>
2023-09-12 13:59:47 +00:00
<!-- TODO -->
<dd>dd-hh-mm-ss</dd>
2023-09-10 03:10:22 +00:00
<dt>Erstes Türchen</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.puzzle.begin }}</dd>
2023-09-10 03:10:22 +00:00
<dt>Letztes Türchen</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.puzzle.end }}</dd>
2023-09-10 03:10:22 +00:00
<dt>Rätsel schließt</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.puzzle.closing }}</dd>
2023-09-10 03:10:22 +00:00
<dt>Zufalls-Seed</dt>
2023-09-11 22:50:11 +00:00
<dd class="is-family-monospace">
"{{ admin_config_model.puzzle.seed }}"
</dd>
</dl>
</div>
2023-09-10 03:10:22 +00:00
</div>
<div class="column is-one-third">
<div class="content">
<h4>Kalender</h4>
<dl>
<dt>Definition</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.calendar.config_file }}</dd>
<dt>Hintergrundbild</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.calendar.background }}</dd>
<dt>Türchen</dt>
2023-09-11 02:36:51 +00:00
<dd>
2023-09-12 13:56:05 +00:00
<template
2023-09-12 14:55:08 +00:00
v-for="(day_part, index) in admin_config_model.puzzle
.day_parts"
:key="`door-${index}`"
2023-09-12 13:56:05 +00:00
>
<span>
2023-09-12 14:55:08 +00:00
<template v-if="index > 0">, </template>
2023-09-12 13:56:05 +00:00
{{ day_part.day }}
2023-09-11 02:36:51 +00:00
</span>
2023-09-12 13:56:05 +00:00
</template>
2023-09-11 02:36:51 +00:00
</dd>
</dl>
<h4>Bilder</h4>
<dl>
<dt>Größe</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.image.size }} px</dd>
<dt>Rand</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.image.border }} px</dd>
<dt>Schriftarten</dt>
2023-09-11 22:50:11 +00:00
<dd
2023-09-12 14:55:08 +00:00
v-for="(font, index) in admin_config_model.image.fonts"
:key="`font-${index}`"
2023-09-11 22:50:11 +00:00
>
{{ font.file }} (Größe {{ font.size }})
</dd>
</dl>
</div>
2023-09-10 03:10:22 +00:00
</div>
<div class="column is-one-third">
<div class="content">
<h4>WebDAV</h4>
<dl>
<dt>URL</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.webdav.url }}</dd>
<dt>Zugangsdaten</dt>
2023-09-12 13:59:47 +00:00
<!-- TODO -->
2023-09-11 02:36:51 +00:00
<dd>
<span>***</span>
<span class="tag button is-primary ml-2">
<span class="icon">
<font-awesome-icon icon="fa-solid fa-eye" />
</span>
</span>
</dd>
<dt>Cache-Dauer</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.webdav.cache_ttl }} s</dd>
<dt>Konfigurationsdatei</dt>
2023-09-11 22:24:01 +00:00
<dd>{{ admin_config_model.webdav.config_file }}</dd>
<dt>UI-Admin</dt>
2023-09-12 13:59:47 +00:00
<!-- TODO -->
2023-09-11 02:36:51 +00:00
<dd>
<span>***</span>
<span class="tag button is-primary ml-2">
<span class="icon">
<font-awesome-icon icon="fa-solid fa-eye" />
</span>
</span>
</dd>
</dl>
</div>
2023-09-10 03:10:22 +00:00
</div>
</div>
</div>
2023-09-10 03:38:24 +00:00
</BulmaDrawer>
2023-09-10 03:10:22 +00:00
</template>
<script lang="ts">
import { Options, Vue } from "vue-class-component";
import BulmaDrawer from "./bulma/Drawer.vue";
2023-09-11 22:24:01 +00:00
interface ConfigModel {
puzzle: {
solution: string;
2023-09-12 07:27:59 +00:00
day_parts: { day: number; part: string }[];
2023-09-11 22:24:01 +00:00
begin: string;
end: string;
closing: string;
seed: string;
};
calendar: {
config_file: string;
background: string;
};
image: {
size: number;
border: number;
2023-09-11 22:50:11 +00:00
fonts: { file: string; size: number }[];
2023-09-11 22:24:01 +00:00
};
webdav: {
url: string;
cache_ttl: number;
config_file: string;
};
}
2023-09-10 03:10:22 +00:00
@Options({
components: {
BulmaDrawer,
},
})
2023-09-11 22:24:01 +00:00
export default class extends Vue {
public admin_config_model: ConfigModel = {
puzzle: {
solution: "ABCDEFGHIJKLMNOPQRSTUVWX",
2023-09-12 07:27:59 +00:00
day_parts: [],
2023-09-11 22:24:01 +00:00
begin: "01.12.2023",
end: "24.12.2023",
closing: "01.04.2024",
seed: "",
},
calendar: {
config_file: "default.toml",
background: "adventskalender.jpg",
},
image: {
size: 500,
border: 30,
2023-09-11 22:50:11 +00:00
fonts: [{ file: "files/Lena.ttf", size: 50 }],
2023-09-11 22:24:01 +00:00
},
webdav: {
url: "https://example.com/remote.php/webdav/advent22",
cache_ttl: 30,
config_file: "config.toml",
},
};
public mounted(): void {
this.$advent22
.api_get<ConfigModel>("admin/config_model")
.then((data) => (this.admin_config_model = data))
.catch(console.log);
}
}
2023-09-10 03:10:22 +00:00
</script>
2023-09-10 20:08:13 +00:00
<style scoped>
dd {
overflow-x: auto;
}
</style>