Commit 6fc2dbb4 authored by 郭阔's avatar 郭阔

ui(schedules): 重排后的提示只留一句确认,不再贴规划器全量输出

时间表页面本身就展示全部排程,flash 里重复贴排程计划+应用日志冗长;
成功路径只报"已重排,详见下表",失败路径才附输出末尾供排查
(intent/gap/plan-apply 三处一致)
parent 5c060f59
...@@ -1509,9 +1509,11 @@ def schedule_intent(): ...@@ -1509,9 +1509,11 @@ def schedule_intent():
r = subprocess.run( r = subprocess.run(
["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")], ["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")],
capture_output=True, text=True, timeout=300) capture_output=True, text=True, timeout=300)
flash(f"{name} 意图已保存(每日 {freq} 次:{'+'.join(zh[w] for w in runs)})并重排全部时间\n" if r.returncode == 0:
+ (r.stdout or "")[-2500:], flash(f"{name} 意图已保存(每日 {freq} 次:{'+'.join(zh[w] for w in runs)}),全部时间已重排,详见下表",
"success" if r.returncode == 0 else "error") "success")
else:
flash(f"意图已保存,但重排失败 (exit {r.returncode})\n{(r.stderr or r.stdout)[-1500:]}", "error")
return redirect(url_for("schedule_board")) return redirect(url_for("schedule_board"))
...@@ -1537,8 +1539,10 @@ def schedule_gap(): ...@@ -1537,8 +1539,10 @@ def schedule_gap():
r = subprocess.run( r = subprocess.run(
["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")], ["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")],
capture_output=True, text=True, timeout=300) capture_output=True, text=True, timeout=300)
flash(f"最小间隔已设为 {g} 分钟,全部时间已重排\n" + (r.stdout or "")[-2000:], if r.returncode == 0:
"success" if r.returncode == 0 else "error") flash(f"最小间隔已设为 {g} 分钟,全部时间已重排,详见下表", "success")
else:
flash(f"间隔已保存,但重排失败 (exit {r.returncode})\n{(r.stderr or r.stdout)[-1500:]}", "error")
return redirect(url_for("schedule_board")) return redirect(url_for("schedule_board"))
...@@ -1549,10 +1553,10 @@ def schedule_plan_apply(): ...@@ -1549,10 +1553,10 @@ def schedule_plan_apply():
r = subprocess.run( r = subprocess.run(
["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")], ["python3", str(Path(__file__).resolve().parent.parent / "bin" / "plan_schedules.py")],
capture_output=True, text=True, timeout=300) capture_output=True, text=True, timeout=300)
out = (r.stdout or "")[-3000:] if r.returncode == 0:
flash(f"排程计划已应用\n{out}" if r.returncode == 0 flash("已按计划重排全部源时间,详见下表", "success")
else f"计划失败 (exit {r.returncode})\n{out}\n{r.stderr[-800:]}", else:
"success" if r.returncode == 0 else "error") flash(f"重排失败 (exit {r.returncode})\n{(r.stderr or r.stdout)[-1500:]}", "error")
return redirect(url_for("schedule_board")) return redirect(url_for("schedule_board"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment