Lie le nom du projet à son repo dans les listes d'entrées
Les entrées exposent repo_url ; sur /entries et l'accueil, le nom du projet ouvre le repo dans un nouvel onglet (soulignement pointillé). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
46d2596813
commit
cbc8ba8ce0
5 files changed
+17
-2
No files matched your search
@@ -41,6 +41,8 @@ pub struct Entry {
|
|||||||
/// The project's effective color.
|
/// The project's effective color.
|
||||||
pub color: String,
|
pub color: String,
|
||||||
pub client_color: String,
|
pub client_color: String,
|
||||||
|
/// The project's repository link.
|
||||||
|
pub repo_url: Option<String>,
|
||||||
pub started_at: DateTime<Utc>,
|
pub started_at: DateTime<Utc>,
|
||||||
/// `None` while the timer is running.
|
/// `None` while the timer is running.
|
||||||
pub ended_at: Option<DateTime<Utc>>,
|
pub ended_at: Option<DateTime<Utc>>,
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ use crate::models::{Entry, EntryFilter, NewEntry, UpdateEntry};
|
|||||||
/// `?1` is always "now", used to measure running entries.
|
/// `?1` is always "now", used to measure running entries.
|
||||||
const SELECT: &str =
|
const SELECT: &str =
|
||||||
"SELECT e.id, e.project_id, p.name AS project_name, p.client_id, c.name AS client_name,
|
"SELECT e.id, e.project_id, p.name AS project_name, p.client_id, c.name AS client_name,
|
||||||
COALESCE(p.color, c.color) AS color, c.color AS client_color,
|
COALESCE(p.color, c.color) AS color, c.color AS client_color, p.repo_url,
|
||||||
e.started_at, e.ended_at, e.note,
|
e.started_at, e.ended_at, e.note,
|
||||||
strftime('%s', COALESCE(e.ended_at, ?1)) - strftime('%s', e.started_at) AS seconds,
|
strftime('%s', COALESCE(e.ended_at, ?1)) - strftime('%s', e.started_at) AS seconds,
|
||||||
EXISTS (SELECT 1 FROM time_entries o
|
EXISTS (SELECT 1 FROM time_entries o
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ tr:last-child td { border-bottom: 0; }
|
|||||||
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||||
.time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
|
.time { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
|
||||||
.client { color: var(--muted); }
|
.client { color: var(--muted); }
|
||||||
|
.project-link { color: inherit; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
|
||||||
|
.project-link:hover { color: var(--accent); text-decoration-color: currentColor; }
|
||||||
tr.running { background: var(--running); }
|
tr.running { background: var(--running); }
|
||||||
tr.day-head th { color: var(--text); font-weight: 600; font-size: .9rem; padding-top: 1.1rem; }
|
tr.day-head th { color: var(--text); font-weight: 600; font-size: .9rem; padding-top: 1.1rem; }
|
||||||
tbody:first-of-type tr.day-head th { padding-top: .6rem; }
|
tbody:first-of-type tr.day-head th { padding-top: .6rem; }
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{{ e.start_time() }} – {{ e.end_time() }}
|
{{ e.start_time() }} – {{ e.end_time() }}
|
||||||
{% if e.overlaps %}<span class="warn" title="Chevauche une autre entrée">⚠</span>{% endif %}
|
{% if e.overlaps %}<span class="warn" title="Chevauche une autre entrée">⚠</span>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><span class="dot" style="--color: {{ e.color }}"></span><span class="client">{{ e.client_name }}</span> / {{ e.project_name }}</td>
|
<td><span class="dot" style="--color: {{ e.color }}"></span><span class="client">{{ e.client_name }}</span> / {% if let Some(u) = e.repo_url %}<a class="project-link" href="{{ u }}" target="_blank" rel="noopener noreferrer" title="Ouvrir le repo">{{ e.project_name }}</a>{% else %}{{ e.project_name }}{% endif %}</td>
|
||||||
<td class="note">{{ e.note }}</td>
|
<td class="note">{{ e.note }}</td>
|
||||||
<td class="num">{{ e.duration() }}</td>
|
<td class="num">{{ e.duration() }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
|
|||||||
@@ -745,6 +745,17 @@ async fn project_repo_url() {
|
|||||||
assert_eq!(p["repo_url"], "https://git.example.com/acme/site");
|
assert_eq!(p["repo_url"], "https://git.example.com/acme/site");
|
||||||
let (_, html) = get_html(&app, "/clients").await;
|
let (_, html) = get_html(&app, "/clients").await;
|
||||||
assert!(html.contains("href=\"https://git.example.com/acme/site\""));
|
assert!(html.contains("href=\"https://git.example.com/acme/site\""));
|
||||||
|
// Entry lists link the project name to its repository.
|
||||||
|
let (status, _) = add_entry(
|
||||||
|
&app,
|
||||||
|
p["id"].as_i64().unwrap(),
|
||||||
|
local(2026, 3, 10, 9, 0),
|
||||||
|
local(2026, 3, 10, 10, 0),
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
assert_eq!(status, StatusCode::CREATED);
|
||||||
|
let (_, html) = get_html(&app, "/entries?from=2026-03-09&to=2026-03-15").await;
|
||||||
|
assert!(html.contains("class=\"project-link\" href=\"https://git.example.com/acme/site\""));
|
||||||
let (_, p) = send(&app, "PATCH", &project, Some(json!({ "repo_url": "" }))).await;
|
let (_, p) = send(&app, "PATCH", &project, Some(json!({ "repo_url": "" }))).await;
|
||||||
assert!(p["repo_url"].is_null());
|
assert!(p["repo_url"].is_null());
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user