Files
hermes-dashboard/templates/task_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

186 lines
6.4 KiB
HTML

{% extends "base.html" %}
{% block title %}Task #{{ task_id }} - Hermes{% endblock %}
{% block content %}
{% if data.error %}
<h2>Error</h2>
<div class="card">
<p class="text-muted">{{ data.error }}</p>
</div>
{% else %}
{% set task = data.task %}
<h2>📋 Task #{{ task.id }}: {{ task.title }}</h2>
{% if project_name %}
<div class="card mb-20">
<p><strong>📦 Project:</strong> <a href="/projects/{{ project_name }}">{{ project_name }}</a></p>
</div>
{% endif %}
<div class="grid-2">
<div>
<div class="card">
<h3>Task Info</h3>
<p><strong>Status:</strong> <span class="status-badge status-{{ task.status }}">{{ task.status }}</span></p>
<p><strong>Assignee:</strong> {{ task.assignee or 'N/A' }}</p>
<p><strong>Priority:</strong> {{ task.priority or 'N/A' }}</p>
<p><strong>Workspace:</strong> <span class="text-small">{{ task.workspace_path or 'N/A' }}</span></p>
<p><strong>Created:</strong> {% if task.created_at %}{{ task.created_at|int|dt }}{% else %}N/A{% endif %}</p>
{% if task.started_at %}
<p><strong>Started:</strong> {{ task.started_at|int|dt }} ({{ task.started_at|int|rel }})</p>
{% endif %}
{% if task.completed_at %}
<p><strong>Completed:</strong> {{ task.completed_at|int|dt }} ({{ task.completed_at|int|rel }})</p>
{% endif %}
</div>
<div class="card">
<h3>Description</h3>
{% if task.body %}
<pre>{{ task.body[:500] }}</pre>
{% else %}
<p class="text-muted">No description</p>
{% endif %}
</div>
{% if task.result %}
<div class="card">
<h3>Result</h3>
<pre>{{ task.result }}</pre>
</div>
{% endif %}
{% if commits %}
<div class="card">
<h3>🔀 Commits During Task ({{ commits|length }})</h3>
<table>
<thead>
<tr><th>Hash</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.ts|int|dt }}</td>
<td>{{ c.subject }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
{% if files_changed %}
<div class="card">
<h3>📁 Files Changed</h3>
{% for chash, files in files_changed.items() %}
<div class="text-small" style="margin-bottom:10px;">
<strong>{{ chash }}</strong>:
<ul style="margin-left:20px;">
{% for f in files[:15] %}<li>{{ f }}</li>{% endfor %}
{% if files|length > 15 %}<li class="text-muted">... {{ files|length - 15 }} more</li>{% endif %}
</ul>
</div>
{% endfor %}
</div>
{% endif %}
</div>
<div>
<div class="card">
<h3>Timeline ({{ data.events|length }} events)</h3>
{% if data.events %}
{% for event in data.events %}
<div class="timeline-item">
<div class="timeline-item-header">
{{ event.created_at|int|dt }} - {{ event.kind }}
</div>
<div class="timeline-item-content">
{% if event.payload %}
<pre class="text-small">{{ event.payload }}</pre>
{% endif %}
</div>
</div>
{% endfor %}
{% else %}
<p class="text-muted">No events</p>
{% endif %}
</div>
</div>
</div>
<div class="card mt-20">
<h3>Comments ({{ data.comments|length }})</h3>
{% if data.comments %}
{% for comment in data.comments %}
<div class="comment">
<div class="comment-header">
<strong>{{ comment.author or 'Anonymous' }}</strong> - {{ comment.created_at|int|dt }}
</div>
<div>{{ comment.body }}</div>
</div>
{% endfor %}
{% else %}
<p class="text-muted">No comments</p>
{% endif %}
</div>
<div class="card mt-20">
<h3>Runs ({{ data.runs|length }})</h3>
{% if data.runs %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Profile</th>
<th>Status</th>
<th>PID</th>
<th>Started</th>
<th>Ended</th>
<th>Outcome</th>
</tr>
</thead>
<tbody>
{% for run in data.runs %}
<tr>
<td>{{ run.id }}</td>
<td>{{ run.profile or 'N/A' }}</td>
<td><span class="status-badge status-{{ run.status }}">{{ run.status }}</span></td>
<td>{{ run.worker_pid or 'N/A' }}</td>
<td>{% if run.started_at %}{{ run.started_at|int|dt }}{% else %}N/A{% endif %}</td>
<td>{% if run.ended_at %}{{ run.ended_at|int|dt }}{% else %}N/A{% endif %}</td>
<td>{{ run.outcome or 'N/A' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="text-muted">No runs</p>
{% endif %}
</div>
<div class="card mt-20">
<h3>Attachments ({{ data.attachments|length }})</h3>
{% if data.attachments %}
<ul class="attachment-list">
{% for attachment in data.attachments %}
<li>
<strong>{{ attachment.filename }}</strong>
<span class="text-muted">({{ attachment.content_type }}, {{ attachment.size }} bytes)</span>
<br>
<span class="text-small">Uploaded by {{ attachment.uploaded_by or 'unknown' }} on {{ attachment.created_at|int|dt }}</span>
</li>
{% endfor %}
</ul>
{% else %}
<p class="text-muted">No attachments</p>
{% endif %}
</div>
{% endif %}
<p class="mt-20">
<a href="/tasks" class="btn">← Back to Tasks</a>
</p>
{% endblock %}