@@ -20,12 +20,10 @@
diff --git a/ui/src/components/admin/CalendarAssistant.vue b/ui/src/components/admin/CalendarAssistant.vue
index aa16652..9e23f09 100644
--- a/ui/src/components/admin/CalendarAssistant.vue
+++ b/ui/src/components/admin/CalendarAssistant.vue
@@ -49,17 +49,18 @@
import { API } from "@/lib/api";
import { name_door, objForEach } from "@/lib/helpers";
import { ImageData, NumStrDict } from "@/lib/model";
+import { ref } from "vue";
import MultiModal, { HMultiModal } from "../MultiModal.vue";
import BulmaButton from "../bulma/Button.vue";
import BulmaDrawer from "../bulma/Drawer.vue";
-const day_data: {
+const day_data = ref<{
[day: number]: {
part: string;
image_name: string;
};
-} = {};
+}>({});
let modal: HMultiModal | undefined;
@@ -74,19 +75,19 @@ function on_open(ready: () => void, fail: () => void) {
])
.then(([day_parts, day_image_names]) => {
const _ensure_day_in_data = (day: number) => {
- if (!(day in day_data)) {
- day_data[day] = { part: "", image_name: "" };
+ if (!(day in day_data.value)) {
+ day_data.value[day] = { part: "", image_name: "" };
}
};
objForEach(day_parts, (day, part) => {
_ensure_day_in_data(day);
- day_data[day].part = part;
+ day_data.value[day].part = part;
});
objForEach(day_image_names, (day, image_name) => {
_ensure_day_in_data(day);
- day_data[day].image_name = image_name;
+ day_data.value[day].image_name = image_name;
});
ready();
diff --git a/ui/src/components/admin/ConfigView.vue b/ui/src/components/admin/ConfigView.vue
index 50f91c3..9f32ad0 100644
--- a/ui/src/components/admin/ConfigView.vue
+++ b/ui/src/components/admin/ConfigView.vue
@@ -188,6 +188,7 @@ import { API } from "@/lib/api";
import { AdminConfigModel, Credentials, DoorSaved } from "@/lib/model";
import { advent22Store } from "@/lib/store";
import { DateTime } from "luxon";
+import { ref } from "vue";
import BulmaDrawer from "../bulma/Drawer.vue";
import BulmaSecret from "../bulma/Secret.vue";
@@ -195,7 +196,7 @@ import CountDown from "../CountDown.vue";
const store = advent22Store();
-let admin_config_model: AdminConfigModel = {
+const admin_config_model = ref
({
solution: {
value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
whitespace: "KEEP",
@@ -233,14 +234,14 @@ let admin_config_model: AdminConfigModel = {
cache_ttl: 0,
config_file: "sed diam nonumy",
},
-};
+});
-let doors: DoorSaved[] = [];
-let dav_credentials: Credentials = ["", ""];
-let ui_credentials: Credentials = ["", ""];
+const doors = ref([]);
+const dav_credentials = ref(["", ""]);
+const ui_credentials = ref(["", ""]);
function fmt_puzzle_date(name: keyof AdminConfigModel["puzzle"]): string {
- const iso_date = admin_config_model.puzzle[name];
+ const iso_date = admin_config_model.value.puzzle[name];
if (!(typeof iso_date === "string")) return "-";
return DateTime.fromISO(iso_date).toLocaleString(DateTime.DATE_SHORT);
@@ -255,8 +256,8 @@ function on_open(ready: () => void, fail: () => void): void {
.then(([store_update, new_admin_config_model, new_doors]) => {
store_update; // discard value
- admin_config_model = new_admin_config_model;
- doors = new_doors;
+ admin_config_model.value = new_admin_config_model;
+ doors.value = new_doors;
ready();
})
@@ -265,13 +266,13 @@ function on_open(ready: () => void, fail: () => void): void {
function load_dav_credentials(): void {
API.request("admin/dav_credentials")
- .then((creds) => (dav_credentials = creds))
+ .then((creds) => (dav_credentials.value = creds))
.catch(() => {});
}
function load_ui_credentials(): void {
API.request("admin/ui_credentials")
- .then((creds) => (ui_credentials = creds))
+ .then((creds) => (ui_credentials.value = creds))
.catch(() => {});
}
diff --git a/ui/src/components/admin/DoorMapEditor.vue b/ui/src/components/admin/DoorMapEditor.vue
index 799fce5..df071ca 100644
--- a/ui/src/components/admin/DoorMapEditor.vue
+++ b/ui/src/components/admin/DoorMapEditor.vue
@@ -37,10 +37,10 @@
-