mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-22 15:53:01 +00:00
ConfigModel -> AdminConfigModel
This commit is contained in:
parent
600ee99520
commit
0bc31529bc
3 changed files with 38 additions and 35 deletions
|
@ -27,7 +27,7 @@ async def is_admin(
|
|||
return is_admin
|
||||
|
||||
|
||||
class ConfigModel(BaseModel):
|
||||
class AdminConfigModel(BaseModel):
|
||||
class __Solution(BaseModel):
|
||||
value: str
|
||||
whitespace: str
|
||||
|
@ -71,12 +71,12 @@ async def get_config_model(
|
|||
cal_cfg: CalendarConfig = Depends(get_calendar_config),
|
||||
event_dates: EventDates = Depends(get_all_event_dates),
|
||||
ttfonts: list[TTFont] = Depends(get_all_ttfonts),
|
||||
) -> ConfigModel:
|
||||
) -> AdminConfigModel:
|
||||
"""
|
||||
Kombiniert aus privaten `settings`, `config` und `calendar_config`
|
||||
"""
|
||||
|
||||
return ConfigModel.model_validate(
|
||||
return AdminConfigModel.model_validate(
|
||||
{
|
||||
"solution": {
|
||||
"value": cfg.solution.value,
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
<dd>
|
||||
Eingabe:
|
||||
<span class="is-family-monospace">
|
||||
"{{ config_model.solution.value }}"
|
||||
"{{ admin_config_model.solution.value }}"
|
||||
</span>
|
||||
</dd>
|
||||
<dd>
|
||||
Ausgabe:
|
||||
<span class="is-family-monospace">
|
||||
"{{ config_model.solution.clean }}"
|
||||
"{{ admin_config_model.solution.clean }}"
|
||||
</span>
|
||||
</dd>
|
||||
|
||||
|
@ -24,13 +24,13 @@
|
|||
<dd>
|
||||
Whitespace:
|
||||
<span class="is-uppercase is-family-monospace">
|
||||
{{ config_model.solution.whitespace }}
|
||||
{{ admin_config_model.solution.whitespace }}
|
||||
</span>
|
||||
</dd>
|
||||
<dd>
|
||||
Buchstaben:
|
||||
<span class="is-uppercase is-family-monospace">
|
||||
{{ config_model.solution.case }}
|
||||
{{ admin_config_model.solution.case }}
|
||||
</span>
|
||||
</dd>
|
||||
</dl>
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
<dt>Zufalls-Seed</dt>
|
||||
<dd class="is-family-monospace">
|
||||
"{{ config_model.puzzle.seed }}"
|
||||
"{{ admin_config_model.puzzle.seed }}"
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -74,10 +74,10 @@
|
|||
<h3>Kalender</h3>
|
||||
<dl>
|
||||
<dt>Definition</dt>
|
||||
<dd>{{ config_model.calendar.config_file }}</dd>
|
||||
<dd>{{ admin_config_model.calendar.config_file }}</dd>
|
||||
|
||||
<dt>Hintergrundbild</dt>
|
||||
<dd>{{ config_model.calendar.background }}</dd>
|
||||
<dd>{{ admin_config_model.calendar.background }}</dd>
|
||||
|
||||
<dt>Favicon</dt>
|
||||
<dd>{{ admin_config_model.calendar.favicon }}</dd>
|
||||
|
@ -96,14 +96,14 @@
|
|||
<h3>Bilder</h3>
|
||||
<dl>
|
||||
<dt>Größe</dt>
|
||||
<dd>{{ config_model.image.size }} px</dd>
|
||||
<dd>{{ admin_config_model.image.size }} px</dd>
|
||||
|
||||
<dt>Rand</dt>
|
||||
<dd>{{ config_model.image.border }} px</dd>
|
||||
<dd>{{ admin_config_model.image.border }} px</dd>
|
||||
|
||||
<dt>Schriftarten</dt>
|
||||
<dd
|
||||
v-for="(font, index) in config_model.fonts"
|
||||
v-for="(font, index) in admin_config_model.fonts"
|
||||
:key="`font-${index}`"
|
||||
>
|
||||
{{ font.file }} ({{ font.size }} pt)
|
||||
|
@ -116,7 +116,7 @@
|
|||
<h3>WebDAV</h3>
|
||||
<dl>
|
||||
<dt>URL</dt>
|
||||
<dd>{{ config_model.webdav.url }}</dd>
|
||||
<dd>{{ admin_config_model.webdav.url }}</dd>
|
||||
|
||||
<dt>Zugangsdaten</dt>
|
||||
<dd class="is-family-monospace">
|
||||
|
@ -130,10 +130,10 @@
|
|||
</dd>
|
||||
|
||||
<dt>Cache-Dauer</dt>
|
||||
<dd>{{ config_model.webdav.cache_ttl }} s</dd>
|
||||
<dd>{{ admin_config_model.webdav.cache_ttl }} s</dd>
|
||||
|
||||
<dt>Konfigurationsdatei</dt>
|
||||
<dd>{{ config_model.webdav.config_file }}</dd>
|
||||
<dd>{{ admin_config_model.webdav.config_file }}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
@ -141,10 +141,10 @@
|
|||
<h3>Sonstige</h3>
|
||||
<dl>
|
||||
<dt>Redis</dt>
|
||||
<dd>Host: {{ config_model.redis.host }}</dd>
|
||||
<dd>Port: {{ config_model.redis.port }}</dd>
|
||||
<dd>Datenbank: {{ config_model.redis.db }}</dd>
|
||||
<dd>Protokoll: {{ config_model.redis.protocol }}</dd>
|
||||
<dd>Host: {{ admin_config_model.redis.host }}</dd>
|
||||
<dd>Port: {{ admin_config_model.redis.port }}</dd>
|
||||
<dd>Datenbank: {{ admin_config_model.redis.db }}</dd>
|
||||
<dd>Protokoll: {{ admin_config_model.redis.protocol }}</dd>
|
||||
|
||||
<dt>UI-Admin</dt>
|
||||
<dd class="is-family-monospace">
|
||||
|
@ -165,7 +165,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ConfigModel, Credentials, DoorsSaved } from "@/lib/api";
|
||||
import { AdminConfigModel, Credentials, DoorsSaved } from "@/lib/api";
|
||||
import { DateTime } from "luxon";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
|
@ -181,7 +181,7 @@ import CountDown from "../CountDown.vue";
|
|||
},
|
||||
})
|
||||
export default class extends Vue {
|
||||
public config_model: ConfigModel = {
|
||||
public admin_config_model: AdminConfigModel = {
|
||||
solution: {
|
||||
value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
whitespace: "KEEP",
|
||||
|
@ -225,8 +225,8 @@ export default class extends Vue {
|
|||
public dav_credentials: Credentials = ["", ""];
|
||||
public ui_credentials: Credentials = ["", ""];
|
||||
|
||||
public fmt_puzzle_date(name: keyof ConfigModel["puzzle"]): string {
|
||||
const iso_date = this.config_model.puzzle[name];
|
||||
public fmt_puzzle_date(name: keyof AdminConfigModel["puzzle"]): string {
|
||||
const iso_date = this.admin_config_model.puzzle[name];
|
||||
if (iso_date === null) return "-";
|
||||
|
||||
return DateTime.fromISO(iso_date).toLocaleString(DateTime.DATE_SHORT);
|
||||
|
@ -234,23 +234,25 @@ export default class extends Vue {
|
|||
|
||||
public on_open(ready: () => void, fail: () => void): void {
|
||||
Promise.all([
|
||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||
this.$advent22.api_get<AdminConfigModel>("admin/config_model"),
|
||||
this.$advent22.api_get<DoorsSaved>("admin/doors"),
|
||||
this.$advent22.api_get<DoorsSaved>("user/doors"),
|
||||
this.$advent22.api_get<string>("user/title"),
|
||||
this.$advent22.api_get<string>("user/footer"),
|
||||
this.$advent22.api_get<number | null>("user/next_door"),
|
||||
])
|
||||
.then(([config_model, doors, user_doors, title, footer, next_door]) => {
|
||||
this.config_model = config_model;
|
||||
this.doors = doors;
|
||||
this.num_user_doors = user_doors.length;
|
||||
this.title = title;
|
||||
this.footer = footer;
|
||||
this.next_door = next_door;
|
||||
.then(
|
||||
([admin_config_model, doors, user_doors, title, footer, next_door]) => {
|
||||
this.admin_config_model = admin_config_model;
|
||||
this.doors = doors;
|
||||
this.num_user_doors = user_doors.length;
|
||||
this.title = title;
|
||||
this.footer = footer;
|
||||
this.next_door = next_door;
|
||||
|
||||
ready();
|
||||
})
|
||||
ready();
|
||||
},
|
||||
)
|
||||
.catch(fail);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export interface ConfigModel {
|
||||
export interface AdminConfigModel {
|
||||
solution: {
|
||||
value: string;
|
||||
whitespace: string;
|
||||
|
@ -15,6 +15,7 @@ export interface ConfigModel {
|
|||
calendar: {
|
||||
config_file: string;
|
||||
background: string;
|
||||
favicon: string;
|
||||
};
|
||||
image: {
|
||||
size: number;
|
||||
|
|
Loading…
Reference in a new issue