OXYGENHUB
# 1f1eb06a9009 oxygenhub / templates / proposal.html
12.8 KiB · HTML · last changed Projects: boards of issues, proposals and notes across an owner's repositories, with columns, cards moved without JavaScript, private projects, and the projects shown on issues and proposals 1 month ago source blame history raw
1
{% extends "base.html" %}
2
{% import "repo_tabs.html" as m %}
3
{% block title %}#{{ 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 %} class="wide"{% endblock %}
7
{% block content %}
8
<div class="head"><h1>{{ p.title }} <small class="px">#{{ p.number }}</small>
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 let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %}
16
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %}
17
{% 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 %}
18
{% if landed_already && p.state != "landed" %}<div class="strip warn">Every change is already in {{ p.target }}.</div>{% endif %}
19
<div class="bar">
20
  <span class="modes">
21
    <a href="?tab=conversation"{% if tab == "conversation" %} class="on"{% endif %}>conversation ({{ comments.len() + reviews.len() }})</a>
22
    <a href="?tab=changes"{% if tab == "changes" %} class="on"{% endif %}>changes ({{ changes.len() }})</a>
23
    <a href="?tab=files"{% if tab == "files" %} class="on"{% endif %}>files ({{ files.len() }})</a>
24
  </span>
25
  <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>
26
</div>
27
28
{% if tab == "changes" %}
29
{% if changes.is_empty() %}<p class="empty">Nothing to add: the target already has everything.</p>{% endif %}
30
{% for c in changes %}{% call m::change_row(repo, c) %}{% endfor %}
31
32
{% else if tab == "files" %}
33
{% if !conflicts.is_empty() %}
34
<section class="panel" id="conflicts"><h2>Conflicts the landing would carry</h2>
35
{% 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 %}
36
</section>
37
{% endif %}
38
{% if !files.is_empty() %}{% call m::diff_bar(ignore_ws, "tab=files&") %}{% endif %}
39
{% for f in files %}
40
<details class="file-diff" id="{{ f.anchor }}"{% if f.lines.len() <= 400 %} open{% endif %}>
41
  <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>
42
  {% if f.lines.is_empty() %}<p class="empty">No line changes.</p>{% else %}
43
  <table class="code diff">
44
  {% for l in f.lines %}
45
    <tr class="{{ l.kind.class() }}">
46
      <td class="n">{% if let Some(n) = l.old_no %}{{ n }}{% endif %}</td>
47
      <td class="n">{% if let Some(n) = l.new_no %}{{ n }}{% endif %}</td>
48
      <td class="s">{{ l.kind.sign() }}</td>
49
      <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>
50
        <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>
51
    </tr>
52
    {% if let Some(n) = l.new_no %}{% if let Some(idxs) = placed.get(&crate::web::proposals::key(&f.path, n)) %}
53
    <tr class="ctx"><td colspan="4" class="thread">
54
      {% for i in idxs %}{% let c = comments[*i] %}
55
      <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 %}
56
        {% 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 %}
57
        <div class="body">{{ c.body_html|safe }}</div></div>
58
      {% endfor %}
59
    </td></tr>
60
    {% endif %}{% endif %}
61
  {% endfor %}
62
  </table>
63
  {% endif %}
64
</details>
65
{% endfor %}
66
{% if !outdated.is_empty() %}
67
<section class="panel"><h2>Comments on lines that are gone</h2>
68
{% 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 %}
69
</section>
70
{% endif %}
71
72
{% else %}
73
<div class="side-layout">
74
<div>
75
  {% if !p.body.is_empty() %}<article class="doc">{{ body_html|safe }}</article>{% endif %}
76
  {% for c in comments %}{% if c.row.anchor_change.is_empty() %}
77
  <div class="comment"><span class="who">{{ c.row.author }}</span> <time class="mute" title="{{ c.row.created_ms|when_i }}">{{ c.row.created_ms|ago_i }}</time><div class="body">{{ c.body_html|safe }}</div></div>
78
  {% endif %}{% endfor %}
79
  {% for r in reviews %}
80
  <div class="comment review-{{ r.row.verdict }}"><span class="who">{{ r.row.author }}</span> {% 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 %}commented{% endif %} <time class="mute" title="{{ r.row.created_ms|when_i }}">{{ r.row.created_ms|ago_i }}</time>{% if !r.row.body.is_empty() %}<div class="body">{{ r.body_html|safe }}</div>{% endif %}</div>
81
  {% endfor %}
82
  {% for e in events %}<p class="small mute">{{ e.actor }} {{ e.event }}{% if !e.detail.is_empty() %}: {{ e.detail }}{% endif %} · {{ e.at_ms|ago_i }}</p>{% endfor %}
83
  {% if shell.user.is_some() %}
84
  <form class="card wide" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/comment">
85
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
86
    <label for="body">Comment (Markdown)</label><textarea id="body" name="body" class="md" rows="4" required></textarea>
87
    <button type="submit">COMMENT</button>
88
  </form>
89
  {% if p.is_open() %}
90
  <form class="card wide" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/review">
91
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
92
    <h2>Review</h2>
93
    <label for="rbody">Summary (optional)</label><textarea id="rbody" name="body" rows="3"></textarea>
94
    <div class="choice">
95
      <label><input type="radio" name="verdict" value="comment" checked> comment</label>
96
      <label><input type="radio" name="verdict" value="approve"> approve</label>
97
      <label><input type="radio" name="verdict" value="changes"> request changes</label>
98
    </div>
99
    <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>
100
    <button type="submit">SUBMIT REVIEW</button>
101
  </form>
102
  {% endif %}
103
  {% endif %}
104
</div>
105
<aside class="side">
106
  <h3>Landing</h3>
107
  {% 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>
108
  {% else if p.state == "closed" %}<p class="mute">closed</p>
109
  {% else %}
110
    {% if blockers.is_empty() %}<p><span class="sig sig-valid">✔</span> ready to land</p>{% else %}<ul class="plain small">{% for b in blockers %}<li><span class="sig sig-invalid">✘</span> {{ b }}</li>{% endfor %}</ul>{% endif %}
111
    {% if can_land %}
112
      {% if hub_can_land %}<form method="post" action="{{ repo.url }}/proposal/{{ p.number }}/land"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">LAND</button></form>
113
      {% 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 %}
114
    {% endif %}
115
  {% endif %}
116
  <h3>Labels</h3>
117
  {% if labels.is_empty() %}<p class="mute small">None.</p>{% else %}<p>{% for l in labels %}<span class="label" style="--c: {{ l.colour }}">{{ l.name }}</span> {% endfor %}</p>{% endif %}
118
  {% if repo.can(crate::auth::Access::Write) && !all_labels.is_empty() %}<form class="tiny-form" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/labels"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">{% for l in all_labels %}<label class="small"><input type="checkbox" name="label" value="{{ l.id }}"{% if labels.contains(l) %} checked{% endif %}> {{ l.name }}</label> {% endfor %}<button type="submit" class="small">SET</button></form>{% endif %}
119
  <h3>Projects</h3>
120
  {% if projects.is_empty() %}<p class="mute small">None.</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></li>{% endfor %}</ul>{% endif %}
121
  <h3>Checks</h3>
122
  <div id="checks">
123
  {% if checks.is_empty() %}<p class="mute small">None reported on the projected state{% if !required_checks.is_empty() %}; required: {{ required_checks.join(", ") }}{% endif %}.</p>{% else %}
124
  <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 %}
125
  </div>
126
  <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>
127
  <h3>Approvals</h3>
128
  {% if approvals.is_empty() %}<p class="mute small">None yet{% if requirements.required_approvals > 0 %}; {{ requirements.required_approvals }} sealed required{% endif %}.</p>{% else %}
129
  <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 %}
130
  {% if !owners.is_empty() %}<h3>Code owners</h3><ul class="plain">{% for o in owners %}<li>{{ o }}</li>{% endfor %}</ul>{% endif %}
131
  {% if !depends_on.is_empty() %}<h3>Depends on</h3><ul class="plain">{% for n in depends_on %}<li><a href="{{ repo.url }}/proposal/{{ n }}">#{{ n }}</a></li>{% endfor %}</ul>{% endif %}
132
  {% if can_edit %}
133
  <h3>Edit</h3>
134
  <form class="card" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/edit">
135
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
136
    <label for="etitle">Title</label><input type="text" id="etitle" name="title" value="{{ p.title }}">
137
    <label for="etarget">Target</label><input type="text" id="etarget" name="target" value="{{ p.target }}">
138
    <label for="ebody">Description</label><textarea id="ebody" name="body" rows="4">{{ p.body }}</textarea>
139
    <button type="submit">SAVE</button>
140
  </form>
141
  <form class="card" method="post" action="{{ repo.url }}/proposal/{{ p.number }}/state">
142
    <input type="hidden" name="_csrf" value="{{ shell.csrf }}">
143
    <div class="choice">
144
    {% if p.state == "draft" %}<button type="submit" name="action" value="ready">READY FOR REVIEW</button>{% endif %}
145
    {% if p.state == "open" %}<button type="submit" name="action" value="draft">BACK TO DRAFT</button>{% endif %}
146
    {% if p.is_open() %}<button type="submit" name="action" value="close">CLOSE</button>{% endif %}
147
    {% if p.state == "closed" %}<button type="submit" name="action" value="reopen">REOPEN</button>{% endif %}
148
    </div>
149
  </form>
150
  {% endif %}
151
</aside>
152
</div>
153
{% endif %}
154
{% endblock %}