You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/09/04 13:53:02 UTC
(tooling-trusted-releases) branch sbp updated: Add a catalogue dashboard for admins
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/sbp by this push:
new f71c5de2 Add a catalogue dashboard for admins
f71c5de2 is described below
commit f71c5de2839feefad6c8b2c970294dab7c5e930c
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Sep 4 14:52:33 2026 +0100
Add a catalogue dashboard for admins
---
atr/admin/__init__.py | 407 ++++++++++++------------
atr/admin/templates/admin-catalog.html | 14 -
atr/admin/templates/current-release-delete.html | 2 +-
atr/admin/templates/current-releases.html | 185 +++++------
atr/admin/templates/update-catalog-site.html | 89 ------
atr/admin/templates/update-projects.html | 95 ------
atr/templates/includes/topnav.html | 33 +-
tests/unit/test_admin_delete_committee_keys.py | 4 +-
8 files changed, 304 insertions(+), 525 deletions(-)
diff --git a/atr/admin/__init__.py b/atr/admin/__init__.py
index 392459e4..839c14b6 100644
--- a/atr/admin/__init__.py
+++ b/atr/admin/__init__.py
@@ -89,7 +89,10 @@ _MAXIMUM_PERMITTED_AGE_DAYS: Final = datetime.timedelta(days=90)
type BANNER_RESTORE = Literal["BANNER_RESTORE"]
type BANNER_SET = Literal["BANNER_SET"]
type BROWSE_AS = Literal["BROWSE_AS"]
+type CATALOG_SITE_REBUILD = Literal["CATALOG_SITE_REBUILD"]
+type DELETE_COMMITTEE_KEYS = Literal["DELETE_COMMITTEE_KEYS"]
type LDAP = Literal["LDAP"]
+type PROJECTS_UPDATE = Literal["PROJECTS_UPDATE"]
type REVOKE_ALL_TOKENS = Literal["REVOKE_ALL_TOKENS"]
type REVOKE_SSH_KEYS = Literal["REVOKE_SSH_KEYS"]
type REVOKE_TOKENS = Literal["REVOKE_TOKENS"]
@@ -104,7 +107,12 @@ class BrowseAsUserForm(form.Form):
uid: str = form.label("ASF UID", "Enter the ASF UID to browse as.")
+class CatalogSiteRebuildForm(form.Form):
+ variant: CATALOG_SITE_REBUILD = form.value(CATALOG_SITE_REBUILD)
+
+
class DeleteCommitteeKeysForm(form.Form):
+ variant: DELETE_COMMITTEE_KEYS = form.value(DELETE_COMMITTEE_KEYS)
committee_key: str = form.label("Committee", widget=form.Widget.SELECT)
confirm_delete: Literal["DELETE KEYS"] = form.label("Confirmation", "Type DELETE KEYS to confirm.")
@@ -132,6 +140,10 @@ class LdapLookupForm(form.Form):
)
+class ProjectsUpdateForm(form.Form):
+ variant: PROJECTS_UPDATE = form.value(PROJECTS_UPDATE)
+
+
class ReleaseAgeRow(NamedTuple):
release: sql.Release
age_label: str
@@ -253,6 +265,9 @@ class TestRosterResetForm(form.Form):
confirm_reset: Literal["RESET"] = form.label("Confirmation", "Type RESET to confirm.")
+type CatalogForm = Annotated[DeleteCommitteeKeysForm | ProjectsUpdateForm | CatalogSiteRebuildForm, form.DISCRIMINATOR]
+
+
type SystemForm = Annotated[EditBannerForm | RestoreBannerForm | SendTestMessageForm, form.DISCRIMINATOR]
@@ -297,22 +312,30 @@ def _banner_history_table(restore_rows: list[tuple[sql.Banner, htm.Element]]) ->
@admin.typed
-async def catalog_get(_session: web.Committer, _catalog: Literal["catalog"]) -> str:
+async def catalog_get(_session: web.Committer, _catalog: Literal["catalog"], query_args: web.PageQuery) -> str:
"""
URL: GET /catalog
Pick a committee to correct.
"""
- async with db.session() as data:
- committees = await data.committee().order_by(sql.Committee.key).all()
+ try:
+ validation.pagination_args_validate(query_args)
+ except ValueError as e:
+ raise exceptions.BadRequest(str(e))
+ return await _catalog_page(quart.request.args.get("tab", "catalog"), query_args)
- listing = htpy.ul(".list-group")[
- [
- htpy.li(".list-group-item")[htpy.a(href=f"/admin/catalog/{committee.key}")[committee.name or committee.key]]
- for committee in committees
- ]
- ]
- return await template.render("admin-catalog.html", committees=listing)
+
+@admin.typed
+async def catalog_post(
+ session: web.Committer, _catalog: Literal["catalog"], catalog_form: CatalogForm
+) -> web.WerkzeugResponse:
+ match catalog_form:
+ case DeleteCommitteeKeysForm():
+ return await _catalog_delete_committee_keys(session, catalog_form)
+ case ProjectsUpdateForm():
+ return await _catalog_projects_update(session)
+ case CatalogSiteRebuildForm():
+ return await _catalog_site_rebuild(session)
@admin.typed
@@ -1308,43 +1331,6 @@ def _catalog_import_preview(diff: catalogue_diff.CatalogueDiff) -> htm.Element:
return htpy.div[sections]
-@admin.typed
-async def catalog_site_rebuild_get(
- _session: web.Committer, _catalog_site_rebuild: Literal["catalog-site/rebuild"]
-) -> str | web.WerkzeugResponse | tuple[Mapping[str, Any], int]:
- """
- URL: GET /catalog-site/rebuild
-
- Rebuild the whole static release catalog site.
- """
- rendered_form = await form.render(
- model_cls=form.Empty,
- submit_label="Rebuild catalog site",
- empty=True,
- form_classes="",
- )
- return await template.render("update-catalog-site.html", empty_form=rendered_form)
-
-
-@admin.typed
-async def catalog_site_rebuild_post(
- session: web.Committer, _catalog_site_rebuild: Literal["catalog-site/rebuild"], _form: form.Empty
-) -> str | web.WerkzeugResponse | tuple[Mapping[str, Any], int]:
- """Rebuild the whole static release catalog site."""
- try:
- task = await tasks.catalog_site_generate_all(session.asf_uid)
- return {
- "message": f"Catalog site rebuild task has been queued with ID {task.id}.",
- "category": "success",
- }, 200
- except Exception as e:
- log.exception("Failed to queue catalog site rebuild task")
- return {
- "message": f"Failed to queue catalog site rebuild: {e!s}",
- "category": "error",
- }, 200
-
-
@admin.typed
async def consistency(_session: web.Committer, _consistency: Literal["consistency"]) -> web.TextResponse:
"""
@@ -1435,50 +1421,7 @@ async def current_release_delete_post(
"""
release_key = sql.release_key(str(project_key), str(version_key))
await _delete_releases(session, [release_key])
- return await session.redirect(current_releases)
-
-
-@admin.typed
-async def current_releases(
- _session: web.Committer, _current_releases: Literal["current/releases"], query_args: web.PageQuery
-) -> str:
- """
- URL: GET /current/releases
-
- Display live release-workflow releases across all phases. Catalogued releases
- (those with no workflow revisions) live in the catalog admin pages instead.
- """
- try:
- validation.pagination_args_validate(query_args)
- except ValueError as e:
- raise exceptions.BadRequest(str(e))
- # A release is "current" when it has at least one workflow revision; the
- # imported catalogue has none, so this is the line between the two surfaces
- has_revisions = sql.latest_revision_number_query().is_not(None)
- async with db.session() as data:
- count_result = await data.execute(
- sqlalchemy.select(sqlalchemy.func.count()).select_from(sql.Release).where(has_revisions)
- )
- count = count_result.scalar_one()
- releases = await (
- data.release(_project=True, _committee=True, _revisions=True)
- .where(has_revisions)
- .order_by(sql.Release.key)
- .limit(query_args.limit)
- .offset(query_args.offset)
- .all()
- )
- now = datetime.datetime.now(datetime.UTC)
- release_rows = [_release_age_row(release, now) for release in releases]
- page = web.page_nav(query_args.offset, query_args.limit, count, len(releases))
- return await template.render(
- "current-releases.html",
- release_rows=release_rows,
- release_as_url=mapping.release_as_url,
- count=count,
- limit=query_args.limit,
- page=page,
- )
+ return await session.redirect(catalog_get, tab="releases")
@admin.typed
@@ -1500,77 +1443,6 @@ async def data_model(
return await _data_browse(session, str(model), query_args)
-@admin.typed
-async def delete_committee_keys_get(
- _session: web.Committer, _delete_committee_keys: Literal["delete-committee-keys"]
-) -> str | web.WerkzeugResponse:
- """
- URL: GET /delete-committee-keys
-
- Display the form to delete committee keys.
- """
- async with db.session() as data:
- all_committees = await data.committee(_signing_certificates=True).order_by(sql.Committee.key).all()
- committees_with_keys = [c for c in all_committees if c.signing_certificates]
-
- committee_choices = [(c.key, c.display_name) for c in committees_with_keys]
-
- rendered_form = await form.render(
- model_cls=DeleteCommitteeKeysForm,
- submit_label="Delete all keys for selected committee",
- defaults={"committee_key": committee_choices},
- )
- return await template.render(
- "admin-form.html",
- title="Delete committee keys",
- description="Delete committee keys",
- header="Delete all keys for a committee",
- form=rendered_form,
- )
-
-
-@admin.typed
-async def delete_committee_keys_post(
- session: web.Committer,
- _delete_committee_keys: Literal["delete-committee-keys"],
- delete_form: DeleteCommitteeKeysForm,
-) -> str | web.WerkzeugResponse:
- """
- URL: POST /delete-committee-keys
-
- Delete all keys for selected committee.
- """
- committee_key = delete_form.committee_key
-
- try:
- async with storage.write(session) as write:
- waca = write.as_committee_admin(committee_key)
- num_unlinked, num_deleted, publication = await waca.keys.delete_committee_keys(datatypes.KeySource.WEB)
- except storage.AccessError as e:
- await quart.flash(str(e), "error")
- return await session.redirect(delete_committee_keys_get)
-
- if num_unlinked == 0:
- await quart.flash(f"Committee '{committee_key}' has no keys.", "info")
- else:
- await quart.flash(
- f"Removed {util.plural(num_unlinked, 'key link')} for '{committee_key}'. "
- f"Deleted {util.plural(num_deleted, 'unused key')}.",
- "success",
- )
- publications = {committee_key: publication} if (publication is not None) else {}
- if shared.keys.publication_disabled(publications):
- await quart.flash(
- f"The published KEYS file for '{committee_key}' was not updated"
- " because automated publication is disabled.",
- "warning",
- )
- if failure := shared.keys.publication_failed_warning(publications):
- await quart.flash(failure, "error")
-
- return await session.redirect(delete_committee_keys_get)
-
-
@admin.typed
async def delete_test_openpgp_keys_get(
_session: web.Committer, _delete_test_openpgp_keys: Literal["delete-test-openpgp-keys"]
@@ -1749,43 +1621,6 @@ async def ongoing_tasks_get(
return await _fetch_ongoing_tasks(session, project_key, version_key, revision)
-@admin.typed
-async def projects_update_get(
- _session: web.Committer, _projects_update: Literal["projects/update"]
-) -> str | web.WerkzeugResponse | tuple[Mapping[str, Any], int]:
- """
- URL: GET /projects/update
-
- Update projects from remote data.
- """
- rendered_form = await form.render(
- model_cls=form.Empty,
- submit_label="Update projects",
- empty=True,
- form_classes="",
- )
- return await template.render("update-projects.html", empty_form=rendered_form)
-
-
-@admin.typed
-async def projects_update_post(
- session: web.Committer, _projects_update: Literal["projects/update"], _form: form.Empty
-) -> str | web.WerkzeugResponse | tuple[Mapping[str, Any], int]:
- """Update projects from remote data."""
- try:
- task = await tasks.metadata_update(session.asf_uid, include_projects=True)
- return {
- "message": f"Metadata update task has been queued with ID {task.id}.",
- "category": "success",
- }, 200
- except Exception as e:
- log.exception("Failed to queue metadata update task")
- return {
- "message": f"Failed to queue metadata update: {e!s}",
- "category": "error",
- }, 200
-
-
@admin.typed
async def raise_error(_session: web.Committer, _raise_error: Literal["raise-error"]) -> web.QuartResponse:
"""
@@ -2101,6 +1936,180 @@ async def validate_jwt_post(
return await _validate_jwt_page(rendered_form, result=result)
+async def _catalog_delete_committee_keys(
+ session: web.Committer, delete_form: DeleteCommitteeKeysForm
+) -> web.WerkzeugResponse:
+ committee_key = delete_form.committee_key
+
+ try:
+ async with storage.write(session) as write:
+ waca = write.as_committee_admin(committee_key)
+ num_unlinked, num_deleted, publication = await waca.keys.delete_committee_keys(datatypes.KeySource.WEB)
+ except storage.AccessError as e:
+ await quart.flash(str(e), "error")
+ return await session.redirect(catalog_get, tab="committee-keys")
+
+ if num_unlinked == 0:
+ await quart.flash(f"Committee '{committee_key}' has no keys.", "info")
+ else:
+ await quart.flash(
+ f"Removed {util.plural(num_unlinked, 'key link')} for '{committee_key}'. "
+ f"Deleted {util.plural(num_deleted, 'unused key')}.",
+ "success",
+ )
+ publications = {committee_key: publication} if (publication is not None) else {}
+ if shared.keys.publication_disabled(publications):
+ await quart.flash(
+ f"The published KEYS file for '{committee_key}' was not updated"
+ " because automated publication is disabled.",
+ "warning",
+ )
+ if failure := shared.keys.publication_failed_warning(publications):
+ await quart.flash(failure, "error")
+
+ return await session.redirect(catalog_get, tab="committee-keys")
+
+
+async def _catalog_delete_committee_keys_tab() -> htm.Element:
+ async with db.session() as data:
+ all_committees = await data.committee(_signing_certificates=True).order_by(sql.Committee.key).all()
+ committees_with_keys = [c for c in all_committees if c.signing_certificates]
+
+ committee_choices = [(c.key, c.display_name) for c in committees_with_keys]
+
+ rendered_form = await form.render(
+ model_cls=DeleteCommitteeKeysForm,
+ action=util.as_url(catalog_post, tab="committee-keys"),
+ submit_label="Delete all keys for selected committee",
+ defaults={"committee_key": committee_choices},
+ )
+ block = htm.Block()
+ block.h2["Delete all keys for a committee"]
+ block.append(rendered_form)
+ return block.collect()
+
+
+async def _catalog_page(active_tab: str, query_args: web.PageQuery) -> str:
+ tab_items = [
+ htm.Tab("catalog", "Catalog", _catalog_tab),
+ htm.Tab("releases", "Releases", lambda: _catalog_releases_tab(query_args)),
+ htm.Tab("update-projects", "Update projects", _catalog_projects_update_tab),
+ htm.Tab("committee-keys", "Delete committee keys", _catalog_delete_committee_keys_tab),
+ ]
+ page = htm.Block()
+ page.h1["Catalog"]
+ page.append(await htm.tabs(tab_items, active_key=active_tab, base_url=util.as_url(catalog_get)))
+ return await template.render("admin-blank.html", title="Catalog", content=page.collect())
+
+
+async def _catalog_projects_update(session: web.Committer) -> web.WerkzeugResponse:
+ try:
+ task = await tasks.metadata_update(session.asf_uid, include_projects=True)
+ await quart.flash(f"Metadata update task has been queued with ID {task.id}.", "success")
+ except Exception as e:
+ log.exception("Failed to queue metadata update task")
+ await quart.flash(f"Failed to queue metadata update: {e!s}", "error")
+ return await session.redirect(catalog_get, tab="update-projects")
+
+
+async def _catalog_projects_update_tab() -> htm.Element:
+ rendered_form = await form.render(
+ model_cls=ProjectsUpdateForm,
+ action=util.as_url(catalog_post, tab="update-projects"),
+ submit_label="Update projects",
+ empty=True,
+ form_classes="",
+ )
+ block = htm.Block()
+ block.h2["Update projects"]
+ block.p["Update PMC and podling information in the database from remote data sources."]
+ block.append(
+ htm.div(".alert.alert-warning", role="alert")[
+ htm.p[htm.strong["Note:"], " This operation will update all project information, including:"],
+ htm.ul(".mb-0")[
+ htm.li["PMC member lists and release manager assignments"],
+ htm.li["Podling status and basic information"],
+ htm.li["Project metadata and relationships"],
+ ],
+ ]
+ )
+ block.append(rendered_form)
+ return block.collect()
+
+
+async def _catalog_releases_tab(query_args: web.PageQuery) -> htm.Element:
+ # A release is "current" when it has at least one workflow revision; the
+ # imported catalogue has none, so this is the line between the two surfaces
+ has_revisions = sql.latest_revision_number_query().is_not(None)
+ async with db.session() as data:
+ count_result = await data.execute(
+ sqlalchemy.select(sqlalchemy.func.count()).select_from(sql.Release).where(has_revisions)
+ )
+ count = count_result.scalar_one()
+ releases = await (
+ data.release(_project=True, _committee=True, _revisions=True)
+ .where(has_revisions)
+ .order_by(sql.Release.key)
+ .limit(query_args.limit)
+ .offset(query_args.offset)
+ .all()
+ )
+ now = datetime.datetime.now(datetime.UTC)
+ release_rows = [_release_age_row(release, now) for release in releases]
+ page = web.page_nav(query_args.offset, query_args.limit, count, len(releases))
+ content = await template.render(
+ "current-releases.html",
+ release_rows=release_rows,
+ release_as_url=mapping.release_as_url,
+ count=count,
+ limit=query_args.limit,
+ page=page,
+ )
+ return htm.div[markupsafe.Markup(content)]
+
+
+async def _catalog_site_rebuild(session: web.Committer) -> web.WerkzeugResponse:
+ try:
+ task = await tasks.catalog_site_generate_all(session.asf_uid)
+ await quart.flash(f"Catalog site rebuild task has been queued with ID {task.id}.", "success")
+ except Exception as e:
+ log.exception("Failed to queue catalog site rebuild task")
+ await quart.flash(f"Failed to queue catalog site rebuild: {e!s}", "error")
+ return await session.redirect(catalog_get, tab="catalog")
+
+
+async def _catalog_tab() -> htm.Element:
+ async with db.session() as data:
+ committees = await data.committee().order_by(sql.Committee.key).all()
+
+ listing = htpy.ul(".list-group")[
+ [
+ htpy.li(".list-group-item")[htpy.a(href=f"/admin/catalog/{committee.key}")[committee.name or committee.key]]
+ for committee in committees
+ ]
+ ]
+ rendered_form = await form.render(
+ model_cls=CatalogSiteRebuildForm,
+ action=util.as_url(catalog_post, tab="catalog"),
+ submit_label="Rebuild catalog site",
+ empty=True,
+ form_classes="",
+ )
+ block = htm.Block()
+ block.h2["Catalogue corrections"]
+ block.p[htm.a(href="/admin/catalog/dump")["Dump full catalog contents"]]
+ block.h3["Rebuild catalog site"]
+ block.p[
+ "Catalogue changes refresh the affected pages on their own, so a full rebuild is only needed to"
+ " populate a fresh deployment or to clear up after project renames, moves or deletions."
+ ]
+ block.append(rendered_form)
+ block.h3(".mt-4")["Committees"]
+ block.p["Choose a committee to review and correct its catalogued projects."]
+ block.append(listing)
+ return block.collect()
+
+
def _certificate_block_lines(
certificate: sql.SigningCertificate, signing_keys: set[str], shared: bool
) -> list[tuple[str, str]]:
diff --git a/atr/admin/templates/admin-catalog.html b/atr/admin/templates/admin-catalog.html
deleted file mode 100644
index 7642c2b3..00000000
--- a/atr/admin/templates/admin-catalog.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{% extends "layouts/base-admin.html" %}
-
-{%- block title -%}Catalogue corrections ~ ATR{%- endblock title -%}
-
-{%- block description -%}Pick a committee to correct its projects and artifacts.{%- endblock description -%}
-
-{% block content %}
- <h1>Catalogue corrections</h1>
- <p>
- <a href="/admin/catalog/dump">Dump full catalog contents</a>
- </p>
- <p>Choose a committee to review and correct its catalogued projects.</p>
- {{ committees }}
-{% endblock content %}
diff --git a/atr/admin/templates/current-release-delete.html b/atr/admin/templates/current-release-delete.html
index 16ae8ede..6403d825 100644
--- a/atr/admin/templates/current-release-delete.html
+++ b/atr/admin/templates/current-release-delete.html
@@ -6,7 +6,7 @@
{% block content %}
<h1>Delete release</h1>
- <p><a href="{{ as_url(admin.current_releases) }}">Back to current releases</a></p>
+ <p><a href="{{ as_url(admin.catalog_get, tab="releases") }}">Back to current releases</a></p>
<div class="alert alert-danger" role="alert">
<p class="mb-1"><strong>This permanently deletes {{ release.key }}.</strong></p>
diff --git a/atr/admin/templates/current-releases.html b/atr/admin/templates/current-releases.html
index 26967f32..43135397 100644
--- a/atr/admin/templates/current-releases.html
+++ b/atr/admin/templates/current-releases.html
@@ -1,106 +1,97 @@
-{% extends "layouts/base-admin.html" %}
+<h2>Current releases</h2>
-{%- block title -%}Current releases ~ ATR Admin{%- endblock title -%}
+<div class="alert alert-info" role="alert">
+ These are live release-workflow releases, across all phases. Historical
+ catalogued releases (those with no workflow revisions) are managed in
+ <a href="{{ as_url(admin.catalog_get) }}" class="alert-link">Catalog admin</a>.
+</div>
-{%- block description -%}Live release-workflow releases across all phases.{%- endblock description -%}
+{% if release_rows %}
+ <p>Showing {{ page.start }} to {{ page.end }} of {{ count }} releases.</p>
+{% endif %}
-{% block content %}
- <h1>Current releases</h1>
-
- <div class="alert alert-info" role="alert">
- These are live release-workflow releases, across all phases. Historical
- catalogued releases (those with no workflow revisions) are managed in
- <a href="{{ as_url(admin.catalog_get) }}" class="alert-link">Catalog admin</a>.
- </div>
-
- {% if release_rows %}
- <p>Showing {{ page.start }} to {{ page.end }} of {{ count }} releases.</p>
- {% endif %}
-
- <table class="table table-striped">
- <thead>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>Release name</th>
+ <th>Committee</th>
+ <th>Project</th>
+ <th>Phase</th>
+ <th>Created</th>
+ <th>Age & inactivity</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for row in release_rows %}
+ {% set release = row.release %}
<tr>
- <th>Release name</th>
- <th>Committee</th>
- <th>Project</th>
- <th>Phase</th>
- <th>Created</th>
- <th>Age & inactivity</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {% for row in release_rows %}
- {% set release = row.release %}
- <tr>
- <td>
- {% if release.project %}
- <a href="{{ release_as_url(release) }}">{{ release.key }}</a>
- {% else %}
- {{ release.key }}
- {% endif %}
- </td>
- <td>{{ release.project.committee.key if release.project and release.project.committee else "N/A" }}</td>
- <td>{{ release.project.key if release.project else "N/A" }}</td>
- <td>
- {% set phase_value = release.phase.value %}
- {% if phase_value == "release_candidate_draft" %}
- <span class="badge bg-secondary">1. Draft</span>
- {% elif phase_value == "release_candidate" %}
- <span class="badge bg-info">2. Candidate</span>
- {% elif phase_value == "release_preview" %}
- <span class="badge bg-warning text-dark">3. Preview</span>
- {% elif phase_value == "release" %}
- <span class="badge bg-success">4. Release</span>
- {% else %}
- <span class="badge bg-dark">Unknown</span>
- {% endif %}
- </td>
- <td>{{ release.created.strftime("%Y-%m-%d") }}<br>{{ release.created.strftime("%H:%M:%S UTC") }}</td>
- <td>
- <span{% if row.age_bold %} class="fw-bold"{% endif %}>{{ row.age_label }}</span><br>
- <small class="text-muted{% if row.inactive_bold %} fw-bold{% endif %}">{{ row.inactive_label }}</small>
- </td>
- <td>
- <a class="btn btn-sm btn-outline-danger"
- href="{{ as_url(admin.current_release_delete_get, project_key=release.project_key, version_key=release.version) }}">
- <i class="bi bi-trash"></i> Delete
- </a>
- </td>
- </tr>
- {% else %}
- <tr>
- {% if count %}
- <td colspan="7">No releases to show on this page ({{ count }} total).</td>
+ <td>
+ {% if release.project %}
+ <a href="{{ release_as_url(release) }}">{{ release.key }}</a>
{% else %}
- <td colspan="7">No current releases found.</td>
+ {{ release.key }}
{% endif %}
- </tr>
- {% endfor %}
- </tbody>
- </table>
-
- {% if (page.previous_offset is not none) or (page.next_offset is not none) %}
- <nav aria-label="Current releases pages">
- <ul class="pagination">
- {% if page.previous_offset is not none %}
- <li class="page-item">
- <a class="page-link"
- href="{{ as_url(admin.current_releases, limit=limit, offset=page.previous_offset) }}">Previous</a>
- </li>
- {% else %}
- <li class="page-item disabled"><span class="page-link">Previous</span></li>
- {% endif %}
- {% if page.next_offset is not none %}
- <li class="page-item">
- <a class="page-link"
- href="{{ as_url(admin.current_releases, limit=limit, offset=page.next_offset) }}">Next</a>
- </li>
+ </td>
+ <td>{{ release.project.committee.key if release.project and release.project.committee else "N/A" }}</td>
+ <td>{{ release.project.key if release.project else "N/A" }}</td>
+ <td>
+ {% set phase_value = release.phase.value %}
+ {% if phase_value == "release_candidate_draft" %}
+ <span class="badge bg-secondary">1. Draft</span>
+ {% elif phase_value == "release_candidate" %}
+ <span class="badge bg-info">2. Candidate</span>
+ {% elif phase_value == "release_preview" %}
+ <span class="badge bg-warning text-dark">3. Preview</span>
+ {% elif phase_value == "release" %}
+ <span class="badge bg-success">4. Release</span>
+ {% else %}
+ <span class="badge bg-dark">Unknown</span>
+ {% endif %}
+ </td>
+ <td>{{ release.created.strftime("%Y-%m-%d") }}<br>{{ release.created.strftime("%H:%M:%S UTC") }}</td>
+ <td>
+ <span{% if row.age_bold %} class="fw-bold"{% endif %}>{{ row.age_label }}</span><br>
+ <small class="text-muted{% if row.inactive_bold %} fw-bold{% endif %}">{{ row.inactive_label }}</small>
+ </td>
+ <td>
+ <a class="btn btn-sm btn-outline-danger"
+ href="{{ as_url(admin.current_release_delete_get, project_key=release.project_key, version_key=release.version) }}">
+ <i class="bi bi-trash"></i> Delete
+ </a>
+ </td>
+ </tr>
+ {% else %}
+ <tr>
+ {% if count %}
+ <td colspan="7">No releases to show on this page ({{ count }} total).</td>
{% else %}
- <li class="page-item disabled"><span class="page-link">Next</span></li>
+ <td colspan="7">No current releases found.</td>
{% endif %}
- </ul>
- </nav>
- {% endif %}
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
-{% endblock content %}
+{% if (page.previous_offset is not none) or (page.next_offset is not none) %}
+ <nav aria-label="Current releases pages">
+ <ul class="pagination">
+ {% if page.previous_offset is not none %}
+ <li class="page-item">
+ <a class="page-link"
+ href="{{ as_url(admin.catalog_get, tab="releases", limit=limit, offset=page.previous_offset) }}">Previous</a>
+ </li>
+ {% else %}
+ <li class="page-item disabled"><span class="page-link">Previous</span></li>
+ {% endif %}
+ {% if page.next_offset is not none %}
+ <li class="page-item">
+ <a class="page-link"
+ href="{{ as_url(admin.catalog_get, tab="releases", limit=limit, offset=page.next_offset) }}">Next</a>
+ </li>
+ {% else %}
+ <li class="page-item disabled"><span class="page-link">Next</span></li>
+ {% endif %}
+ </ul>
+ </nav>
+{% endif %}
diff --git a/atr/admin/templates/update-catalog-site.html b/atr/admin/templates/update-catalog-site.html
deleted file mode 100644
index 26f240a3..00000000
--- a/atr/admin/templates/update-catalog-site.html
+++ /dev/null
@@ -1,89 +0,0 @@
-{% extends "layouts/base-admin.html" %}
-
-{%- block title -%}Rebuild catalog site ~ ATR{%- endblock title -%}
-
-{%- block description -%}Rebuild the static release catalog site from the catalogue.{%- endblock description -%}
-
-{% block stylesheets %}
- {{ super() }}
- <style>
- .page-form-group {
- margin-bottom: 1rem;
- }
-
- button {
- margin-top: 1rem;
- padding: 0.5rem 1rem;
- background: #036;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-weight: 500;
- }
-
- button:hover {
- background: #047;
- }
-
- button:disabled {
- color: gray;
- }
-
- .page-warning {
- margin: 1.5rem 0;
- padding: 1rem;
- background: #fff3cd;
- border: 1px solid #ffeeba;
- border-radius: 4px;
- color: #856404;
- }
-
- .page-warning p:last-child {
- margin-bottom: 0;
- }
-
- .page-status-message {
- margin: 1.5rem 0;
- padding: 1rem;
- border-radius: 4px;
- }
-
- .page-status-message.success {
- background: #d4edda;
- border: 1px solid #c3e6cb;
- color: #155724;
- }
-
- .page-status-message.error {
- background: #f8d7da;
- border: 1px solid #f5c6cb;
- color: #721c24;
- }
- </style>
-{% endblock stylesheets %}
-
-{% block content %}
- <h1>Rebuild catalog site</h1>
- <p>
- This page queues a full rebuild of the static release catalog site, writing the whole
- committee, project and release tree out to disk and dropping anything stale.
- </p>
-
- <div class="page-warning">
- <p>
- <strong>Note:</strong> catalogue changes already refresh the affected pages on their own,
- so this is only needed to populate a fresh deployment or to clear up after project renames,
- moves or deletions.
- </p>
- </div>
-
- <div id="status"></div>
-
- {{ empty_form }}
-{% endblock content %}
-
-{% block javascripts %}
- {{ super() }}
- <script src="{{ static_url('js/src/admin-update-form.js') }}"></script>
-{% endblock javascripts %}
diff --git a/atr/admin/templates/update-projects.html b/atr/admin/templates/update-projects.html
deleted file mode 100644
index 033e4d6f..00000000
--- a/atr/admin/templates/update-projects.html
+++ /dev/null
@@ -1,95 +0,0 @@
-{% extends "layouts/base-admin.html" %}
-
-{%- block title -%}Update projects ~ ATR{%- endblock title -%}
-
-{%- block description -%}Update PMCs and podlings from remote data sources.{%- endblock description -%}
-
-{% block stylesheets %}
- {{ super() }}
- <style>
- .page-form-group {
- margin-bottom: 1rem;
- }
-
- button {
- margin-top: 1rem;
- padding: 0.5rem 1rem;
- background: #036;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-weight: 500;
- }
-
- button:hover {
- background: #047;
- }
-
- button:disabled {
- color: gray;
- }
-
- .page-warning {
- margin: 1.5rem 0;
- padding: 1rem;
- background: #fff3cd;
- border: 1px solid #ffeeba;
- border-radius: 4px;
- color: #856404;
- }
-
- .page-warning p:last-child {
- margin-bottom: 0;
- }
-
- .page-warning strong {
- color: #533f03;
- }
-
- .page-status-message {
- margin: 1.5rem 0;
- padding: 1rem;
- border-radius: 4px;
- }
-
- .page-status-message.success {
- background: #d4edda;
- border: 1px solid #c3e6cb;
- color: #155724;
- }
-
- .page-status-message.error {
- background: #f8d7da;
- border: 1px solid #f5c6cb;
- color: #721c24;
- }
- </style>
-{% endblock stylesheets %}
-
-{% block content %}
- <h1>Update projects</h1>
- <p>
- This page allows you to update PMC and podling information in the database from remote data sources.
- </p>
-
- <div class="page-warning">
- <p>
- <strong>Note:</strong> This operation will update all project information, including:
- </p>
- <ul>
- <li>PMC member lists and release manager assignments</li>
- <li>Podling status and basic information</li>
- <li>Project metadata and relationships</li>
- </ul>
- </div>
-
- <div id="status"></div>
-
- {{ empty_form }}
-{% endblock content %}
-
-{% block javascripts %}
- {{ super() }}
- <script src="{{ static_url('js/src/admin-update-form.js') }}"></script>
-{% endblock javascripts %}
diff --git a/atr/templates/includes/topnav.html b/atr/templates/includes/topnav.html
index ee21e604..a8363b4f 100644
--- a/atr/templates/includes/topnav.html
+++ b/atr/templates/includes/topnav.html
@@ -222,6 +222,11 @@
href="{{ as_url(admin.system_get) }}"
{% if request.endpoint == 'atr_admin_system_get' %}class="active"{% endif %}><i class="bi bi-gear"></i> System</a>
</li>
+ <li>
+ <a class="dropdown-item"
+ href="{{ as_url(admin.catalog_get) }}"
+ {% if request.endpoint == 'atr_admin_catalog_get' %}class="active"{% endif %}><i class="bi bi-diagram-3"></i> Catalog</a>
+ </li>
<li>
<a class="dropdown-item"
href="{{ as_url(admin.toggle_view_get) }}"
@@ -237,34 +242,6 @@
<li>
<hr class="dropdown-divider" />
</li>
- <li>
- <a class="dropdown-item"
- href="{{ as_url(admin.current_releases) }}"
- {% if request.endpoint == 'atr_admin_current_releases' %}class="active"{% endif %}><i class="bi bi-list-ul"></i> Current releases</a>
- </li>
- <li>
- <a class="dropdown-item"
- href="{{ as_url(admin.projects_update_get) }}"
- {% if request.endpoint == 'atr_admin_projects_update_get' %}class="active"{% endif %}><i class="bi bi-arrow-repeat"></i> Update projects</a>
- </li>
- <li>
- <a class="dropdown-item"
- href="{{ as_url(admin.catalog_get) }}"
- {% if request.endpoint == 'atr_admin_catalog_get' %}class="active"{% endif %}><i class="bi bi-diagram-3"></i> Catalog admin</a>
- </li>
- <li>
- <a class="dropdown-item"
- href="{{ as_url(admin.catalog_site_rebuild_get) }}"
- {% if request.endpoint == 'atr_admin_catalog_site_rebuild_get' %}class="active"{% endif %}><i class="bi bi-globe"></i> Rebuild catalog site</a>
- </li>
- <li>
- <hr class="dropdown-divider" />
- </li>
- <li>
- <a class="dropdown-item"
- href="{{ as_url(admin.delete_committee_keys_get) }}"
- {% if request.endpoint == 'atr_admin_delete_committee_keys_get' %}class="active"{% endif %}><i class="bi bi-trash"></i> Delete committee keys</a>
- </li>
<li>
<a class="dropdown-item"
href="{{ as_url(admin.keys_check_get) }}"
diff --git a/tests/unit/test_admin_delete_committee_keys.py b/tests/unit/test_admin_delete_committee_keys.py
index b042e027..00276c57 100644
--- a/tests/unit/test_admin_delete_committee_keys.py
+++ b/tests/unit/test_admin_delete_committee_keys.py
@@ -51,10 +51,10 @@ async def test_delete_committee_keys_post_surfaces_storage_error(monkeypatch):
monkeypatch.setattr(admin_routes.quart, "flash", flash)
monkeypatch.setattr(admin_blueprint.common, "authenticate", mock.AsyncMock(return_value=session))
- result = await admin_routes.delete_committee_keys_post()
+ result = await admin_routes.catalog_post()
assert result == "redirected"
write.as_committee_admin.assert_called_once_with("alpha")
keys.delete_committee_keys.assert_awaited_once()
flash.assert_awaited_once_with(str(delete_error), "error")
- session.redirect.assert_awaited_once_with(admin_routes.delete_committee_keys_get)
+ session.redirect.assert_awaited_once_with(admin_routes.catalog_get, tab="committee-keys")
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org