OXYGENHUB
# ea85398a51bc oxygenhub / templates / proposal.html
20.2 KiB · HTML · last changed Proposal page: the issue page's sidebar 1 month ago source blame history raw
1
{% extends "base.html" %}
2
{% import "repo_tabs.html" as m %}
3
{% block title %}Proposal #{{ p.number }} {{ p.title }} · {{ repo.owner }}/{{ repo.name }}{% endblock %}
4
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %}
5
{% block tabs %}{% call m::tabs(repo, "proposals") %}{% endblock %}
6
{% block mainclass %}{% if tab != "conversation" %} class="wide"{% endif %}{% endblock %}
7
{% block content %}
8
<div class="head"><h1>{{ p.title }} <small class="px kind-proposal">proposal #{{ p.number }}</small>{% if can_edit %} <a class="go small head-edit" href="#edit" onclick="document.getElementById('edit').open=true">Edit</a>{% endif %}
9
  <small>
10
    <span class="tag{% if p.state == "landed" %} head{% else if p.state == "closed" %} bad{% endif %}">{{ p.state }}</span>
11
    {{ p.author }} wants <span class="lbl lbl-bm">{{ source_label }}</span> into <a class="lbl lbl-bm" href="{{ repo.url }}/tree/{{ p.target }}">{{ p.target }}</a>
12
    · {{ changes.len()|plural("change", "changes") }} · opened <time title="{{ p.created_ms|when_i }}">{{ p.created_ms|ago_i }}</time>
13
  </small>
14
</h1></div>
15
{% if !closes.is_empty() %}<p class="chain" aria-label="The chain of work">{% for c in closes %}<a class="chain-link kind-issue st-{{ c.state }}" href="{{ c.url }}" title="{{ c.title }}"><span class="chain-kind">issue #{{ c.number }}</span> {{ c.title }} <span class="chain-state">{{ c.state }}</span></a>{% if !loop.last %} <span class="chain-and">+</span> {% endif %}{% endfor %}
16
<span class="chain-arrow">→</span> <span class="chain-link kind-proposal st-{{ p.state }}"><span class="chain-kind">proposal #{{ p.number }}</span> <span class="chain-state">{{ p.state }}</span></span>
17
<span class="chain-arrow">→</span> <a class="lbl lbl-bm" href="{{ repo.url }}/tree/{{ p.target }}">{{ p.target }}</a>{% if p.state == "landed" %} <span class="chain-state st-landed">landed</span>{% endif %}</p>{% endif %}
18
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
19
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
20
{% if conflicted %}<div class="strip bad">Landing would carry {{ conflicts.len()|plural("conflict", "conflicts") }}. Any collaborator can push a resolution change to the source; the proposal follows it. <a href="?tab=files#conflicts">See them</a></div>{% endif %}
21
{% if landed_already && p.state != "landed" %}<div class="strip warn">Every change is already in {{ p.target }}.</div>{% endif %}
22
<div class="bar">
23
  <span class="modes">
24
    <a href="?tab=conversation"{% if tab == "conversation" %} class="on"{% endif %}>conversation ({{ comments.len() + reviews.len() }})</a>
25
    <a href="?tab=changes"{% if tab == "changes" %} class="on"{% endif %}>changes ({{ changes.len() }})</a>
26
    <a href="?tab=files"{% if tab == "files" %} class="on"{% endif %}>files ({{ files.len() }})</a>
27
  </span>
28
  <span class="small mute">projected state <code title="{{ state_hash }}">{{ state_hash|short }}</code> · {{ heads.len()|plural("head", "heads") }} · <a href="{{ repo.url }}/tree/{% if let Some(h) = heads.first() %}{{ h }}{% endif %}">browse</a> · <a href="{{ api_url }}">json</a></span>
29
</div>
30
31
{% if tab == "changes" %}
32
{% if changes.is_empty() %}<p class="empty">Nothing to add: the target already has everything.</p>{% endif %}
33
{% for c in changes %}{% call m::change_row(repo, c) %}{% endfor %}
34
35
{% else if tab == "files" %}
36
{% if !conflicts.is_empty() %}
37
<section class="panel" id="conflicts"><h2>Conflicts the landing would carry</h2>
38
{% for c in conflicts %}<p><strong>{{ c.path }}</strong> <span class="tag bad">{{ c.kind }}</span></p>{% if let Some(t) = c.marked %}<pre class="marked">{{ t }}</pre>{% endif %}{% endfor %}
39
</section>
40
{% endif %}
41
{% if !files.is_empty() %}{% call m::diff_bar(ignore_ws, "tab=files&") %}{% endif %}
42
{% for f in files %}
43
<details class="file-diff" id="{{ f.anchor }}"{% if f.lines.len() <= 400 %} open{% endif %}>
44
  <summary><span class="kind kind-{{ f.kind }}">{{ f.kind }}</span> <strong>{{ f.path }}</strong> <span class="counts"><span class="add">+{{ f.added }}</span> <span class="del">−{{ f.removed }}</span></span></summary>
45
  {% if f.lines.is_empty() %}<p class="empty">No line changes.</p>{% else %}
46
  <table class="code diff">
47
  {% for l in f.lines %}
48
    <tr class="{{ l.kind.class() }}">
49
      <td class="n">{% if let Some(n) = l.old_no %}{{ n }}{% endif %}</td>
50
      <td class="n">{% if let Some(n) = l.new_no %}{{ n }}{% endif %}</td>
51
      <td class="s">{{ l.kind.sign() }}</td>
52
      <td class="t">{% call m::line_text(l) %}{% if let Some(n) = l.new_no %}{% if shell.user.is_some() && p.is_open() %}<details class="linecomment"><summary title="Comment on this line">+</summary>
53
        <form method="post" action="{{ repo.url }}/proposal/{{ p.number }}/comment"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="path" value="{{ f.path }}"><input type="hidden" name="line" value="{{ n }}"><textarea name="body" rows="3" required placeholder="Anchored to this line's atom; it follows the line through rebases."></textarea><button type="submit">COMMENT</button></form></details>{% endif %}{% endif %}</td>
54
    </tr>
55
    {% if let Some(n) = l.new_no %}{% if let Some(idxs) = placed.get(&crate::web::proposals::key(&f.path, n)) %}
56
    <tr class="ctx"><td colspan="4" class="thread">
57
      {% for i in idxs %}{% let c = comments[*i] %}
58
      <div class="comment{% if c.row.resolved %} resolved{% endif %}"><span class="who">{{ c.row.author }}</span> <time class="mute" title="{{ c.row.created_ms|when_i }}">{{ c.row.created_ms|ago_i }}</time>{% if c.row.resolved %} <span class="tag">resolved</span>{% endif %}
59
        {% if shell.user.is_some() %}<form class="tiny" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/comment/{{ c.row.id }}/resolve"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button>{% if c.row.resolved %}unresolve{% else %}resolve{% endif %}</button></form>{% endif %}
60
        <div class="body">{{ c.body_html|safe }}</div></div>
61
      {% endfor %}
62
    </td></tr>
63
    {% endif %}{% endif %}
64
  {% endfor %}
65
  </table>
66
  {% endif %}
67
</details>
68
{% endfor %}
69
{% if !outdated.is_empty() %}
70
<section class="panel"><h2>Comments on lines that are gone</h2>
71
{% for i in outdated %}{% let c = comments[*i] %}<div class="comment"><span class="who">{{ c.row.author }}</span> on <code>{{ c.row.path }}</code> <time class="mute">{{ c.row.created_ms|ago_i }}</time><div class="body">{{ c.body_html|safe }}</div></div>{% endfor %}
72
</section>
73
{% endif %}
74
75
{% else %}
76
<div class="side-layout conversation">
77
<div class="timeline">
78
  <div class="tl-item">
79
    <img class="tl-avatar" src="/avatar/{{ p.author }}" alt="" width="36" height="36">
80
    <div class="tl-card">
81
      <div class="tl-head"><a href="/{{ p.author }}"><strong>{{ p.author }}</strong></a> opened this proposal <time title="{{ p.created_ms|when_i }}">{{ p.created_ms|ago_i }}</time>{% if can_edit %} <a class="tl-edit small" href="#edit">edit</a>{% endif %}</div>
82
      {% if p.body.is_empty() %}<p class="tl-empty mute">No description.</p>{% else %}<article class="doc tl-doc">{{ body_html|safe }}</article>{% endif %}
83
    </div>
84
  </div>
85
  {% for t in timeline %}
86
  {% if t.kind == "comment" %}{% let c = comments[t.index] %}
87
  <div class="tl-item">
88
    <img class="tl-avatar" src="/avatar/{{ c.row.author }}" alt="" width="36" height="36">
89
    <div class="tl-card">
90
      <div class="tl-head"><a href="/{{ c.row.author }}"><strong>{{ c.row.author }}</strong></a> commented <time title="{{ c.row.created_ms|when_i }}">{{ c.row.created_ms|ago_i }}</time></div>
91
      <div class="tl-text">{{ c.body_html|safe }}</div>
92
    </div>
93
  </div>
94
  {% else if t.kind == "review" %}{% let r = reviews[t.index] %}
95
  <div class="tl-item review-{{ r.row.verdict }}">
96
    <img class="tl-avatar" src="/avatar/{{ r.row.author }}" alt="" width="36" height="36">
97
    <div class="tl-card">
98
      <div class="tl-head"><a href="/{{ r.row.author }}"><strong>{{ r.row.author }}</strong></a> {% if r.row.verdict == "approve" %}{% if r.sealed %}<span class="sig sig-valid">◈</span> approved and sealed{% else %}<span class="sig sig-unsigned">○</span> approved, seal pending{% endif %}{% else if r.row.verdict == "changes" %}<span class="sig sig-invalid">✘</span> requested changes{% else %}reviewed{% endif %} <time title="{{ r.row.created_ms|when_i }}">{{ r.row.created_ms|ago_i }}</time></div>
99
      {% if !r.row.body.is_empty() %}<div class="tl-text">{{ r.body_html|safe }}</div>{% endif %}
100
    </div>
101
  </div>
102
  {% else %}{% let e = events[t.index] %}
103
  <p class="tl-event"><span class="tl-dot"></span><img class="tl-mini" src="/avatar/{{ e.actor }}" alt="" width="18" height="18"> <strong>{{ e.actor }}</strong> {{ e.event }}{% if e.event.ends_with("by change") && !e.detail.is_empty() %}{% let hash = e.detail.split(' ').next().unwrap_or("") %} <a href="{{ repo.url }}/change/{{ hash }}"><code>{{ hash }}</code></a>{{ e.detail[hash.len()..] }}{% else if !e.detail.is_empty() %}: {{ e.detail }}{% endif %} <time class="mute" title="{{ e.at_ms|when_i }}">{{ e.at_ms|ago_i }}</time></p>
104
  {% endif %}
105
  {% endfor %}
106
  {% if let Some(me) = shell.user %}
107
  <div class="tl-item">
108
    <img class="tl-avatar" src="/avatar/{{ me }}" alt="" width="36" height="36">
109
    <div class="tl-card">
110
      <form method="post" action="{{ repo.url }}/proposal/{{ p.number }}/comment">
111
        <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
112
        <label for="body">Comment (Markdown)</label><textarea id="body" name="body" class="md" rows="4" required></textarea>
113
        <div class="tl-actions"><button type="submit" class="primary-btn">Comment</button></div>
114
      </form>
115
      {% if can_edit && (p.state == "draft" || p.is_open() || p.state == "closed") %}
116
      <form class="tl-actions" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/state">
117
        <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
118
        {% if p.state == "draft" %}<button type="submit" name="action" value="ready">Ready for review</button>{% endif %}
119
        {% if p.state == "open" %}<button type="submit" name="action" value="draft">Back to draft</button>{% endif %}
120
        {% if p.is_open() %}<button type="submit" name="action" value="close" class="danger-btn">Close proposal</button>{% endif %}
121
        {% if p.state == "closed" %}<button type="submit" name="action" value="reopen">Reopen</button>{% endif %}
122
      </form>
123
      {% endif %}
124
    </div>
125
  </div>
126
  {% if p.is_open() %}
127
  <form class="card tl-review" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/review">
128
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
129
    <h2>Review</h2>
130
    <label for="rbody">Summary (optional)</label><textarea id="rbody" name="body" rows="3"></textarea>
131
    <div class="choice">
132
      <label><input type="radio" name="verdict" value="comment" checked> comment</label>
133
      <label><input type="radio" name="verdict" value="approve"> approve</label>
134
      <label><input type="radio" name="verdict" value="changes"> request changes</label>
135
    </div>
136
    <p class="small mute">An approval counts once you seal the changes from a client: <code>oxy seal --proposal {{ shell.base_url }}{{ repo.url }}/proposal/{{ p.number }}</code></p>
137
    <button type="submit">SUBMIT REVIEW</button>
138
  </form>
139
  {% endif %}
140
  {% endif %}
141
  {% if can_edit %}
142
  <details class="panel tl-editbox" id="edit">
143
    <summary>Edit title, target and description</summary>
144
    <form method="post" action="{{ repo.url }}/proposal/{{ p.number }}/edit">
145
      <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
146
      <label for="etitle">Title</label><input type="text" id="etitle" name="title" value="{{ p.title }}">
147
      <label for="etarget">Target bookmark</label><input type="text" id="etarget" name="target" value="{{ p.target }}">
148
      <label for="ebody">Description (Markdown)</label><textarea id="ebody" name="body" class="md" rows="8">{{ p.body }}</textarea>
149
      <div class="tl-actions"><button type="submit" class="primary-btn">Save</button></div>
150
    </form>
151
  </details>
152
  {% endif %}
153
</div>
154
<aside class="side side-sections">
155
  <section class="side-sec">
156
    <div class="side-head"><h3>Landing</h3></div>
157
  {% if p.state == "landed" %}<p><span class="sig sig-valid">✔</span> landed{% if !p.landed_state.is_empty() %} at <code>{{ p.landed_state|short }}</code>{% endif %}</p>
158
  {% if !p.landed_by.is_empty() %}<p class="small mute">by <a href="/{{ p.landed_by }}">{{ p.landed_by }}</a>, {{ p.landed_via }}, {{ p.landed_ms|ago }}</p>{% endif %}
159
  {% else if p.state == "closed" %}<p class="mute">closed</p>
160
  {% else %}
161
    {% if blockers.is_empty() %}<p><span class="sig sig-valid">✔</span> ready to land</p>
162
    {% if requirements.required_approvals == 0 && approvals.is_empty() %}<p class="small warn-text">No approval yet, and this repository's <a href="{{ repo.url }}/settings">settings</a> require none.</p>{% endif %}
163
    {% else %}<ul class="plain small">{% for b in blockers %}<li><span class="sig sig-invalid">✘</span> {{ b }}</li>{% endfor %}</ul>{% endif %}
164
    {% if can_land %}
165
      {% if hub_can_land %}<form method="post" action="{{ repo.url }}/proposal/{{ p.number }}/land"{% if approvals.is_empty() %} onsubmit="return confirm('Land #{{ p.number }} without any approval?')"{% endif %}><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">LAND</button></form>
166
      {% else %}<p class="small">This repository has a trust policy, so land from a client with your key:</p><p class="secret">oxy proposal land {{ shell.base_url }}{{ repo.url }}/proposal/{{ p.number }}</p>{% endif %}
167
    {% endif %}
168
  {% endif %}
169
  </section>
170
  {% if !closes.is_empty() %}<section class="side-sec"><div class="side-head"><h3>Closes</h3></div><ul class="plain small side-list">{% for c in closes %}<li><a href="{{ c.url }}" class="kind-issue">issue #{{ c.number }}</a> {{ c.title }} <span class="mute">{{ c.state }}</span></li>{% endfor %}</ul></section>{% endif %}
171
  <section class="side-sec">
172
    <div class="side-head"><h3>Reviewers</h3>
173
    {% if can_request %}<details class="menu"><summary class="gear" title="Request reviews" aria-label="Request reviews">{% include "gear.html" %}</summary>
174
      <form class="menu-pop" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/reviewers"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="action" value="set">
175
        <p class="menu-title">Request reviews</p>
176
        <input class="menu-filter" type="search" placeholder="Filter people" aria-label="Filter people" data-menu-filter>
177
        <div class="menu-list">{% for u in reviewable %}<label class="menu-item"><input type="checkbox" name="username" value="{{ u }}"{% if requested.contains(u) %} checked{% endif %}> <img class="avatar xs" src="/avatar/{{ u }}" alt="" loading="lazy"> <span class="menu-name">{{ u }}</span></label>{% endfor %}
178
        {% if reviewable.is_empty() %}<p class="menu-empty">Nobody else with access to this repository yet.</p>{% endif %}</div>
179
        <div class="menu-foot"><button type="submit" class="small primary-btn">Apply</button></div>
180
      </form></details>{% endif %}</div>
181
    {% if requested.is_empty() %}<p class="side-empty">No reviews requested</p>{% else %}<ul class="side-people">{% for r in requested %}<li><a href="/{{ r }}"><img class="avatar xs" src="/avatar/{{ r }}" alt="" loading="lazy"> {{ r }}</a> <span class="side-note-inline">awaiting review</span></li>{% endfor %}</ul>{% endif %}
182
  </section>
183
  <section class="side-sec">
184
    <div class="side-head"><h3>Labels</h3>
185
    {% if can_triage %}<details class="menu"><summary class="gear" title="Edit labels" aria-label="Edit labels">{% include "gear.html" %}</summary>
186
      <form class="menu-pop" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/labels"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">
187
        <p class="menu-title">Apply labels to this proposal</p>
188
        {% if !all_labels.is_empty() %}<input class="menu-filter" type="search" placeholder="Filter labels" aria-label="Filter labels" data-menu-filter>{% endif %}
189
        <div class="menu-list">{% for l in all_labels %}<label class="menu-item"><input type="checkbox" name="label" value="{{ l.id }}"{% if labels.contains(l) %} checked{% endif %}> <span class="swatch" style="--c: {{ l.colour }}"></span> <span class="menu-name">{{ l.name }}{% if !l.description.is_empty() %}<small>{{ l.description }}</small>{% endif %}</span></label>{% endfor %}
190
        {% if all_labels.is_empty() %}<p class="menu-empty">This repository has no labels yet.</p>{% endif %}</div>
191
        <div class="menu-foot"><a class="small" href="{{ repo.url }}/labels">Edit labels</a> <button type="submit" class="small primary-btn">Apply</button></div>
192
      </form></details>{% endif %}</div>
193
    {% if labels.is_empty() %}<p class="side-empty">None yet</p>{% else %}<p class="side-labels">{% for l in labels %}<span class="label" style="--c: {{ l.colour }}" title="{{ l.description }}">{{ l.name }}</span> {% endfor %}</p>{% endif %}
194
  </section>
195
  <section class="side-sec">
196
    <div class="side-head"><h3>Projects</h3></div>
197
  {% if projects.is_empty() %}<p class="side-empty">None yet</p>{% else %}<ul class="plain small">{% for (pr, col) in projects %}<li><a href="/projects/{{ pr.owner }}/{{ pr.number }}">{{ pr.title }}</a> <span class="mute">· {{ col }}</span>{% if project_choices.is_some() %}<form class="inline" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/project"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><input type="hidden" name="project" value="{{ pr.number }}"><button name="action" value="remove" class="linkish" title="Take it off this project">remove</button></form>{% endif %}</li>{% endfor %}</ul>{% endif %}
198
  {% if let Some(choices) = project_choices %}{% if choices.is_empty() %}{% if projects.is_empty() %}<p class="side-note"><a href="/projects/{{ repo.owner }}">{{ repo.owner }}'s projects</a></p>{% endif %}{% else %}<form class="side-picker-inline" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/project"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><select name="project" aria-label="Project">{% for pr in choices %}<option value="{{ pr.number }}">{{ pr.title }}</option>{% endfor %}</select> <button name="action" value="add" class="small">Add</button></form>{% endif %}{% endif %}
199
  </section>
200
  <section class="side-sec">
201
    <div class="side-head"><h3>Checks</h3></div>
202
  <div id="checks">
203
  {% if checks.is_empty() %}<p class="side-empty">None reported on the projected state{% if !required_checks.is_empty() %}; required: {{ required_checks.join(", ") }}{% endif %}.</p>{% else %}
204
  <ul class="plain">{% for c in checks %}<li><span class="sig{% if c.status == "passed" %} sig-valid{% else if c.status == "failed" %} sig-invalid{% else %} sig-unsigned{% endif %}">{% if c.status == "passed" %}✔{% else if c.status == "failed" %}✘{% else if c.status == "running" %}…{% else %}○{% endif %}</span> {% if c.url.is_empty() %}{{ c.name }}{% else %}<a href="{{ c.url }}">{{ c.name }}</a>{% endif %} <span class="mute small">{{ c.status }}{% if !c.summary.is_empty() %} · {{ c.summary }}{% endif %}{% if !c.seal.is_empty() %} · sealed{% endif %}</span></li>{% endfor %}</ul>{% endif %}
205
  </div>
206
  <script>(function(){if(!window.EventSource)return;var es=new EventSource("{{ repo.url }}/proposal/{{ p.number }}/events");es.addEventListener("check",function(){es.close();location.reload();});})();</script>
207
  </section>
208
  <section class="side-sec">
209
    <div class="side-head"><h3>Approvals</h3></div>
210
  {% if approvals.is_empty() %}<p class="side-empty">None yet{% if requirements.required_approvals > 0 %}; {{ requirements.required_approvals }} sealed required{% endif %}.</p>{% else %}
211
  <ul class="plain">{% for a in approvals %}<li>{% if a.sealed %}<span class="sig sig-valid">◈</span>{% else %}<span class="sig sig-unsigned">○</span>{% endif %} <a href="/{{ a.account }}">{{ a.account }}</a>{% if !a.sealed %} <span class="mute small">seal pending</span>{% endif %}</li>{% endfor %}</ul>{% endif %}
212
  </section>
213
  {% if !owners.is_empty() %}<section class="side-sec"><div class="side-head"><h3>Code owners</h3></div><ul class="plain small">{% for o in owners %}<li>{{ o }}</li>{% endfor %}</ul></section>{% endif %}
214
  {% if !depends_on.is_empty() %}<section class="side-sec"><div class="side-head"><h3>Depends on</h3></div><ul class="plain small">{% for n in depends_on %}<li><a href="{{ repo.url }}/proposal/{{ n }}">#{{ n }}</a></li>{% endfor %}</ul></section>{% endif %}
215
</aside>
216
</div>
217
{% endif %}
218
{% endblock %}