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 7a7ff1c Avoid showing a KEYS upload button for standing committees 7a7ff1c is described below commit 7a7ff1c36eabd8001e1563056eb4d310ec9de97f Author: Sean B. Palmer <s...@miscoranda.com> AuthorDate: Fri Aug 1 20:16:13 2025 +0100 Avoid showing a KEYS upload button for standing committees --- atr/forms.py | 5 +++ atr/routes/committees.py | 1 + atr/routes/keys.py | 7 +++- atr/templates/committee-view.html | 87 ++++++++++++++++++++------------------- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/atr/forms.py b/atr/forms.py index e67b813..04150e7 100644 --- a/atr/forms.py +++ b/atr/forms.py @@ -395,6 +395,7 @@ def url( label: str, optional: bool = False, validators: list[Any] | None = None, + placeholder: str | None = None, **kwargs: Any, ) -> wtforms.URLField: if validators is None: @@ -403,4 +404,8 @@ def url( validators.append(REQUIRED) else: validators.append(OPTIONAL) + if placeholder is not None: + if "render_kw" not in kwargs: + kwargs["render_kw"] = {} + kwargs["render_kw"]["placeholder"] = placeholder return wtforms.URLField(label, validators=validators, **kwargs) diff --git a/atr/routes/committees.py b/atr/routes/committees.py index 3daed38..31463a4 100644 --- a/atr/routes/committees.py +++ b/atr/routes/committees.py @@ -65,4 +65,5 @@ async def view(name: str) -> str: now=datetime.datetime.now(datetime.UTC), email_from_key=util.email_from_uid, update_committee_keys_form=await UpdateCommitteeKeysForm.create_form(), + is_standing=util.committee_is_standing(name), ) diff --git a/atr/routes/keys.py b/atr/routes/keys.py index cc75493..a5412aa 100644 --- a/atr/routes/keys.py +++ b/atr/routes/keys.py @@ -455,10 +455,15 @@ async def upload(session: routes.CommitterSession) -> str: async with storage.write(session.uid) as write: participant_of_committees = await write.participant_of_committees() + # TODO: Migrate to the forms interface class UploadKeyForm(UploadKeyFormBase): selected_committee = wtforms.SelectField( "Associate keys with committee", - choices=[(c.name, c.display_name) for c in participant_of_committees], + choices=[ + (c.name, c.display_name) + for c in participant_of_committees + if (not util.committee_is_standing(c.name)) or (c.name == "tooling") + ], coerce=str, option_widget=wtforms.widgets.RadioInput(), widget=wtforms.widgets.ListWidget(prefix_label=False), diff --git a/atr/templates/committee-view.html b/atr/templates/committee-view.html index 2c07d01..ee08cd4 100644 --- a/atr/templates/committee-view.html +++ b/atr/templates/committee-view.html @@ -40,53 +40,56 @@ </div> </div> - <div class="card mb-4"> - <div class="card-header bg-light"> - <h3 class="mb-2">Signing keys</h3> - </div> - <div class="card-body"> - <div class="mb-4"> - <a href="{{ as_url(routes.keys.upload) }}" - class="btn btn-outline-primary">Upload a KEYS file</a> + {# Allow tooling to assocaite keys for testing #} + {% if (not is_standing) or (committee.name == "tooling") %} + <div class="card mb-4"> + <div class="card-header bg-light"> + <h3 class="mb-2">Signing keys</h3> </div> - {% if committee.public_signing_keys %} - <div class="table-responsive mb-2"> - <table class="table border table-striped table-hover table-sm"> - <thead> - <tr> - <th class="px-2" scope="col">Key ID</th> - <th class="px-2" scope="col">Email</th> - <th class="px-2" scope="col">Apache UID</th> - </tr> - </thead> - <tbody> - {% for key in committee.public_signing_keys %} + <div class="card-body"> + <div class="mb-4"> + <a href="{{ as_url(routes.keys.upload) }}" + class="btn btn-outline-primary">Upload a KEYS file</a> + </div> + {% if committee.public_signing_keys %} + <div class="table-responsive mb-2"> + <table class="table border table-striped table-hover table-sm"> + <thead> <tr> - <td class="text-break font-monospace px-2"> - <a href="{{ as_url(routes.keys.details, fingerprint=key.fingerprint) }}">{{ key.fingerprint[-16:]|upper }}</a> - </td> - <td class="text-break px-2">{{ email_from_key(key.primary_declared_uid) or 'Not specified' }}</td> - <td class="text-break px-2">{{ key.apache_uid or "-" }}</td> + <th class="px-2" scope="col">Key ID</th> + <th class="px-2" scope="col">Email</th> + <th class="px-2" scope="col">Apache UID</th> </tr> - {% endfor %} - </tbody> - </table> - </div> - <p class="text-muted"> - The <code>KEYS</code> file is automatically generated when you add or remove a key, but you can also use the form below to manually regenerate it. - </p> - <form method="post" - action="{{ as_url(routes.keys.update_committee_keys, committee_name=committee.name) }}" - class="mb-4 d-inline-block"> - {{ update_committee_keys_form.hidden_tag() }} + </thead> + <tbody> + {% for key in committee.public_signing_keys %} + <tr> + <td class="text-break font-monospace px-2"> + <a href="{{ as_url(routes.keys.details, fingerprint=key.fingerprint) }}">{{ key.fingerprint[-16:]|upper }}</a> + </td> + <td class="text-break px-2">{{ email_from_key(key.primary_declared_uid) or 'Not specified' }}</td> + <td class="text-break px-2">{{ key.apache_uid or "-" }}</td> + </tr> + {% endfor %} + </tbody> + </table> + </div> + <p class="text-muted"> + The <code>KEYS</code> file is automatically generated when you add or remove a key, but you can also use the form below to manually regenerate it. + </p> + <form method="post" + action="{{ as_url(routes.keys.update_committee_keys, committee_name=committee.name) }}" + class="mb-4 d-inline-block"> + {{ update_committee_keys_form.hidden_tag() }} - {{ update_committee_keys_form.submit(class_='btn btn-sm btn-outline-secondary') }} - </form> - {% else %} - <p class="mb-4">No keys uploaded for this committee yet.</p> - {% endif %} + {{ update_committee_keys_form.submit(class_='btn btn-sm btn-outline-secondary') }} + </form> + {% else %} + <p class="mb-4">No keys uploaded for this committee yet.</p> + {% endif %} + </div> </div> - </div> + {% endif %} {% endblock content %} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@tooling.apache.org For additional commands, e-mail: commits-h...@tooling.apache.org