Files
hermes-dashboard/templates/project_detail.html
hermes-dashboard c0cbd683f4 feat: project overview + timeline + docs center
- services/task_project_linker.py: task<->project mapping (title keywords + workspace_path)
- routes/pages.py: /timeline, /docs, /docs/<path>, enhanced /projects/<name> and /tasks/<id>
- templates: timeline.html, docs.html, doc_view.html (new), project_detail.html + task_detail.html (overhauled)
- config.py: DOCS_DIRS + ProjectConfig color
- base.html: Timeline + Docs nav links
2026-08-17 20:00:37 +08:00

149 lines
5.2 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ name }} - Project Detail{% endblock %}
{% block content %}
<h2>📦 {{ name }}</h2>
{% if project.error %}
<div class="card">
<p class="text-muted">Error: {{ project.error }}</p>
</div>
{% else %}
<div class="grid-2">
<div>
<div class="card">
<h3>Repository Info</h3>
<p><strong>Path:</strong> <span class="text-small">{{ project.path }}</span></p>
<p><strong>Branch:</strong> {{ project.branch or 'N/A' }}</p>
<p><strong>Status:</strong> {{ project.status }}</p>
{% if project.gitea_repo %}
<p><strong>Gitea:</strong> <a href="http://localhost:3000/admin/{{ project.gitea_repo }}" target="_blank">{{ project.gitea_repo }} ↗</a></p>
{% endif %}
</div>
<div class="card">
<h3>Latest Commit</h3>
{% if project.commit_hash %}
<p><strong>Hash:</strong> <span class="text-small">{{ project.commit_hash }}</span></p>
<p><strong>Message:</strong> {{ project.commit_msg }}</p>
<p><strong>Time:</strong> {% if project.commit_time %}{{ project.commit_time|int|dt }} ({{ project.commit_time|int|rel }}){% else %}N/A{% endif %}</p>
{% else %}
<p class="text-muted">No commits found</p>
{% endif %}
</div>
</div>
<div>
<div class="card">
<h3>Git Status</h3>
{% if project.status_porcelain %}
<pre>{{ project.status_porcelain }}</pre>
{% else %}
<p class="text-muted">Clean working directory</p>
{% endif %}
</div>
{% if project.diff_stat %}
<div class="card">
<h3>Last Commit Diff Stat</h3>
<pre>{{ project.diff_stat }}</pre>
</div>
{% endif %}
</div>
</div>
<div class="card mt-20">
<h3>📋 Task Timeline ({{ tasks|length }} tasks)</h3>
{% if tasks %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Status</th>
<th>Created</th>
<th>Duration</th>
<th>Outcome</th>
</tr>
</thead>
<tbody>
{% for t in tasks %}
<tr>
<td class="text-small"><a href="/tasks/{{ t.task_id }}">{{ t.task_id }}</a></td>
<td>{{ t.title[:80] }}</td>
<td><span class="status-badge status-{{ t.status }}">{{ t.status }}</span></td>
<td class="text-small">{% if t.created_at %}{{ t.created_at|int|dt }}{% endif %}</td>
<td class="text-small">
{% if t.duration_s %}
{% if t.duration_s < 60 %}{{ t.duration_s }}s
{% elif t.duration_s < 3600 %}{{ (t.duration_s / 60)|round(1) }}m
{% else %}{{ (t.duration_s / 3600)|round(1) }}h{% endif %}
{% else %}-{% endif %}
</td>
<td class="text-small text-muted">{{ t.outcome_summary[:80] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">No tasks linked to this project</p>
{% endif %}
</div>
<div class="card mt-20">
<h3>🔀 Recent Commits ({{ commits|length }})</h3>
{% if commits %}
<table>
<thead>
<tr>
<th>Hash</th>
<th>Author</th>
<th>Time</th>
<th>Subject</th>
</tr>
</thead>
<tbody>
{% for c in commits %}
<tr>
<td class="text-small"><a href="{{ c.gitea_url }}" target="_blank">{{ c.short }}</a></td>
<td class="text-small">{{ c.author }}</td>
<td class="text-small">{{ c.ts|int|dt }}</td>
<td>{{ c.subject }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">No commits found</p>
{% endif %}
</div>
{% if task_files %}
<div class="card mt-20">
<h3>📁 Files Changed (per task time window)</h3>
{% for task_id, commit_files in task_files.items() %}
<div style="margin-bottom:15px;">
<h4 style="margin-bottom:5px;">
<a href="/tasks/{{ task_id }}">{{ task_id }}</a>
</h4>
{% for chash, files in commit_files.items() %}
<div class="text-small" style="margin-left:15px;">
<strong>{{ chash }}</strong>: {{ files|length }} file(s)
<ul style="margin-left:20px;">
{% for f in files[:10] %}<li>{{ f }}</li>{% endfor %}
{% if files|length > 10 %}<li class="text-muted">... {{ files|length - 10 }} more</li>{% endif %}
</ul>
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
{% endif %}
<p class="mt-20">
<a href="/projects" class="btn">← Back to Projects</a>
</p>
{% endblock %}