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 2025/04/25 15:47:59 UTC
(tooling-trusted-release) branch main updated: Remove the old route to add a draft, and update the browser tests
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 3a38d9b Remove the old route to add a draft, and update the browser tests
3a38d9b is described below
commit 3a38d9b6a0e8712e6eb89e5d6abb7ed61d503811
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Fri Apr 25 16:47:37 2025 +0100
Remove the old route to add a draft, and update the browser tests
---
atr/routes/draft.py | 64 -------------
atr/templates/draft-add.html | 176 ------------------------------------
atr/templates/includes/sidebar.html | 29 ------
atr/templates/index-committer.html | 1 +
atr/templates/project-select.html | 2 +-
atr/templates/release-select.html | 12 ---
atr/templates/tutorial.html | 2 +-
playwright/test.py | 21 ++---
8 files changed, 12 insertions(+), 295 deletions(-)
diff --git a/atr/routes/draft.py b/atr/routes/draft.py
index aa293ff..24bbda0 100644
--- a/atr/routes/draft.py
+++ b/atr/routes/draft.py
@@ -127,70 +127,6 @@ class SvnImportForm(util.QuartFormTyped):
submit = wtforms.SubmitField("Queue SVN import task")
-@routes.committer("/draft/add", methods=["GET", "POST"])
-async def add(session: routes.CommitterSession) -> response.Response | str:
- """Show a page to allow the user to rsync files to candidate drafts."""
- # Allow selection of projects via a query parameter
- preselected_project = quart.request.args.get("project")
-
- # Do them outside of the template rendering call to ensure order
- # The user_candidate_drafts call can use cached results from user_projects
- user_projects = await user.projects(session.uid, committee_only=True)
- user_candidate_drafts = await session.user_candidate_drafts
- # Sort the project choices reverse chronologically by their creation date
- # This means that if the user added a project recently, it will be at the top of the list
- sorted_projects = sorted(user_projects, key=lambda p: p.created, reverse=True)
- project_choices = [(p.name, p.full_name or p.name) for p in sorted_projects]
-
- class AddForm(util.QuartFormTyped):
- project_name = wtforms.SelectField("Project", choices=project_choices)
- version_name = wtforms.StringField(
- "Version", validators=[wtforms.validators.InputRequired("Version is required")]
- )
- submit = wtforms.SubmitField("Create candidate draft")
-
- form = await AddForm.create_form()
-
- if preselected_project and quart.request.method == "GET":
- # Ensure the preselected project is valid for the user
- if any(p.name == preselected_project for p in user_projects):
- form.project_name.data = preselected_project
- else:
- await quart.flash(f"Project '{preselected_project}' is not available for selection.", "warning")
-
- if quart.request.method == "POST":
- if not await form.validate_on_submit():
- # TODO: Show the form with errors
- return await session.redirect(add, error="Invalid form data")
-
- try:
- new_release, project = await create_release_draft(
- project_name=str(form.project_name.data), version=str(form.version_name.data), asf_uid=session.uid
- )
- return await session.redirect(
- compose,
- project_name=project.name,
- version_name=new_release.version,
- success="Release candidate draft created successfully",
- )
- except (routes.FlashError, base.ASFQuartException) as e:
- await quart.flash(str(e), "error")
- # Get the preselected project from the query parameters, then fall through to render the template
- preselected_project = quart.request.args.get("project")
-
- return await quart.render_template(
- "draft-add.html",
- asf_id=session.uid,
- projects=sorted_projects,
- server_domain=session.host,
- number_of_release_files=util.number_of_release_files,
- candidate_drafts=user_candidate_drafts,
- user_projects=sorted_projects,
- form=form,
- preselected_project=preselected_project,
- )
-
-
# TODO: Rename to upload.release?
@routes.committer("/upload/<project_name>/<version_name>", methods=["GET", "POST"])
async def add_files(session: routes.CommitterSession, project_name: str, version_name: str) -> response.Response | str:
diff --git a/atr/templates/draft-add.html b/atr/templates/draft-add.html
deleted file mode 100644
index 01aea4c..0000000
--- a/atr/templates/draft-add.html
+++ /dev/null
@@ -1,176 +0,0 @@
-{% extends "layouts/base.html" %}
-
-{% block title %}
- Add candidate draft ~ ATR
-{% endblock title %}
-
-{% block description %}
- Add a candidate draft using rsync.
-{% endblock description %}
-
-{% block content %}
- <h1>Add a candidate draft</h1>
- <p>
- A <strong>candidate draft</strong> is an editable set of files which can be <em>frozen and promoted into a candidate release</em> for voting on by the PMC.
- </p>
- <ul>
- <li>You can only create a new candidate draft if you are a member of the PMC</li>
- <li>Projects can work on multiple candidate drafts for different versions simultaneously</li>
- <li>A candidate draft is only editable until submitted for voting</li>
- </ul>
-
- <h2>Create an empty candidate draft for an existing project</h2>
-
- <form method="post"
- enctype="multipart/form-data"
- class="atr-canary py-4 px-5">
- <input type="hidden" name="form_type" value="single" />
- {{ form.hidden_tag() }}
- <div class="mb-3 pb-3 row border-bottom">
- <label for="{{ form.project_name.id }}"
- class="col-sm-3 col-form-label text-sm-end">{{ form.project_name.label.text }}:</label>
- <div class="col-sm-8">
- {{ form.project_name(class_="mb-2 form-select") }}
- {% if form.project_name.errors -%}<span>{{ form.project_name.errors[0] }}</span>{%- endif %}
- {% if not user_projects %}
- <p class="text-danger">You must be a participant of a project to submit a release candidate.</p>
- {% endif %}
- <p class="text-muted">If your project is not listed above, you may need to add it first.</p>
- </div>
- </div>
-
- <div class="mb-3 pb-3 row border-bottom">
- <label for="{{ form.version_name.id }}"
- class="col-sm-3 col-form-label text-sm-end">{{ form.version_name.label.text }}:</label>
- <div class="col-sm-8">
- {{ form.version_name(class_="form-control") }}
- {% if form.version_name.errors -%}<span>{{ form.version_name.errors[0] }}</span>{%- endif %}
- </div>
- </div>
-
- <div class="row">
- <div class="col-sm-9 offset-sm-3">{{ form.submit(class_="btn btn-primary mt-3") }}</div>
- </div>
- </form>
-
- <h2>Create or update a candidate draft using rsync</h2>
-
- <p>Or use one of the commands below to create or update a candidate draft.</p>
-
- <div class="row row-cols-1 g-4 mb-5">
- {% for project in projects %}
- {% set candidate_drafts = project.candidate_drafts %}
-
- {# Show card for creating a new release if allowed #}
- {% if asf_id in project.committee.committee_members %}
- <div class="col">
- <div class="card h-100">
- <div class="card-body position-relative">
- <div class="position-absolute top-0 end-0 m-2">
- <span class="badge bg-primary">Potential</span>
- </div>
- <h5 class="card-title">{{ project.display_name }}</h5>
- {% if project.committee %}
- <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
- {% endif %}
- <p class="card-text">
- {% if candidate_drafts|length > 0 %}
- This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }}:
- </p>
- <ul>
- {% for draft in candidate_drafts %}
- <li>
- <a href="{{ as_url(routes.draft.drafts) }}#{{ project.name }}-{{ draft.version }}">{{ draft.version }}</a>
- </li>
- {% endfor %}
- </ul>
- <p>
- But to create another one, use the command below.
- {% else %}
- This project does not have a candidate draft.
- To create one and add files, use the command below.
- {% endif %}
- </p>
- </div>
- <div class="card-footer bg-light border-1 pt-4 pb-4 position-relative">
- <button class="btn btn-sm btn-outline-secondary atr-copy-btn fs-6 position-absolute top-0 end-0 m-2"
- data-clipboard-target="#cmd-newdraft-{{ project.name|slugify }}">
- <i class="fas fa-clipboard"></i> Copy
- </button>
- <pre class="small mb-0" id="cmd-newdraft-{{ project.name|slugify }}">rsync -av -e 'ssh -p 2222' ${YOUR_FILES}/ {{ asf_id }}@{{ server_domain }}:/{{ project.name }}/${VERSION}/</pre>
- </div>
- </div>
- </div>
- {% else %}
- <div class="col">
- <div class="card h-100">
- <div class="card-body position-relative">
- <div class="position-absolute top-0 end-0 m-2">
- <span class="badge bg-secondary">Ask</span>
- </div>
- <h5 class="card-title">{{ project.display_name }}</h5>
- {% if project.committee %}
- <h6 class="card-subtitle mb-2 text-muted">{{ project.committee.display_name }}</h6>
- {% endif %}
- <p class="card-text">
- {% if candidate_drafts|length > 0 %}
- This project already has {{ candidate_drafts|length }} candidate draft{{ "s" if candidate_drafts|length > 1 else "" }}:
- </p>
- <ul>
- {% for draft in candidate_drafts %}
- <li>
- <a href="{{ as_url(routes.draft.drafts) }}#{{ project.name }}-{{ draft.version }}">{{ draft.version }}</a>
- </li>
- {% endfor %}
- </ul>
- <p>
- But to create another one, use the command below.
- {% else %}
- This project does not have a candidate draft.
- To create one, you must be a member of the PMC.
- {% endif %}
- </p>
- </div>
- <div class="card-footer bg-light border-1 pt-4 pb-4 position-relative">
- <button class="btn btn-sm btn-outline-secondary atr-copy-btn fs-6 position-absolute top-0 end-0 m-2"
- data-clipboard-target="#cmd-newdraft-{{ project.name|slugify }}">
- <i class="fas fa-clipboard"></i> Copy
- </button>
- <pre class="small mb-0" id="cmd-newdraft-{{ project.name|slugify }}">rsync -av -e 'ssh -p 2222' ${YOUR_FILES}/ {{ asf_id }}@{{ server_domain }}:/{{ project.name }}/${VERSION}/</pre>
- </div>
- </div>
- </div>
- {% endif %}
- {% endfor %}
- </div>
- {% endblock content %}
-
- {% block javascripts %}
- {{ super() }}
- <script>
- init();
- document.addEventListener("DOMContentLoaded", () => {
- const projectSelect = document.getElementById("project_name");
- const suffixInput = document.getElementById("project_label_suffix");
- const prefixSpan = document.getElementById("project-label-prefix");
-
- if (!projectSelect || !suffixInput || !prefixSpan) return;
-
- function updatePrefix() {
- const selectedProjectLabel = projectSelect.value;
- const suffixValue = suffixInput.value.trim();
-
- if (suffixValue) {
- prefixSpan.textContent = selectedProjectLabel + "-";
- } else {
- prefixSpan.textContent = selectedProjectLabel;
- }
- }
-
- projectSelect.addEventListener("change", updatePrefix);
- suffixInput.addEventListener("input", updatePrefix);
-
- updatePrefix();
- });
- </script>
- {% endblock javascripts %}
diff --git a/atr/templates/includes/sidebar.html b/atr/templates/includes/sidebar.html
index e9d290d..1f7a993 100644
--- a/atr/templates/includes/sidebar.html
+++ b/atr/templates/includes/sidebar.html
@@ -50,35 +50,6 @@
{% endfor %}
{% endif %}
- <!--
- <h3>Release candidate drafts</h3>
- <ul>
- <li>
- <a href="{{ as_url(routes.draft.add) }}">Add draft</a>
- </li>
- <li>
- <a href="{{ as_url(routes.draft.drafts) }}">View drafts</a>
- </li>
- </ul>
-
- <h3>Release candidates</h3>
- <ul>
- <li>
- <a href="{{ as_url(routes.candidate.resolve) }}">Resolve vote</a>
- </li>
- </ul>
-
- <h3>Release previews</h3>
- <ul>
- <li>
- <a href="{{ as_url(routes.preview.previews) }}">View previews</a>
- </li>
- <li>
- <a href="{{ as_url(routes.preview.announce) }}">Announce preview</a>
- </li>
- </ul>
- -->
-
<h3>Releases</h3>
<ul>
<li>
diff --git a/atr/templates/index-committer.html b/atr/templates/index-committer.html
index 57946ee..a62ea5d 100644
--- a/atr/templates/index-committer.html
+++ b/atr/templates/index-committer.html
@@ -149,6 +149,7 @@
{% endfor %}
<a href="{{ as_url(routes.draft.start, project_name=project.name) }}"
+ title="Start a new {{ project.display_name }} release"
class="text-decoration-none">
<div class="card h-100 shadow-sm atr-cursor-pointer page-card">
<div class="card-body d-flex justify-content-center align-items-center text-center text-secondary">
diff --git a/atr/templates/project-select.html b/atr/templates/project-select.html
index a1474bb..e401c38 100644
--- a/atr/templates/project-select.html
+++ b/atr/templates/project-select.html
@@ -15,7 +15,7 @@
class="text-decoration-none">
{# TODO: We're only setting data-project-url for style #}
<div class="card h-100 shadow-sm atr-cursor-pointer"
- data-project-url="{{ as_url(routes.draft.add, project=project.name) }}">
+ data-project-url="{{ as_url(routes.release.select, project_name=project.name) }}">
<div class="card-body">
<h3 class="card-title fs-5 mb-2">{{ project.display_name }}</h3>
<h4 class="card-subtitle mb-2 text-muted fs-6">{{ project.name }}</h4>
diff --git a/atr/templates/release-select.html b/atr/templates/release-select.html
index 4952b61..d177b32 100644
--- a/atr/templates/release-select.html
+++ b/atr/templates/release-select.html
@@ -58,18 +58,6 @@
{% endfor %}
{% else %}
{% endif %}
-
- <div class="col">
- <a href="{{ as_url(routes.draft.add, project=project.name) }}"
- class="text-decoration-none">
- <div class="card h-100 shadow-sm atr-cursor-pointer atr-border-dashed">
- <div class="card-body d-flex flex-column justify-content-center align-items-center text-center">
- <i class="fas fa-plus text-secondary fa-2x mb-2"></i>
- <h5 class="card-title text-body-secondary fs-6">Add a release draft</h5>
- </div>
- </div>
- </a>
- </div>
</div>
{% endblock content %}
diff --git a/atr/templates/tutorial.html b/atr/templates/tutorial.html
index 485e26c..1f73790 100644
--- a/atr/templates/tutorial.html
+++ b/atr/templates/tutorial.html
@@ -23,7 +23,7 @@
</p>
<p>
- Once you've uploaded your SSH key, you may be able to <a href="{{ as_url(routes.draft.add) }}">add a release candidate draft</a>. Only Project Management Committee (PMC) members can do this. Once a draft has been created, all PMC members and committers can add files to the draft or delete files from it.
+ Once you've uploaded your SSH key, you may be able to >add a release candidate draft. Only Project Management Committee (PMC) members can do this. Once a draft has been created, all PMC members and committers can add files to the draft or delete files from it.
</p>
<p>
diff --git a/playwright/test.py b/playwright/test.py
index 7530d49..4b0cc88 100644
--- a/playwright/test.py
+++ b/playwright/test.py
@@ -97,22 +97,19 @@ def go_to_path(page: sync_api.Page, path: str, wait: bool = True) -> None:
def lifecycle_01_add_draft(page: sync_api.Page, credentials: Credentials, version_name: str) -> None:
- logging.info("Following link to add draft")
- go_to_path(page, "/draft/add")
+ logging.info("Following link to start a new release")
+ go_to_path(page, "/start/tooling-test-example")
- logging.info("Waiting for the add draft page")
- project_select_locator = page.locator('select[name="project_name"]')
- sync_api.expect(project_select_locator).to_be_visible()
- logging.info("Add draft page loaded")
-
- logging.info("Selecting project 'tooling-test-example'")
- project_select_locator.select_option(label="Apache Tooling Test Example")
+ logging.info("Waiting for the start new release page")
+ version_name_locator = page.locator("input#version_name")
+ sync_api.expect(version_name_locator).to_be_visible()
+ logging.info("Start new release page loaded")
logging.info(f"Filling version '{version_name}'")
- page.locator('input[name="version_name"]').fill(version_name)
+ version_name_locator.fill(version_name)
- logging.info("Submitting the add draft form")
- submit_button_locator = page.locator('input[type="submit"][value="Create candidate draft"]')
+ logging.info("Submitting the start new release form")
+ submit_button_locator = page.locator('input[type="submit"][value="Start new release"]')
sync_api.expect(submit_button_locator).to_be_enabled()
submit_button_locator.click()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org