Add hook to script edit schedules in the client
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:
parent
56791609f4
commit
a932cccfc0
2 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||||
|
|
|
@ -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",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue