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 9f4ffe9  Add a page to review release previews
9f4ffe9 is described below

commit 9f4ffe99e166e348dc37c0b85cc53b5618851501
Author: Sean B. Palmer <[email protected]>
AuthorDate: Thu Mar 27 16:51:59 2025 +0200

    Add a page to review release previews
---
 atr/routes/modules.py               |  1 +
 atr/routes/preview.py               | 55 +++++++++++++++++++++++++++++++++++++
 atr/templates/includes/sidebar.html |  7 +++++
 atr/templates/preview-review.html   | 53 +++++++++++++++++++++++++++++++++++
 4 files changed, 116 insertions(+)

diff --git a/atr/routes/modules.py b/atr/routes/modules.py
index 2879f8b..7a4f972 100644
--- a/atr/routes/modules.py
+++ b/atr/routes/modules.py
@@ -22,6 +22,7 @@ import atr.routes.dev as dev
 import atr.routes.download as download
 import atr.routes.draft as draft
 import atr.routes.keys as keys
+import atr.routes.preview as preview
 import atr.routes.projects as projects
 import atr.routes.release as release
 import atr.routes.root as root
diff --git a/atr/routes/preview.py b/atr/routes/preview.py
new file mode 100644
index 0000000..8f29713
--- /dev/null
+++ b/atr/routes/preview.py
@@ -0,0 +1,55 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+"""preview.py"""
+
+import asfquart
+import quart
+
+import atr.db as db
+import atr.db.models as models
+import atr.routes as routes
+
+if asfquart.APP is ...:
+    raise RuntimeError("APP is not set")
+
+
[email protected]("/preview/review")
+async def review(session: routes.CommitterSession) -> str:
+    """Show all release previews to which the user has access."""
+    async with db.session() as data:
+        # Get all releases where the user is a PMC member or committer
+        releases = await data.release(
+            stage=models.ReleaseStage.RELEASE,
+            phase=models.ReleasePhase.RELEASE_PREVIEW,
+            _committee=True,
+            _packages=True,
+        ).all()
+
+    # Filter to only show releases for PMCs or PPMCs where the user is a 
member or committer
+    user_previews = []
+    for r in releases:
+        if r.committee is None:
+            continue
+        # For PPMCs the "members" are stored in the committers field
+        if (session.uid in r.committee.committee_members) or (session.uid in 
r.committee.committers):
+            user_previews.append(r)
+
+    return await quart.render_template(
+        "preview-review.html",
+        previews=user_previews,
+    )
diff --git a/atr/templates/includes/sidebar.html 
b/atr/templates/includes/sidebar.html
index 5449ca2..294da48 100644
--- a/atr/templates/includes/sidebar.html
+++ b/atr/templates/includes/sidebar.html
@@ -49,6 +49,13 @@
         </li>
       </ul>
 
+      <h3>Release previews</h3>
+      <ul>
+        <li>
+          <a href="{{ as_url(routes.preview.review) }}">Review previews</a>
+        </li>
+      </ul>
+
       <h3>User management</h3>
       <ul>
         <li>
diff --git a/atr/templates/preview-review.html 
b/atr/templates/preview-review.html
new file mode 100644
index 0000000..32985a4
--- /dev/null
+++ b/atr/templates/preview-review.html
@@ -0,0 +1,53 @@
+{% extends "layouts/base.html" %}
+
+{% block title %}
+  Release previews ~ ATR
+{% endblock title %}
+
+{% block description %}
+  Review release previews for projects where you are a member or committer.
+{% endblock description %}
+
+{% block stylesheets %}
+  {{ super() }}
+  <style>
+      .preview-meta-item::after {
+          content: "•";
+          margin-left: 1rem;
+          color: #ccc;
+      }
+
+      .preview-meta-item:last-child::after {
+          content: none;
+      }
+  </style>
+{% endblock stylesheets %}
+
+{% block content %}
+  <h1>Release previews</h1>
+
+  <p>Here are all the release previews to which you have access.</p>
+
+  {% if previews %}
+    {% for preview in previews %}
+      <div class="card mb-3 bg-light">
+        <div class="card-body">
+          <h3 class="card-title mb-2">{{ preview.committee.display_name }}</h3>
+          <div class="d-flex flex-wrap gap-3 pb-3 mb-2 border-bottom 
preview-meta text-secondary fs-6">
+            <span class="preview-meta-item">Version: {{ preview.version 
}}</span>
+            <span class="preview-meta-item">Stage: {{ 
preview.stage.value.upper() }}</span>
+            <span class="preview-meta-item">Phase: {{ 
preview.phase.value.upper() }}</span>
+            <span class="preview-meta-item">Created: {{ 
preview.created.strftime("%Y-%m-%d %H:%M UTC") }}</span>
+          </div>
+          <!--
+          <div class="d-flex gap-3 align-items-center pt-2">
+            <a class="btn btn-primary" href="[[ 
as_url(routes.preview.review_detail, preview_id=preview.id) ]]">Review 
preview</a>
+          </div>
+          -->
+        </div>
+      </div>
+    {% endfor %}
+  {% else %}
+    <p class="text-secondary fst-italic">There are no release previews 
available for your projects.</p>
+  {% endif %}
+{% endblock content %}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to