- gitea.GetRepo returns FullName + UpdatedAt for the stale-card probe - dashboard collectStale: mai-managed items + linked-repo updated_at >60d + zero open tasks + zero open issues. Sorted longest-stale first, ≤20. Multi-repo items need ALL repos quiet to count as stale. Reuses the 4-worker pool + the already-aggregated task/issue counts from the Tasks / Issues cards (no extra DAV/Gitea fetches). - dashboardCache.invalidate(key) busts a single filter's cache entry; ?refresh=1 routes through it so ↻ button gets fresh data. - "updated Nm ago · cached/fresh" label + ↻ refresh link in dashboard chrome. - Empty-card collapse: with no filter + zero rows the card renders as a one-line muted note instead of full chrome. Filter-active cards keep chrome so m can tell "filter hid it" from "nothing there". - design.md §"Dashboard / daily-driver view" extended with the 4 new surfaces; the 3e "stale (3f)" out-of-scope line dropped. - 5 new tests: stale-surface, stale-skip-recent, refresh-busts-cache, empty-collapse, filter-keeps-chrome. 2 unit tests for gitea.GetRepo.
159 lines
6.6 KiB
Cheetah
159 lines
6.6 KiB
Cheetah
{{define "dashboard-section"}}
|
|
<section id="dashboard-section" class="dashboard">
|
|
|
|
<section class="tagbar" id="dashboard-filterbar">
|
|
<form id="dashboard-filter" class="search"
|
|
hx-get="/dashboard"
|
|
hx-target="#dashboard-section"
|
|
hx-swap="outerHTML"
|
|
hx-trigger="change from:select"
|
|
hx-push-url="true">
|
|
<label>tag
|
|
<select name="tag" multiple size="3">
|
|
{{$sel := .Filter.Tags}}
|
|
{{range $.Filter.Tags}}<option value="{{.}}" selected>{{.}}</option>{{end}}
|
|
</select>
|
|
</label>
|
|
<label>mgmt
|
|
<select name="mgmt" multiple size="4">
|
|
{{$selM := .Filter.Management}}
|
|
<option value="mai" {{if contains $selM "mai"}}selected{{end}}>mai</option>
|
|
<option value="self" {{if contains $selM "self"}}selected{{end}}>self</option>
|
|
<option value="external" {{if contains $selM "external"}}selected{{end}}>external</option>
|
|
</select>
|
|
</label>
|
|
<label>has
|
|
<select name="has" multiple size="2">
|
|
{{$selH := .Filter.HasLinks}}
|
|
<option value="caldav-list" {{if contains $selH "caldav-list"}}selected{{end}}>caldav</option>
|
|
<option value="gitea-repo" {{if contains $selH "gitea-repo"}}selected{{end}}>gitea</option>
|
|
</select>
|
|
</label>
|
|
{{if .Filter.Active}}<a class="clear" href="/dashboard">clear filters</a>{{end}}
|
|
</form>
|
|
<p class="counts muted">
|
|
{{if .P.Cached}}<small title="Served from 60s in-memory cache · built {{.P.BuiltAt.Format "15:04:05"}}">updated {{.UpdatedRel}} · cached</small>
|
|
{{else}}<small>updated {{.UpdatedRel}} · fresh</small>{{end}}
|
|
<a class="refresh" href="{{.RefreshURL}}"
|
|
hx-get="{{.RefreshURL}}"
|
|
hx-target="#dashboard-section"
|
|
hx-swap="outerHTML"
|
|
title="force-refresh: bust the 60s cache for this filter">↻ refresh</a>
|
|
</p>
|
|
</section>
|
|
|
|
<section class="dash-grid">
|
|
|
|
{{$collapse := not .FilterActive}}
|
|
|
|
{{if or .P.Tasks (not $collapse)}}
|
|
<article class="card card-tasks">
|
|
<header>
|
|
<h2>Open tasks <small class="muted">({{.P.TaskTotal}})</small></h2>
|
|
{{if or .P.TaskGroups.Overdue .P.TaskGroups.Today .P.TaskGroups.Tomorrow .P.TaskGroups.Week .P.TaskGroups.NoDue}}
|
|
<p class="task-groups muted">
|
|
{{if .P.TaskGroups.Overdue}}<span class="overdue">Overdue ({{.P.TaskGroups.Overdue}})</span>{{end}}
|
|
{{if .P.TaskGroups.Today}}<span>Today ({{.P.TaskGroups.Today}})</span>{{end}}
|
|
{{if .P.TaskGroups.Tomorrow}}<span>Tomorrow ({{.P.TaskGroups.Tomorrow}})</span>{{end}}
|
|
{{if .P.TaskGroups.Week}}<span>This week ({{.P.TaskGroups.Week}})</span>{{end}}
|
|
{{if .P.TaskGroups.NoDue}}<span>No due ({{.P.TaskGroups.NoDue}})</span>{{end}}
|
|
</p>
|
|
{{end}}
|
|
</header>
|
|
{{if .P.Tasks}}
|
|
<ul class="task-list">
|
|
{{range .P.Tasks}}
|
|
<li class="task-row bucket-{{.Bucket}}" id="task-{{.Todo.UID}}">
|
|
<form class="check"
|
|
hx-post="/dashboard/task/done"
|
|
hx-target="#dashboard-section"
|
|
hx-swap="outerHTML">
|
|
<input type="hidden" name="calendar_url" value="{{.CalendarURL}}">
|
|
<input type="hidden" name="uid" value="{{.Todo.UID}}">
|
|
<button type="submit" title="mark complete">✓</button>
|
|
</form>
|
|
<a class="proj" href="/i/{{.Item.PrimaryPath}}">{{.Item.PrimaryPath}}</a>
|
|
<span class="summary">{{.Todo.Summary}}</span>
|
|
{{if .DueRel}}<span class="due {{if eq .Bucket "overdue"}}bad{{end}}" title="{{if .Todo.Due}}{{.Todo.Due.Format "2006-01-02"}}{{end}}">{{.DueRel}}</span>{{end}}
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p class="empty muted">Nothing open. Nice.</p>
|
|
{{end}}
|
|
</article>
|
|
{{else}}
|
|
<p class="card-collapsed muted">No open tasks.</p>
|
|
{{end}}
|
|
|
|
{{if or .P.Issues (not $collapse)}}
|
|
<article class="card card-issues">
|
|
<header>
|
|
<h2>Open issues <small class="muted">({{.P.IssueTotal}})</small></h2>
|
|
</header>
|
|
{{if .P.Issues}}
|
|
<ul class="issue-list">
|
|
{{range .P.Issues}}
|
|
<li class="issue-row">
|
|
<a class="proj" href="/i/{{.Item.PrimaryPath}}">{{.Item.PrimaryPath}}</a>
|
|
<a class="iss" href="{{.Issue.HTMLURL}}" target="_blank" rel="noopener">#{{.Issue.Number}} {{.Issue.Title}}</a>
|
|
{{range .Issue.Labels}}<span class="label">{{.}}</span>{{end}}
|
|
{{if .Issue.Assignees}}<small class="muted">@ {{range $i, $a := .Issue.Assignees}}{{if $i}}, {{end}}{{$a}}{{end}}</small>{{end}}
|
|
<span class="upd muted" title="{{.Issue.UpdatedAt.Format "2006-01-02 15:04"}}">{{.UpdRel}}</span>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p class="empty muted">No open issues across linked repos.</p>
|
|
{{end}}
|
|
</article>
|
|
{{else}}
|
|
<p class="card-collapsed muted">No open issues.</p>
|
|
{{end}}
|
|
|
|
{{if or .P.RecentDocs (not $collapse)}}
|
|
<article class="card card-docs">
|
|
<header>
|
|
<h2>Recent documents <small class="muted">({{.P.RecentDocsTotal}}, last 30d)</small></h2>
|
|
</header>
|
|
{{if .P.RecentDocs}}
|
|
<ul class="doc-list">
|
|
{{range .P.RecentDocs}}
|
|
<li class="doc-row">
|
|
<span class="per">{{.PER}}</span>
|
|
<span class="ref-type ref-type-{{.Link.RefType}}">{{.Link.RefType}}</span>
|
|
{{if .Link.Note}}<span class="note">{{deref .Link.Note}}</span>{{end}}
|
|
<a class="ref-id" href="{{.Link.RefID}}" target="_blank" rel="noopener">{{.Link.RefID}}</a>
|
|
<a class="proj muted" href="/i/{{.ItemPath}}">{{.ItemPath}}</a>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
{{else}}
|
|
<p class="empty muted">Nothing dated in the last 30 days.</p>
|
|
{{end}}
|
|
</article>
|
|
{{else}}
|
|
<p class="card-collapsed muted">No recent documents.</p>
|
|
{{end}}
|
|
|
|
{{if .P.Stale}}
|
|
<article class="card card-stale">
|
|
<header>
|
|
<h2>Stale projects <small class="muted">({{.P.StaleTotal}}) · consider archiving?</small></h2>
|
|
</header>
|
|
<ul class="stale-list">
|
|
{{range .P.Stale}}
|
|
<li class="stale-row">
|
|
<a class="proj" href="/i/{{.Item.PrimaryPath}}">{{.Item.PrimaryPath}}</a>
|
|
<span class="repo muted">{{.Repo}}</span>
|
|
<span class="last-active" title="{{.LastActive.Format "2006-01-02"}}">last active {{.StaleRel}} ago</span>
|
|
</li>
|
|
{{end}}
|
|
</ul>
|
|
</article>
|
|
{{end}}
|
|
|
|
</section>
|
|
</section>
|
|
{{end}}
|