2023-09-10 03:10:22 +00:00
|
|
|
<template>
|
2023-09-14 12:51:30 +00:00
|
|
|
<BulmaDrawer header="Konfiguration" @open="on_open" refreshable>
|
2023-09-10 03:25:12 +00:00
|
|
|
<div class="card-content">
|
2023-09-10 03:38:24 +00:00
|
|
|
<div class="columns">
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
|
|
|
<h4>Rätsel</h4>
|
|
|
|
<dl>
|
2023-09-11 19:39:02 +00:00
|
|
|
<dt>Titel</dt>
|
2023-09-14 15:00:34 +00:00
|
|
|
<!-- TODO -->
|
|
|
|
<dd>Advent22</dd>
|
2023-09-11 19:39:02 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Lösung</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.puzzle.solution }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Offene Türchen</dt>
|
2023-09-12 21:06:52 +00:00
|
|
|
<dd>{{ num_user_doors }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Nächstes Türchen in</dt>
|
2023-09-12 13:59:47 +00:00
|
|
|
<!-- TODO -->
|
2023-09-10 03:54:54 +00:00
|
|
|
<dd>dd-hh-mm-ss</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Erstes Türchen</dt>
|
2023-09-14 23:40:06 +00:00
|
|
|
<dd>{{ config_model.puzzle.first }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Letztes Türchen</dt>
|
2023-09-14 23:40:06 +00:00
|
|
|
<dd>{{ config_model.puzzle.last }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-14 23:40:06 +00:00
|
|
|
<dt>Rätsel schließt nach</dt>
|
|
|
|
<dd>{{ config_model.puzzle.end }}</dd>
|
2023-09-10 03:10:22 +00:00
|
|
|
|
2023-09-10 03:54:54 +00:00
|
|
|
<dt>Zufalls-Seed</dt>
|
2023-09-11 22:50:11 +00:00
|
|
|
<dd class="is-family-monospace">
|
2023-09-12 16:26:12 +00:00
|
|
|
"{{ config_model.puzzle.seed }}"
|
2023-09-11 22:50:11 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-09-10 03:10:22 +00:00
|
|
|
</div>
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
|
|
|
<h4>Kalender</h4>
|
|
|
|
<dl>
|
|
|
|
<dt>Definition</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.calendar.config_file }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Hintergrundbild</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.calendar.background }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<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 16:26:12 +00:00
|
|
|
v-for="(day_part, index) in day_parts"
|
2023-09-12 14:55:08 +00:00
|
|
|
: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>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
|
|
|
|
<h4>Bilder</h4>
|
|
|
|
<dl>
|
|
|
|
<dt>Größe</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.image.size }} px</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Rand</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.image.border }} px</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Schriftarten</dt>
|
2023-09-11 22:50:11 +00:00
|
|
|
<dd
|
2023-09-12 16:26:12 +00:00
|
|
|
v-for="(font, index) in config_model.image.fonts"
|
2023-09-12 14:55:08 +00:00
|
|
|
:key="`font-${index}`"
|
2023-09-11 22:50:11 +00:00
|
|
|
>
|
|
|
|
{{ font.file }} (Größe {{ font.size }})
|
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
2023-09-10 03:10:22 +00:00
|
|
|
</div>
|
2023-09-10 03:54:54 +00:00
|
|
|
<div class="column is-one-third">
|
|
|
|
<div class="content">
|
|
|
|
<h4>WebDAV</h4>
|
|
|
|
<dl>
|
|
|
|
<dt>URL</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.url }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Zugangsdaten</dt>
|
2023-09-12 22:05:48 +00:00
|
|
|
<dd class="is-family-monospace">
|
|
|
|
<BulmaSecret @load="load_dav_credentials">
|
|
|
|
<span class="tag is-danger">user</span>
|
|
|
|
{{ dav_credentials.username }}
|
|
|
|
<br />
|
|
|
|
<span class="tag is-danger">pass</span>
|
|
|
|
{{ dav_credentials.password }}
|
|
|
|
</BulmaSecret>
|
2023-09-11 02:36:51 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Cache-Dauer</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.cache_ttl }} s</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>Konfigurationsdatei</dt>
|
2023-09-12 16:26:12 +00:00
|
|
|
<dd>{{ config_model.webdav.config_file }}</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
|
|
|
|
<dt>UI-Admin</dt>
|
2023-09-12 22:05:48 +00:00
|
|
|
<dd class="is-family-monospace">
|
|
|
|
<BulmaSecret @load="load_ui_credentials">
|
|
|
|
<span class="tag is-danger">user</span>
|
|
|
|
{{ ui_credentials.username }}
|
|
|
|
<br />
|
|
|
|
<span class="tag is-danger">pass</span>
|
|
|
|
{{ ui_credentials.password }}
|
|
|
|
</BulmaSecret>
|
2023-09-11 02:36:51 +00:00
|
|
|
</dd>
|
2023-09-10 03:54:54 +00:00
|
|
|
</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">
|
2023-09-12 21:06:52 +00:00
|
|
|
import { ConfigModel, DayStrModel, DoorsSaved } from "@/lib/api";
|
2023-09-10 03:10:22 +00:00
|
|
|
import { Options, Vue } from "vue-class-component";
|
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
import BulmaDrawer from "../bulma/Drawer.vue";
|
2023-09-13 16:08:05 +00:00
|
|
|
import BulmaSecret from "../bulma/Secret.vue";
|
2023-09-12 22:05:48 +00:00
|
|
|
|
|
|
|
interface Credentials {
|
|
|
|
username: string;
|
|
|
|
password: string;
|
|
|
|
}
|
2023-09-10 03:10:22 +00:00
|
|
|
|
|
|
|
@Options({
|
|
|
|
components: {
|
|
|
|
BulmaDrawer,
|
2023-09-12 22:05:48 +00:00
|
|
|
BulmaSecret,
|
2023-09-10 03:10:22 +00:00
|
|
|
},
|
|
|
|
})
|
2023-09-11 22:24:01 +00:00
|
|
|
export default class extends Vue {
|
2023-09-12 16:26:12 +00:00
|
|
|
public config_model: ConfigModel = {
|
2023-09-11 22:24:01 +00:00
|
|
|
puzzle: {
|
|
|
|
solution: "ABCDEFGHIJKLMNOPQRSTUVWX",
|
2023-09-14 23:40:06 +00:00
|
|
|
first: "01.12.2023",
|
|
|
|
last: "24.12.2023",
|
|
|
|
end: "01.04.2024",
|
2023-09-11 22:24:01 +00:00
|
|
|
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",
|
|
|
|
},
|
|
|
|
};
|
2023-09-12 17:15:44 +00:00
|
|
|
public day_parts: DayStrModel[] = [];
|
2023-09-12 21:06:52 +00:00
|
|
|
public num_user_doors = 0;
|
2023-09-12 22:05:48 +00:00
|
|
|
public dav_credentials: Credentials = { username: "", password: "" };
|
|
|
|
public ui_credentials: Credentials = { username: "", password: "" };
|
2023-09-11 22:24:01 +00:00
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
public on_open(ready: () => void, fail: () => void): void {
|
2023-09-12 16:26:12 +00:00
|
|
|
Promise.all([
|
|
|
|
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
2023-09-12 17:15:44 +00:00
|
|
|
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
2023-09-12 21:06:52 +00:00
|
|
|
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
2023-09-12 16:26:12 +00:00
|
|
|
])
|
2023-09-12 21:06:52 +00:00
|
|
|
.then(([config_model, day_parts, user_doors]) => {
|
2023-09-12 16:26:12 +00:00
|
|
|
this.config_model = config_model;
|
|
|
|
this.day_parts = day_parts;
|
2023-09-12 21:06:52 +00:00
|
|
|
this.num_user_doors = user_doors.length;
|
|
|
|
|
2023-09-14 12:51:30 +00:00
|
|
|
ready();
|
2023-09-12 15:10:54 +00:00
|
|
|
})
|
2023-09-14 12:51:30 +00:00
|
|
|
.catch(fail);
|
2023-09-11 22:24:01 +00:00
|
|
|
}
|
2023-09-12 22:05:48 +00:00
|
|
|
|
|
|
|
public load_dav_credentials(): void {
|
|
|
|
this.$advent22
|
|
|
|
.api_get<string[]>("admin/dav_credentials")
|
|
|
|
.then(([username, password]) => {
|
|
|
|
this.dav_credentials = {
|
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
};
|
|
|
|
})
|
2023-09-13 15:58:15 +00:00
|
|
|
.catch(() => {});
|
2023-09-12 22:05:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public load_ui_credentials(): void {
|
|
|
|
this.$advent22
|
|
|
|
.api_get<string[]>("admin/ui_credentials")
|
|
|
|
.then(([username, password]) => {
|
|
|
|
this.ui_credentials = {
|
|
|
|
username: username,
|
|
|
|
password: password,
|
|
|
|
};
|
|
|
|
})
|
2023-09-13 15:58:15 +00:00
|
|
|
.catch(() => {});
|
2023-09-12 22:05:48 +00:00
|
|
|
}
|
2023-09-11 22:24:01 +00:00
|
|
|
}
|
2023-09-10 03:10:22 +00:00
|
|
|
</script>
|
2023-09-10 20:08:13 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
dd {
|
|
|
|
overflow-x: auto;
|
|
|
|
}
|
|
|
|
</style>
|