feat: 用户视角 — 按用户聚合 LD 板使用信息

- 新增 DomainDetail 数据模型存储逐域归属 (Owner/PID/T-Pod/Design)
- 解析详细版 test_server 输出 (Logic drawer X has N domains 格式)
- 新增 /users 页面 + /api/users API 按用户聚合 LD 板
- 修复邮件配置保存时中文逗号收件人分割问题
- 修复邮件发送时 ASCII 编码错误 (收件人含中文逗号)
This commit is contained in:
Your Name
2026-07-15 12:32:48 +08:00
parent d8eb6824b8
commit b5205d0543
5 changed files with 297 additions and 8 deletions
+1
View File
@@ -16,6 +16,7 @@
<div class="nav-links">
<a href="{{ url_for('dashboard') }}" class="{% if request.endpoint == 'dashboard' %}active{% endif %}">仪表板</a>
<a href="{{ url_for('history') }}" class="{% if request.endpoint == 'history' %}active{% endif %}">历史记录</a>
<a href="{{ url_for('users_page') }}" class="{% if request.endpoint == 'users_page' %}active{% endif %}">👤 用户</a>
<a href="{{ url_for('email_config') }}" class="{% if request.endpoint == 'email_config' %}active{% endif %}">⚙️ 设置</a>
<button class="nav-btn" onclick="openPasteModal()">📥 粘贴数据</button>
</div>
+61
View File
@@ -0,0 +1,61 @@
{% extends "base.html" %}
{% block title %}用户视角 — Palladium Monitor{% endblock %}
{% block content %}
<div class="page-header">
<h1>👤 用户视角</h1>
<p class="page-subtitle">按用户聚合 LD 板使用情况 (数据来自详细版 test_server 输出)</p>
</div>
{% if pagination['items'] %}
<!-- 用户列表表 -->
<div class="card">
<table class="data-table users-table">
<thead>
<tr>
<th>用户</th>
<th>使用 LD 数</th>
<th>LD 板</th>
<th>Rack</th>
<th>T-Pod</th>
<th>设计名</th>
</tr>
</thead>
<tbody>
{% for item in pagination['items'] %}
<tr>
<td class="text-mono user-cell">{{ item.user }}</td>
<td class="text-center"><span class="user-count-badge">{{ item.ld_count }}</span></td>
<td class="boards-cell">{{ item.boards }}</td>
<td class="text-mono">{{ item.racks }}</td>
<td class="text-mono">{{ item.pods }}</td>
<td class="design-cell">{{ item.designs }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- 分页 -->
{% if pagination['pages'] > 1 %}
<div class="pagination">
{% if pagination['page'] > 1 %}
<a href="{{ url_for('users_page', page=pagination['page'] - 1) }}" class="page-btn">← 上一页</a>
{% endif %}
<span class="page-info">第 {{ pagination['page'] }} / {{ pagination['pages'] }} 页 (共 {{ pagination['total'] }} 个用户)</span>
{% if pagination['page'] < pagination['pages'] %}
<a href="{{ url_for('users_page', page=pagination['page'] + 1) }}" class="page-btn">下一页 →</a>
{% endif %}
</div>
{% endif %}
{% else %}
<div class="empty-state-full">
<div class="empty-icon">👤</div>
<h2>暂无用户数据</h2>
<p>请先使用 <code>test_server</code> (非 -short 模式) 采集数据,
详细输出会包含每个域的 Owner/PID/T-Pod/Design 信息。</p>
<p>或粘贴详细版 test_server 输出到仪表板页面进行解析。</p>
</div>
{% endif %}
{% endblock %}