Revert calendar-based cookbook scheduler
Revertsb98ee04+4ed48ba+a19b6d2. Calendar events turned out to be the wrong abstraction for scheduling model serve windows. Pivoting to the existing ScheduledTask infrastructure (cron / daily / weekly recurrence, next_run tracking, edit-from-Tasks-tab UI) in a follow-up commit. The ScheduledTask path: - reuses dispatch logic the rest of the app already understands - drops the calendar dependency entirely (no auto-created "Cookbook" calendar, no calendar.js hook) - shows up in the Tasks UI that already exists for everything else What this revert removes: - src/cookbook_scheduler.py — calendar reconciler - routes/cookbook_schedule_routes.py — /api/cookbook/schedule/* endpoints - static/js/cookbookSchedule.js — Schedule modal / settings card - cookbook_scheduler_enabled + cookbook_schedule_calendar_href settings keys - The window.cookbookOpenScheduleForm hook in calendar.js - The Schedule button + paired-button CSS in cookbookServe.js + style.css
This commit is contained in:
@@ -3346,42 +3346,3 @@ window.addEventListener('calendar-refresh', () => {
|
||||
const calendarModule = { openCalendar, closeCalendar, isCalendarOpen };
|
||||
export { openCalendar, openCalendarTo, closeCalendar, isCalendarOpen };
|
||||
export default calendarModule;
|
||||
|
||||
// ── Cookbook scheduler hook ─────────────────────────────────────────────
|
||||
// Lets the Cookbook tab's Schedule button open the standard calendar
|
||||
// event-create form pre-filled with the model's name + cookbook YAML in
|
||||
// the description, on the auto-created Cookbook calendar. Keeps the
|
||||
// Schedule UX identical to creating any other calendar event — no
|
||||
// custom modal, just the existing flow that users already know.
|
||||
window.cookbookOpenScheduleForm = function (draft) {
|
||||
// Open the calendar first so #cal-body exists for _showEventForm.
|
||||
if (!_open) openCalendar();
|
||||
// Defer a tick so the modal DOM is mounted before we touch it.
|
||||
setTimeout(() => {
|
||||
_showEventForm(null, _today(), _today());
|
||||
setTimeout(() => {
|
||||
try {
|
||||
const sumEl = document.getElementById('cal-f-sum');
|
||||
if (sumEl && draft && draft.summary) sumEl.value = draft.summary;
|
||||
const descEl = document.getElementById('cal-f-desc');
|
||||
if (descEl && draft && draft.description) descEl.value = draft.description;
|
||||
const rrEl = document.getElementById('cal-f-rrule');
|
||||
if (rrEl && draft && draft.rrule) rrEl.value = draft.rrule;
|
||||
// Calendar selector lives behind the "Add details" expand; force-
|
||||
// expand so the user sees it's heading into the Cookbook calendar.
|
||||
const form = document.querySelector('.cal-form-bespoke');
|
||||
if (form) form.classList.add('is-expanded');
|
||||
const calSel = document.getElementById('cal-f-cal');
|
||||
if (calSel && draft && draft.calendar_href) {
|
||||
const opt = Array.from(calSel.options).find(o => o.value === draft.calendar_href);
|
||||
if (opt) calSel.value = draft.calendar_href;
|
||||
}
|
||||
// Focus the title so the user can immediately type if they want
|
||||
// to rename the event (rare, but cheap to enable).
|
||||
if (sumEl) sumEl.focus();
|
||||
} catch (e) {
|
||||
console.warn('cookbook schedule prefill failed:', e);
|
||||
}
|
||||
}, 60);
|
||||
}, _open ? 0 : 80);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user