mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 22:03:22 +08:00
Add config sync cycle stop and surface pause/stop controls in the UI.
Cancel remaining tasks on stop and keep finalize from overwriting a cancelled cycle. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
559cc14d2c
commit
1c8d512701
6 changed files with 124 additions and 5 deletions
|
|
@ -24,6 +24,7 @@ from .config_sync_service import (
|
|||
list_snapshots,
|
||||
pause_cycle,
|
||||
resume_cycle,
|
||||
stop_cycle,
|
||||
update_policy,
|
||||
)
|
||||
from .db import get_db
|
||||
|
|
@ -137,6 +138,23 @@ def api_resume_cycle(
|
|||
return out.model_dump()
|
||||
|
||||
|
||||
@router.post("/cycles/{cycle_id}/stop")
|
||||
def api_stop_cycle(cycle_id: str, request: Request, db: Session = Depends(get_db)):
|
||||
out = stop_cycle(db, cycle_id)
|
||||
uid, uname = _actor(request)
|
||||
write_audit(
|
||||
db,
|
||||
action="config_sync.stop",
|
||||
actor_user_id=uid,
|
||||
actor_username=uname,
|
||||
method="POST",
|
||||
path=f"/v1/config-sync/cycles/{cycle_id}/stop",
|
||||
status_code=200,
|
||||
detail={"cycle_id": cycle_id},
|
||||
)
|
||||
return out.model_dump()
|
||||
|
||||
|
||||
@router.get("/snapshots")
|
||||
def api_list_snapshots(
|
||||
page: int = Query(default=1, ge=1),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue