feat: 增强知识库治理台动作总览与通知策略展示
This commit is contained in:
@@ -424,6 +424,7 @@ def build_knowledge_base_context(selected_view: str) -> dict:
|
||||
{
|
||||
"governance_objects": governance_objects,
|
||||
"active_governance_object": active_object,
|
||||
"governance_action_hub": _build_governance_action_hub(active_object, context),
|
||||
}
|
||||
)
|
||||
return context
|
||||
@@ -495,3 +496,34 @@ def _build_governance_objects() -> list[dict]:
|
||||
"admin_url": reverse("admin:platform_ui_feishunotifyconfig_changelist"),
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
def _build_governance_action_hub(active_object: dict, context: dict) -> dict:
|
||||
"""
|
||||
为治理台提供当前对象聚焦信息与跨入口动作。
|
||||
|
||||
目标是把知识库从“静态配置展示页”收口为“治理入口”:
|
||||
- 明确当前治理对象
|
||||
- 提供固定通知策略口径
|
||||
- 提供跳转到审核智能体 / 资料包 / 处理历史的快速入口
|
||||
"""
|
||||
owner_count = len(context.get("owner_mappings") or [])
|
||||
template_count = len(context.get("template_mappings") or [])
|
||||
feishu_count = len(context.get("feishu_configs") or [])
|
||||
return {
|
||||
"title": "治理动作总览",
|
||||
"current_object": active_object["title"],
|
||||
"current_summary": active_object["summary"],
|
||||
"status_items": [
|
||||
{"label": "责任人映射", "value": f"{owner_count} 条"},
|
||||
{"label": "Word 模板版本", "value": f"{template_count} 个"},
|
||||
{"label": "通知配置", "value": f"{feishu_count} 条"},
|
||||
],
|
||||
"quick_actions": [
|
||||
{"label": "进入审核智能体", "url": reverse("chat:index")},
|
||||
{"label": "查看资料包", "url": reverse("documents:list")},
|
||||
{"label": "查看处理历史", "url": reverse("audit:list")},
|
||||
{"label": "进入后台维护", "url": active_object["admin_url"]},
|
||||
],
|
||||
"notify_reasons": ["task_completed", "task_failed"],
|
||||
}
|
||||
|
||||
@@ -63,6 +63,57 @@
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="grid-2">
|
||||
<article class="panel">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<h2 class="section-title">{{ governance_action_hub.title }}</h2>
|
||||
<p class="section-copy">用当前治理对象作为焦点,快速进入审核、资料包和处理历史入口。</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li class="detail-item">
|
||||
<strong>当前治理对象</strong>
|
||||
<div>{{ governance_action_hub.current_object }}</div>
|
||||
<div class="muted">{{ governance_action_hub.current_summary }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="badge-row" style="margin-top: 12px;">
|
||||
{% for item in governance_action_hub.status_items %}
|
||||
<span class="pill pill-accent">{{ item.label }}:{{ item.value }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="button-row" style="margin-top: 16px;">
|
||||
{% for action in governance_action_hub.quick_actions %}
|
||||
<a class="button" href="{{ action.url }}">{{ action.label }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="panel">
|
||||
<div class="section-heading">
|
||||
<div>
|
||||
<h2 class="section-title">固定通知策略</h2>
|
||||
<p class="section-copy">Demo 首版固定仅支持执行完成或执行异常两类飞书通知口径。</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
{% for reason in governance_action_hub.notify_reasons %}
|
||||
<li class="detail-item">
|
||||
<strong>{{ reason }}</strong>
|
||||
<div class="muted">
|
||||
{% if reason == "task_completed" %}
|
||||
审核执行完成后直接通知处理人。
|
||||
{% else %}
|
||||
审核执行异常后直接通知处理人。
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="grid-3">
|
||||
{% for section in governance_sections %}
|
||||
<article class="panel">
|
||||
|
||||
@@ -171,3 +171,20 @@ def test_knowledge_base_page_exposes_governance_crud_entry_links(client):
|
||||
assert "编辑占位符映射" in content
|
||||
assert "预览模板" in content
|
||||
assert reverse("admin:platform_ui_wordtemplatemapping_changelist") in content
|
||||
|
||||
|
||||
def test_knowledge_base_page_shows_governance_action_hub_and_fixed_notify_policy(client):
|
||||
response = client.get(reverse("platform_ui:knowledge-base"), {"view": "feishu_configs"})
|
||||
|
||||
content = response.content.decode("utf-8")
|
||||
assert response.status_code == 200
|
||||
assert "治理动作总览" in content
|
||||
assert "当前治理对象" in content
|
||||
assert "进入审核智能体" in content
|
||||
assert "查看资料包" in content
|
||||
assert "查看处理历史" in content
|
||||
assert "固定通知策略" in content
|
||||
assert "task_completed" in content
|
||||
assert "task_failed" in content
|
||||
assert reverse("audit:list") in content
|
||||
assert reverse("documents:list") in content
|
||||
|
||||
Reference in New Issue
Block a user