scheduled prompts: add/remove targets on edit (#474 fast-follow)

This commit is contained in:
damocles 2026-05-26 16:14:47 +02:00 committed by Mara
commit 99bf4d635d
6 changed files with 216 additions and 3 deletions

View file

@ -356,6 +356,8 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
description,
interval_seconds,
next_fire_at_unix,
targets_add,
targets_remove,
} => handle_edit_schedule(
coord,
hive_sh4re::MANAGER_AGENT,
@ -364,6 +366,8 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
description.clone(),
*interval_seconds,
*next_fire_at_unix,
targets_add.clone(),
targets_remove.clone(),
),
ManagerRequest::ListSchedules => match coord.scheduled_prompts.list() {
Ok(schedules) => ManagerResponse::Schedules {
@ -895,6 +899,8 @@ fn handle_edit_schedule(
description: Option<Option<String>>,
interval_seconds: Option<Option<u64>>,
next_fire_at_unix: Option<i64>,
targets_add: Option<Vec<String>>,
targets_remove: Option<Vec<String>>,
) -> ManagerResponse {
let schedule = match coord.scheduled_prompts.get(schedule_id) {
Ok(Some(s)) => s,
@ -922,6 +928,8 @@ fn handle_edit_schedule(
description,
interval_seconds,
next_fire_at_unix,
targets_add,
targets_remove,
};
match coord.scheduled_prompts.update(schedule_id, patch) {
Ok(()) => ManagerResponse::Ok,