Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Make the change request sidebar compact and live

d3dcf54d8b7eb81fcc2b944296329098db7f14f4 · Keenan Nemetz · 11d ago · parent 7137f372

Make the change request sidebar compact and live

Move the review and approval explanations into tooltips, show only the state in each section, and use the overview's run rows for checks. The aside now polls a new fragment endpoint so approvals, checks and landing facts appear without a reload.

server/web/templates/requests.html +35−16

@@ -75,6 +75,11 @@
75 75 </div>
76 76 {{end}}
77 77
78 {{/* A `?` beside a section heading whose explanation would otherwise be a
79 paragraph in the panel. The text is both the tooltip and the accessible
80 name, so a pointer, a keyboard and a screen reader get the same words. */}}
81 {{define "help"}}<span class="help" tabindex="0" role="note" aria-label="{{.}}" data-tip="{{.}}">?</span>{{end}}
82
78 83 {{define "request_landing"}}
79 84 <section>
80 85 <h2>{{icon "git-pull-request"}}What would land</h2>
@@ -99,11 +104,26 @@
99 104 </section>
100 105 {{end}}
101 106
107 {{/* The whole aside is one polling unit: an approval, a finished check or a
108 push from elsewhere should show up without a reload. The swap skips while
109 the reader is inside the panel, so a half-made branch selection is not
110 thrown away under them. */}}
111 {{define "request_aside"}}
112 <div id="request-aside"
113 hx-get="/r/{{.Name}}/requests/{{.Request.ID}}/aside"
114 hx-trigger="every 20s [document.visibilityState === 'visible' &amp;&amp; (!document.activeElement || !document.activeElement.closest('#request-aside'))]"
115 hx-sync="this:replace"
116 hx-swap="outerHTML">
117 {{template "request_landing" .}}
118 {{template "request_sidebar" .}}
119 </div>
120 {{end}}
121
102 122 {{define "request_sidebar"}}
103 123 <div id="request-sidebar">
104 124 {{if .Error}}<p class="error">{{.Error}}</p>{{end}}
105 125 <section>
106 <h2>{{icon "git-branch"}}Review</h2>
126 <h2>{{icon "git-branch"}}Review{{template "help" "The request follows its head branch, so a push moves the head with it. Changing the base or head starts approvals over."}}</h2>
107 127 {{if .CanRetarget}}
108 128 <form method="post" action="/r/{{.Name}}/requests/{{.Request.ID}}/target" class="request-target">
109 129 <input type="hidden" name="csrf" value="{{.CSRF}}">
@@ -118,7 +138,7 @@
118 138 </select>
119 139 <button class="secondary" type="submit" title="Update base and head" aria-label="Update base and head">{{icon "rotate-ccw"}}</button>
120 140 </div>
121 <p class="muted">{{if .HeadRefNote}}{{.HeadRefNote}}. {{end}}Pushes move the head (<a class="sha" href="/r/{{.Name}}/commit/{{.Request.Head}}">{{short .Request.Head}}</a>); changing base or head starts approvals over.</p>
141 <p class="muted small">head <a class="sha" href="/r/{{.Name}}/commit/{{.Request.Head}}">{{short .Request.Head}}</a>{{if .HeadRefNote}} · {{.HeadRefNote}}{{end}}</p>
122 142 </form>
123 143 {{else}}
124 144 <p class="target-summary">
@@ -132,10 +152,8 @@
132 152 </section>
133 153
134 154 <section>
135 <h2>{{icon "check"}}Approvals</h2>
136 <p class="muted">{{.Current}} of {{.Required}} required approval(s).</p>
137 <p class="muted">Approving names the current base and head; a new base or head starts over. An
138 approval stops counting if its author is retired or no longer maintains the repository.</p>
155 <h2>{{icon "check"}}Approvals{{template "help" "Approving names the current base and head; a new base or head starts over. An approval stops counting if its author is retired or no longer maintains the repository."}}</h2>
156 <p class="muted">{{if .Required}}{{.Current}} of {{.Required}} required approval(s).{{else}}No approvals required.{{end}}</p>
139 157 {{if .Approvals}}
140 158 <ul class="approval-list">
141 159 {{range .Approvals}}
@@ -150,23 +168,25 @@
150 168 </section>
151 169
152 170 <section>
153 <h2>{{icon "circle-check"}}Checks</h2>
171 <h2 class="with-more"><span>{{icon "circle-check"}}Checks{{template "help" "Workflow runs for the commit under review. If the base branch requires checks, a failing or missing run blocks landing."}}</span> <a class="more" href="/r/{{.Name}}/requests/{{.Request.ID}}/runs">View runs</a></h2>
154 172 {{with .ContributorCI}}
155 173 <p class="muted">CI is waiting for a maintainer to allow <code>{{.Ref}}</code> at this commit.</p>
156 174 {{end}}
157 175 {{if .Checks}}
158 <ul class="check-list">
176 <div class="side-list">
159 177 {{range .Checks}}
160 <li>
161 <span class="status {{.Status}}">{{.Status}}</span>
162 <a href="/r/{{$.Name}}/runs/{{.ID}}">{{.Job}}</a>
163 </li>
178 <a class="side-run" href="/r/{{$.Name}}/runs/{{.ID}}">
179 <span class="side-run-top">
180 <span class="status {{.Status}}">{{.Status}}</span>
181 <span class="side-subject">{{.Job}}</span>
182 </span>
183 <span class="side-meta"><span>{{.Workflow}}</span><span>{{if not .Started.IsZero}}{{duration .Duration}}{{else}}{{duration .Wait}} queued{{end}}</span><span>{{since .Created.Unix}}</span></span>
184 </a>
164 185 {{end}}
165 </ul>
186 </div>
166 187 {{else if not .ContributorCI}}
167 188 <p class="muted">No CI run for this commit yet.</p>
168 189 {{end}}
169 <p class="section-link"><a href="/r/{{.Name}}/requests/{{.Request.ID}}/runs">View runs</a></p>
170 190 </section>
171 191 </div>
172 192 {{end}}
@@ -274,8 +294,7 @@
274 294 </div>
275 295
276 296 <aside class="thread-side">
277 {{template "request_landing" .}}
278 {{template "request_sidebar" .}}
297 {{template "request_aside" .}}
279 298 </aside>
280 299 </div>
281 300 {{template "footer" .}}