uplift: add Vue train-selector widget for uplift target selection (bug 2044143)#1255
uplift: add Vue train-selector widget for uplift target selection (bug 2044143)#1255cgsheeh wants to merge 17 commits into
Conversation
|
View this pull request in Lando to land it once approved. |
|
Note: the PR has test failures due to being formatted with the changes from #1251. I figured using that formatting would make this easier to review and reduce churn once we merge that PR. |
shtrom
left a comment
There was a problem hiding this comment.
LGTM (though I'm a bit over my head about Vue 😅).
Blocking for discussion point, but barring those, I have no issue.
zzzeid
left a comment
There was a problem hiding this comment.
First pass, did not review the tests thoroughly but can do that on the second pass.
| <p v-if="status === 'loading'" class="help is-info"> | ||
| Loading release schedule… | ||
| </p> | ||
| <p v-else-if="status === 'error'" class="help is-warning"> | ||
| Could not load release-train guidance. Select repositories manually below. | ||
| </p> |
There was a problem hiding this comment.
This would be better as a single <p> element with the class and content set based on the response result. We could probably simplify this even further by interpreting the response directly, but this would be a step towards that:
<p v-if="loadingMessage" class="help" :class="{'is-info': isLoading, 'is-warning': isErrored>
{{ loadingMessage }}
</p>
There was a problem hiding this comment.
This comment is not addressed. I think it would be nice for us to start using a template-centric approach here, so that we shape the payloads (where we can) to simplify the templates, rather than the other way around. This will make it easier to modularize the templates/components.
There was a problem hiding this comment.
Added a statusMessage which is a computed() that returns a string for display in a single <p>, or nothing if the widget should be rendered.
…g 2044143) Add a train-selector widget that progressively enhances the Django-rendered "Uplift repositories" checkboxes in the uplift request modal. The native checkboxes remain the source of truth for the form submission, so the backend is unchanged -- the widget only reads and toggles them, and falls back to the plain checkboxes if it cannot load. When the "Request Uplift" button is first clicked, the widget fetches release-train guidance from the whattrainisitnow.com API (see bug 2045812) and validates the response with a Zod schema. That response describes the current state of the release cycle (which version is on each train, whether betas remain, whether the release candidate has shipped); the held response drives every recommendation, landing description, and warning the widget produces. The page CSP's `connect-src` is widened to the API origin, which a `csp_origin` helper derives from the configured URL. The widget presents two tabs: - "Select Firefox Version": choosing a target version resolves -- based on the current cycle state -- to the correct uplift train(s) (beta, release, or both), ticks the matching repositories, and shows a single line describing where the patch will land. - "Select Uplift Train": manual repository selection with per-train landing hints that reflect the cycle state, including a warning when beta is selected after betas have closed. The tabs are keyboard- and screen-reader-accessible. Builds on the Vue/TypeScript frontend bootstrap (bug 2047613).
7397e7b to
8fc272a
Compare
Adds `UpliftSubmission.target_selection_method`, a hidden form field the Vue widget populates, and threads it through the submission view. Defaults to `server_rendered` when the widget never mounts.
The widget writes `widget_version`, `widget_manual`, or `server_rendered` into the hidden field so submissions can be attributed to it.
zzzeid
left a comment
There was a problem hiding this comment.
Meant to add this to a comment as well, but if we add a proxy API endpoint in Lando we can avoid having to modify CSP settings.
|
I added tracking on the |
| "repositories": [repo.name], | ||
| "target_selection_method": "widget_version", | ||
| } | ||
| form_data |= CREATE_FORM_DATA |
zzzeid
left a comment
There was a problem hiding this comment.
This branch needs to be updated as it's no longer showing only the changes in this branch (merging/rebasing should work). Currently it's showing changes already in main.
@zzzeid this is fixed. |
@cgsheeh @shtrom any thoughts about this? This will give us more control over the API response shape, error handling, and would simplify the implementation / streamline all client calls to be via Lando instead of third party sites. Can be done in a follow up, but I think this would be good to consider. |
I think it depends on which external sites we'll be contacting. For something like Seems like a reasonable idea but we should approach it on a case-by-case basis as the need arises. 👍 |





Add a train-selector widget that progressively enhances the Django-rendered
"Uplift repositories" checkboxes in the uplift request modal. The native
checkboxes remain the source of truth for the form submission, so the backend
is unchanged -- the widget only reads and toggles them, and falls back to the
plain checkboxes if it cannot load.
When the "Request Uplift" button is first clicked, the widget fetches
release-train guidance from the whattrainisitnow.com API (see bug 2045812) and
validates the response with a Zod schema. That response describes the current
state of the release cycle (which version is on each train, whether betas
remain, whether the release candidate has shipped); the held response drives
every recommendation, landing description, and warning the widget produces.
The page CSP's
connect-srcis widened to the API origin, which acsp_originhelper derives from the configured URL.
The widget presents two tabs:
current cycle state -- to the correct uplift train(s) (beta, release, or
both), ticks the matching repositories, and shows a single line describing
where the patch will land.
hints that reflect the cycle state, including a warning when beta is selected
after betas have closed.
The tabs are keyboard- and screen-reader-accessible.
Builds on the Vue/TypeScript frontend bootstrap (bug 2047613).