Commit c06ad75a authored by 郭阔's avatar 郭阔

refactor(ui): 栏目详情页操作区重构

- 顶部一行主操作:▶手动触发 / ⚙编辑配置 / ⏸停用(⏵启用按技能状态切换) / ←返回列表;
  原来散在页面底部的次要操作上移,不再上下找按钮
- 续采/采集修复两个表单(各带一个 provider 下拉)合并为'⚙ 高级恢复'折叠区:
  单表单单选模式+共享 provider,去除重复控件;说明文字内置
- 头部徽标修复 WARNING 黄色(原误显红)
parent c92ffa12
...@@ -792,7 +792,8 @@ def source_detail(name): ...@@ -792,7 +792,8 @@ def source_detail(name):
result_time=result_time, result_start=result_start, result_time=result_time, result_start=result_start,
agent_running=agent_running, state_label=state_label, agent_running=agent_running, state_label=state_label,
run_phase=run_phase, run_elapsed=run_elapsed, run_phase=run_phase, run_elapsed=run_elapsed,
last_trigger=last_trigger, next_trigger=next_trigger) last_trigger=last_trigger, next_trigger=next_trigger,
skill_enabled=pl.skill_sources().get(name, {}).get("enabled", False))
@app.route("/source/<name>/history/<run_file>") @app.route("/source/<name>/history/<run_file>")
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
{% if agent_running %} {% if agent_running %}
<span class="badge ok" style="font-size:13px">● 运行中</span> <span class="badge ok" style="font-size:13px">● 运行中</span>
{% elif business_result %} {% elif business_result %}
<span class="badge {{ 'ok' if business_result.status == 'SUCCESS' else 'fail' }}" style="font-size:13px"> <span class="badge {{ 'warn' if business_result.status == 'WARNING' else 'ok' if business_result.status == 'SUCCESS' else 'fail' }}" style="font-size:13px">
{{ '上次成功(部分交付)' if business_result.status == 'WARNING' else '上次成功' if business_result.status == 'SUCCESS' else '上次失败' }} {{ '上次成功(部分交付)' if business_result.status == 'WARNING' else '上次成功' if business_result.status == 'SUCCESS' else '上次失败' }}
</span> </span>
{% else %} {% else %}
...@@ -67,63 +67,55 @@ ...@@ -67,63 +67,55 @@
</div> </div>
{% endif %} {% endif %}
{# ── 主要操作 ──────────────────────────────────────────── #} {# ── 操作条:高频动作一行;续采/修复合并折叠 ──────────────── #}
<div class="actions"> <div class="actions" style="align-items:center;flex-wrap:wrap;gap:8px">
<form method="POST" action="{{ url_for('run_source', name=name) }}" style="display:inline" <form method="POST" action="{{ url_for('run_source', name=name) }}" style="display:inline"
onsubmit="return confirm('确定手动触发 {{ name }} 抓取?')"> onsubmit="return confirm('确定手动触发 {{ name }} 抓取?')">
<button type="submit" class="btn btn-primary" {% if (continue_status and continue_status.running) or agent_running %}disabled{% endif %}> <button type="submit" class="btn btn-primary" {% if (continue_status and continue_status.running) or agent_running %}disabled{% endif %}>
{% if agent_running %}采集运行中…{% else %}手动触发{% endif %} {% if agent_running %}采集运行中…{% else %}▶ 手动触发{% endif %}
</button> </button>
</form> </form>
<form method="POST" action="{{ url_for('continue_source', name=name) }}" style="display:inline" <a class="btn" href="{{ url_for('edit_source', name=name) }}">⚙ 编辑配置</a>
onsubmit="return confirmContinue('resume', '{{ name }}', '{{ conf.get("FALLBACK_PROVIDER", "") }}', '{{ conf.get("PROVIDER", "") }}')"> {% if skill_enabled %}
<input type="hidden" name="mode" value="resume"> <form method="POST" action="{{ url_for('disable_source', name=name) }}" style="display:inline"
<select name="provider" style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:6px 8px;font-size:13px" {% if continue_status and continue_status.running %}disabled{% endif %}> onsubmit="return confirm('确定停用栏目 {{ name }}?\n定时与技能一并停用,可随时重新启用。')">
<option value="">默认 (FALLBACK)</option> <button type="submit" class="btn btn-danger">⏸ 停用</button>
{% for p in providers %} </form>
<option value="{{ p.name }}">{{ p.name }}</option> {% else %}
{% endfor %} <form method="POST" action="{{ url_for('toggle_source', name=name) }}" style="display:inline">
</select> <input type="hidden" name="on" value="1">
<button type="submit" class="btn" {% if continue_status and continue_status.running %}disabled{% endif %}> <button type="submit" class="btn">⏵ 启用</button>
{% if continue_status and continue_status.running and continue_status.mode == 'resume' %}续采中…{% else %}继续采集{% endif %}
</button>
</form> </form>
<form method="POST" action="{{ url_for('continue_source', name=name) }}" style="display:inline" {% endif %}
onsubmit="return confirmContinue('repair', '{{ name }}', '{{ conf.get("FALLBACK_PROVIDER", "") }}', '{{ conf.get("PROVIDER", "") }}')"> <a class="btn" href="{{ url_for('index') }}">← 返回列表</a>
<input type="hidden" name="mode" value="repair">
<select name="provider" style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:6px 8px;font-size:13px" {% if continue_status and continue_status.running %}disabled{% endif %}> <details style="margin-left:auto">
<option value="">默认 (FALLBACK)</option> <summary class="btn" style="display:inline-block;cursor:pointer;list-style:none">⚙ 高级恢复…</summary>
<form method="POST" action="{{ url_for('continue_source', name=name) }}"
style="margin-top:10px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;background:#161923;border:1px solid #2a2d37;border-radius:6px;padding:12px 14px"
onsubmit="return confirmResume(this)" {% if continue_status and continue_status.running %}data-busy="1"{% endif %}>
<label style="font-size:13px;color:#888">恢复模式</label>
<label style="font-size:13px"><input type="radio" name="mode" value="resume" checked> 继续采集</label>
<label style="font-size:13px"><input type="radio" name="mode" value="repair"> 采集修复</label>
<select name="provider" style="background:#1a1d27;border:1px solid #2a2d37;border-radius:4px;color:#d4d4d4;padding:6px 8px;font-size:13px">
<option value="">Provider: 默认 (FALLBACK)</option>
{% for p in providers %} {% for p in providers %}
<option value="{{ p.name }}">{{ p.name }}</option> <option value="{{ p.name }}">{{ p.name }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button type="submit" class="btn btn-danger" {% if continue_status and continue_status.running %}disabled{% endif %}> <button type="submit" class="btn" {% if continue_status and continue_status.running %}disabled{% endif %}>执行</button>
{% if continue_status and continue_status.running and continue_status.mode == 'repair' %}修复中…{% else %}采集修复{% endif %} <p style="color:#666;font-size:12px;margin:0;width:100%">继续采集=恢复上次会话补完中断的采集;采集修复=清理本次归档后完整重采并 force 推送(不可撤销)</p>
</button>
</form> </form>
</details>
</div> </div>
<script> <script>
function confirmContinue(mode, source, fallbackProvider, currentProvider) { function confirmResume(form) {
var form = event.target.closest('form'); var mode = form.querySelector('input[name="mode"]:checked').value;
var sel = form.querySelector('select[name="provider"]');
var selectedProvider = sel ? sel.value : '';
var modeLabel = mode === 'repair' ? '采集修复' : '继续采集';
if (!selectedProvider && !fallbackProvider) {
var msg = '确定对 ' + source + ' 执行' + modeLabel + '?\n' +
'将恢复上次 Claude 对话' +
(mode === 'repair' ? ',清理之前归档的错误数据,重新完整采集并 force 推送' : ',在已有基础上继续完成中断的采集') + '。\n\n' +
'⚠️ 该数据源没有配置备用 provider(FALLBACK_PROVIDER),\n' +
'将使用与上次相同的 provider 重试。确认继续?';
return confirm(msg);
}
if (mode === 'repair') { if (mode === 'repair') {
return confirm('⚠️ 确定对 ' + source + ' 执行采集修复?\n\n' + return confirm('⚠️ 确定执行采集修复?\n\n这将:\n1. 恢复上次 Claude 对话\n2. 清理之前归档的错误数据\n3. 重新完整采集并 force 推送\n\n此操作会删除之前本次采集的文章,无法撤销!');
'这将:\n1. 恢复上次 Claude 对话\n2. 清理之前归档的错误数据\n' +
'3. 重新完整采集并 force 推送\n\n此操作会删除之前本次采集的文章,无法撤销!');
} }
return confirm('确定对 ' + source + ' 执行继续采集?\n将恢复上次 Claude 对话,在已有基础上继续完成中断的采集。'); return confirm('确定继续采集?\n将恢复上次 Claude 对话,在已有基础上继续完成中断的采集。');
} }
</script> </script>
...@@ -238,16 +230,6 @@ function confirmContinue(mode, source, fallbackProvider, currentProvider) { ...@@ -238,16 +230,6 @@ function confirmContinue(mode, source, fallbackProvider, currentProvider) {
<p style="color:#666">暂无历史执行记录</p> <p style="color:#666">暂无历史执行记录</p>
{% endif %} {% endif %}
{# ── 次要操作 ──────────────────────────────────────────── #}
<div class="actions" style="margin-top:16px">
<a class="btn" href="{{ url_for('edit_source', name=name) }}">编辑配置</a>
<form method="POST" action="{{ url_for('disable_source', name=name) }}" style="display:inline"
onsubmit="return confirm('确定停用栏目 {{ name }}?\n\n这将:\n1. 停止并 disable 定时器\n2. 清空运行时间(不再触发)\n\n文件保留,可随时通过编辑重新设置时间来启用。')">
<button type="submit" class="btn btn-danger">停用栏目</button>
</form>
<a class="btn" href="{{ url_for('index') }}">返回列表</a>
</div>
{# ── 折叠区:日志 / Claude 明细 / 配置 ───────────────────── #} {# ── 折叠区:日志 / Claude 明细 / 配置 ───────────────────── #}
{% if log_info %} {% if log_info %}
<details style="margin-top:16px"> <details style="margin-top:16px">
......
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