You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by gs...@apache.org on 2026/08/12 21:15:36 UTC

(tooling-llmao) branch main updated: Add Projects list page and member-gated stub.

This is an automated email from the ASF dual-hosted git repository.

gstein pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-llmao.git


The following commit(s) were added to refs/heads/main by this push:
     new 31c3ba7  Add Projects list page and member-gated stub.
31c3ba7 is described below

commit 31c3ba7e295996369ba3adca6ae9de8ef5ade2a2
Author: Greg Stein <gs...@gmail.com>
AuthorDate: Wed Aug 12 16:15:28 2026 -0500

    Add Projects list page and member-gated stub.
    
    Show /projects from list_projects_for (used, budget, %, steward vs
    member) and link to a stub /projects/<name> until the overview ships.
    Navbar includes Projects. Brand image is static/image.png.
    
    Co-authored-by: Grok <gr...@x.ai>
---
 pages.py               |  65 +++++++++++++++++++++++++++++++++++++++++++++++++
 static/image.png       | Bin 0 -> 659813 bytes
 templates/header.ezt   |   5 +++-
 templates/project.ezt  |  18 ++++++++++++++
 templates/projects.ezt |  60 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 147 insertions(+), 1 deletion(-)

diff --git a/pages.py b/pages.py
index fcaa917..2ffa36d 100644
--- a/pages.py
+++ b/pages.py
@@ -157,6 +157,71 @@ async def models_page():
     return result
 
 
+def _money(amount: float) -> str:
+    return f"${amount:,.2f}"
+
+
+def _project_list_rows(rows) -> list:
+    out = []
+    for r in rows:
+        if r.pct_used is None:
+            pct_label = "—"
+        else:
+            pct_label = f"{r.pct_used:.0f}%"
+        out.append(edict({
+            "name": r.project,
+            "href": f"/projects/{r.project}",
+            "is_steward": r.is_steward,
+            "spend": _money(r.spend),
+            "max_budget": _money(r.max_budget),
+            "remaining": _money(r.remaining),
+            "pct_label": pct_label,
+            "budget_duration": r.budget_duration,
+            "budget_type": r.budget_type,
+        }))
+    return out
+
+
+@APP.get("/projects")
+@asfquart.auth.require
+@APP.use_template(TEMPLATES / "projects.ezt")
+async def projects_list():
+    """Projects you belong to, with project-budget summary."""
+    result = await basic_info()
+    result.title = "Projects"
+    result.project_rows = []
+    result.error = None
+    try:
+        ident = await current_identity(APP.cfg)
+        assert ident is not None
+        seam = APP.config["LLMAO_SEAM"]
+        result.project_rows = _project_list_rows(
+            await seam.list_projects_for(ident)
+        )
+    except (AuthzError, BackendUnavailable) as e:
+        result.error = str(e)
+    return result
+
+
+@APP.get("/projects/<project>")
+@asfquart.auth.require
+@APP.use_template(TEMPLATES / "project.ezt")
+async def project_stub(project: str):
+    """Member-gated stub until P0.3 overview."""
+    result = await basic_info()
+    result.title = project
+    result.project = project
+    result.error = None
+    try:
+        ident = await current_identity(APP.cfg)
+        assert ident is not None
+        seam = APP.config["LLMAO_SEAM"]
+        await seam.team_status(ident, project)
+    except (AuthzError, BackendUnavailable) as e:
+        result.error = str(e)
+    return result
+
+
 def _safe_after_path(raw: str | None, default: str = "/keys") -> str:
     """Only allow in-app keys paths as post-revoke/create redirects."""
     if raw in ("/keys", "/keys/other"):
diff --git a/static/image.png b/static/image.png
new file mode 100644
index 0000000..29d2355
Binary files /dev/null and b/static/image.png differ
diff --git a/templates/header.ezt b/templates/header.ezt
index 3aab8f3..6b5234c 100644
--- a/templates/header.ezt
+++ b/templates/header.ezt
@@ -14,7 +14,7 @@
 <nav class="navbar navbar-expand-lg navbar-dark llmao-navbar">
     <div class="container-fluid">
         <a class="navbar-brand d-flex align-items-center" href="/">
-            <img src="/static/llmao-logo.svg" alt="" width="28" height="28" class="me-2">
+            <img src="/static/image.png" alt="" width="28" height="28" class="me-2">
             llmao
         </a>
         <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent"
@@ -35,6 +35,9 @@
                 <li class="nav-item">
                     <a class="nav-link" href="/models">Models</a>
                 </li>
+                <li class="nav-item">
+                    <a class="nav-link" href="/projects">Projects</a>
+                </li>
                 [end]
             </ul>
             <ul class="navbar-nav ms-auto mb-2 mb-lg-0">
diff --git a/templates/project.ezt b/templates/project.ezt
new file mode 100644
index 0000000..a2c037d
--- /dev/null
+++ b/templates/project.ezt
@@ -0,0 +1,18 @@
+[include "header.ezt"]
+<div class="container py-4">
+  <div class="mt-2">[include "flashes.ezt"]</div>
+
+  <p class="small mb-2">
+    <a href="/projects">← Projects</a>
+  </p>
+  <h1 class="h3 mb-3">[project]</h1>
+
+  [if-any error]
+  <div class="alert alert-warning">[error]</div>
+  [else]
+  <p class="text-muted">
+    Project overview (budget meters, by-person usage) is next.
+  </p>
+  [end]
+</div>
+[include "footer.ezt"]
diff --git a/templates/projects.ezt b/templates/projects.ezt
new file mode 100644
index 0000000..81baff9
--- /dev/null
+++ b/templates/projects.ezt
@@ -0,0 +1,60 @@
+[include "header.ezt"]
+<div class="container py-4">
+  <div class="mt-2">[include "flashes.ezt"]</div>
+
+  <h1 class="h3 mb-3">Projects</h1>
+  <p class="text-muted small">
+    Project budgets for ASF projects you belong to. PMC members are
+    <strong>stewards</strong> for that project.
+  </p>
+
+  [if-any error]
+  <div class="alert alert-warning">[error]</div>
+  [end]
+
+  [if-any project_rows]
+  <div class="table-responsive">
+    <table class="table table-sm table-hover align-middle">
+      <thead>
+        <tr>
+          <th>Project</th>
+          <th>Role</th>
+          <th>Used</th>
+          <th>Budget</th>
+          <th>%</th>
+          <th>Period</th>
+          <th>Type</th>
+        </tr>
+      </thead>
+      <tbody>
+        [for project_rows]
+        <tr>
+          <td>
+            <a href="[project_rows.href]">[project_rows.name]</a>
+          </td>
+          <td>
+            [if-any project_rows.is_steward]
+            <span class="badge text-bg-primary">Steward</span>
+            [else]
+            <span class="badge text-bg-secondary">Member</span>
+            [end]
+          </td>
+          <td class="font-monospace small">[project_rows.spend]</td>
+          <td class="font-monospace small">[project_rows.max_budget]</td>
+          <td class="small">[project_rows.pct_label]</td>
+          <td class="small text-muted">[project_rows.budget_duration]</td>
+          <td>
+            <span class="badge text-bg-light text-muted">[project_rows.budget_type]</span>
+          </td>
+        </tr>
+        [end]
+      </tbody>
+    </table>
+  </div>
+  [else]
+  [if-any error][else]
+  <p class="text-muted">You're not listed on any ASF project.</p>
+  [end]
+  [end]
+</div>
+[include "footer.ezt"]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org