Commit 3256e4bb authored by 郭阔's avatar 郭阔

fix(panel): homepage status column shows schedule state in Chinese

systemd is-active semantics leaked to macOS (merged rows hardcoded
active=unknown; scheduled rows showed systemd 'inactive'). Map every row
to schedule_state: 调度中 / 已禁用 / 未排程.
parent beb80457
...@@ -647,9 +647,10 @@ def index(): ...@@ -647,9 +647,10 @@ def index():
# 开启(开关 ON)的栏目置顶,组内保持字母序 # 开启(开关 ON)的栏目置顶,组内保持字母序
sources.sort(key=lambda s: (0 if s.get("toggle_on") else 1, s["source"])) sources.sort(key=lambda s: (0 if s.get("toggle_on") else 1, s["source"]))
# macOS launchd 不提供下次触发时间:从排期时间计算(与调度中心一致) # macOS launchd 无 systemd 服务态:状态列统一用调度状态(active/disabled/none)
now = datetime.now()
for s in sources: for s in sources:
sched = pl.schedule_state(s["source"])
s["active"] = {"active": "active", "disabled": "inactive"}.get(sched, "none")
if s.get("next") in (None, "", "-"): if s.get("next") in (None, "", "-"):
times = [t for t in pl.schedule_times(s["source"]).split(",") if t.strip()] times = [t for t in pl.schedule_times(s["source"]).split(",") if t.strip()]
nxt = _next_fire(times, now) nxt = _next_fire(times, now)
......
...@@ -75,11 +75,11 @@ ...@@ -75,11 +75,11 @@
</td> </td>
<td> <td>
{% if s.active == 'active' %} {% if s.active == 'active' %}
<span class="badge active">active</span> <span class="badge active">调度中</span>
{% elif s.active == 'inactive' %} {% elif s.active == 'inactive' %}
<span class="badge inactive">inactive</span> <span class="badge inactive">已禁用</span>
{% else %} {% else %}
<span class="badge unknown">{{ s.active }}</span> <span class="badge unknown">未排程</span>
{% endif %} {% endif %}
</td> </td>
<td><code>{{ s.run_time }}</code></td> <td><code>{{ s.run_time }}</code></td>
......
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