Add hook to script edit schedules in the client
All checks were successful
/ build (push) Successful in 1m56s
/ deploy (push) Has been skipped

Expose the schedules in the schedules store as the window global
owltideSchedules so that mass changes can easily be scripted by a
programmer.
This commit is contained in:
Hornwitser 2025-09-12 19:34:34 +02:00
parent 56791609f4
commit a932cccfc0
2 changed files with 5 additions and 1 deletions

View file

@ -19,6 +19,10 @@ export const useSchedulesStore = defineStore("schedules", () => {
pendingSyncs: ref<Map<number, SyncOperation>>(new Map()), pendingSyncs: ref<Map<number, SyncOperation>>(new Map()),
}; };
/* Expose schedules to the console on the client to make it easy to inspect and do scripted modifications. */
if (import.meta.client)
(window as any).owltideSchedules = state.schedules;
const getters = { const getters = {
activeSchedule: computed(() => { activeSchedule: computed(() => {
if (state.activeScheduleId.value === undefined) if (state.activeScheduleId.value === undefined)

View file

@ -174,7 +174,7 @@ describe("class ClientSchedule", () => {
], ],
[ [
"event", "event",
(schedule) => ClientScheduleEvent.create(schedule, 3, "New location", false, "", false, "", "", 0, new Set(), { zone, locale }) (schedule) => ClientScheduleEvent.create(schedule, 3, "New location", "", false, "", false, "", "", 0, new Set(), { zone, locale })
], ],
[ [
"role", "role",