This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-release.git
The following commit(s) were added to refs/heads/main by this push:
new b50c41e Add a placeholder form to tabulate votes
b50c41e is described below
commit b50c41eabbf2417081315fc90514daee66fa75c1
Author: Sean B. Palmer <[email protected]>
AuthorDate: Fri Jun 27 14:43:40 2025 +0100
Add a placeholder form to tabulate votes
---
atr/routes/compose.py | 1 +
atr/routes/vote.py | 34 ++++++++++++++++++++++++----
atr/templates/check-selected-vote-email.html | 17 ++++++++++----
atr/templates/vote-tabulate.html | 20 ++++++++++++++++
4 files changed, 63 insertions(+), 9 deletions(-)
diff --git a/atr/routes/compose.py b/atr/routes/compose.py
index b602553..310c781 100644
--- a/atr/routes/compose.py
+++ b/atr/routes/compose.py
@@ -40,6 +40,7 @@ async def check(
release: models.Release,
task_mid: str | None = None,
form: wtforms.Form | None = None,
+ empty_form: wtforms.Form | None = None,
archive_url: str | None = None,
vote_task: models.Task | None = None,
) -> response.Response | str:
diff --git a/atr/routes/vote.py b/atr/routes/vote.py
index 676fe03..b2bb95e 100644
--- a/atr/routes/vote.py
+++ b/atr/routes/vote.py
@@ -29,6 +29,7 @@ import atr.routes as routes
import atr.routes.compose as compose
import atr.routes.resolve as resolve
import atr.tasks.message as message
+import atr.template as template
import atr.util as util
@@ -55,19 +56,27 @@ async def selected(session: routes.CommitterSession,
project_name: str, version_
latest_vote_task = await resolve.release_latest_vote_task(release)
archive_url = None
task_mid = None
- if latest_vote_task is not None:
- # Move task_mid_get here?
- task_mid = resolve.task_mid_get(latest_vote_task)
- archive_url = await _task_archive_url_cached(task_mid)
if util.is_dev_environment() and (latest_vote_task is not None):
logging.warning("LOCAL_DEBUG: Setting vote task to completed")
latest_vote_task.status = models.TaskStatus.COMPLETED
latest_vote_task.result = [json.dumps({"mid":
"[email protected]"})]
+ if latest_vote_task is not None:
+ # Move task_mid_get here?
+ task_mid = resolve.task_mid_get(latest_vote_task)
+ archive_url = await _task_archive_url_cached(task_mid)
+
form = await CastVoteForm.create_form()
+ empty_form = await util.QuartFormTyped.create_form()
return await compose.check(
- session, release, task_mid=task_mid, form=form,
archive_url=archive_url, vote_task=latest_vote_task
+ session,
+ release,
+ task_mid=task_mid,
+ form=form,
+ empty_form=empty_form,
+ archive_url=archive_url,
+ vote_task=latest_vote_task,
)
@@ -105,6 +114,16 @@ async def selected_post(session: routes.CommitterSession,
project_name: str, ver
)
[email protected]("/vote/<project_name>/<version_name>/tabulate",
methods=["POST"])
+async def tabulate(session: routes.CommitterSession, project_name: str,
version_name: str) -> str:
+ """Tabulate votes."""
+ await session.check_access(project_name)
+
+ release = await session.release(project_name, version_name,
phase=models.ReleasePhase.RELEASE_CANDIDATE)
+ await _tabulate_votes(session, release)
+ return await template.render("vote-tabulate.html", release=release)
+
+
async def _send_vote(
session: routes.CommitterSession,
release: models.Release,
@@ -155,6 +174,11 @@ async def _send_vote(
return email_recipient, ""
+async def _tabulate_votes(session: routes.CommitterSession, release:
models.Release) -> None:
+ """Tabulate votes."""
+ pass
+
+
async def _task_archive_url(task_mid: str) -> str | None:
if "@" not in task_mid:
return None
diff --git a/atr/templates/check-selected-vote-email.html
b/atr/templates/check-selected-vote-email.html
index fd97b03..138c5bd 100644
--- a/atr/templates/check-selected-vote-email.html
+++ b/atr/templates/check-selected-vote-email.html
@@ -43,12 +43,21 @@
</p>
{% endif %}
{% if archive_url %}
- <p class="mt-2 mb-0 text-muted ps-4">
- <a href="{{ archive_url }}"
+ <div class="mt-2 mb-0 ps-4 d-flex gap-2 align-items-center">
+ <a class="btn btn-sm btn-outline-secondary me-2"
+ href="{{ archive_url }}"
rel="noopener"
target="_blank"
- title="View vote email thread in the archive (opens in new
window)">View vote email thread in the archive <i class="bi
bi-box-arrow-up-right ms-1"></i></a>
- </p>
+ title="View vote email thread in the archive (opens in new
window)">View archived vote thread <i class="bi bi-box-arrow-up-right
ms-1"></i></a>
+ <form action="{{ as_url(routes.vote.tabulate,
project_name=release.project.name, version_name=release.version) }}"
+ method="post"
+ class="mb-0">
+ {{ empty_form.hidden_tag() }}
+ <button class="btn btn-sm btn-outline-primary"
+ title="Tabulate votes"
+ type="submit">Tabulate votes</button>
+ </form>
+ </div>
{% elif task_mid %}
<p class="mt-2 mb-0 text-muted ps-4">Could not retrieve archive URL for
this message.</p>
{% endif %}
diff --git a/atr/templates/vote-tabulate.html b/atr/templates/vote-tabulate.html
new file mode 100644
index 0000000..d8a6f3f
--- /dev/null
+++ b/atr/templates/vote-tabulate.html
@@ -0,0 +1,20 @@
+{% extends "layouts/base.html" %}
+
+{% block title %}
+ Tabulated votes ~ ATR
+{% endblock title %}
+
+{% block description %}
+ Tabulated votes for a release.
+{% endblock description %}
+
+{% block content %}
+ <p>
+ <a href="{{ as_url(routes.release.view, project_name=release.project.name,
version_name=release.version) }}"
+ class="atr-back-link">← Back to release</a>
+ </p>
+
+ <h1>Tabulated votes</h1>
+
+ <p>TODO</p>
+{% endblock content %}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]