Skip to content

Commit fd16176

Browse files
authoredJan 8, 2024
stack: move the uplift request form into a separate modal (Bug 1801959) (#194)
Create a new modal div that contains the uplift request form. Add a new button for requesting uplifts next to the "Preview Landing" button. Remove the code that allows pressing the "Preview Landing" button even when the stack is not landable since we no longer have the uplift button behind that modal.
1 parent b470018 commit fd16176

File tree

2 files changed

+86
-33
lines changed

2 files changed

+86
-33
lines changed
 

‎landoui/assets_src/js/components/Stack.js

+8
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,13 @@ $.fn.stack = function() {
1515
window.location.href = '/' + e.target.id;
1616
$radio.attr({'disabled': true});
1717
});
18+
19+
// Show the uplift request form modal when the "Request Uplift" button is clicked.
20+
$('.uplift-request-open').on("click", function () {
21+
$('.uplift-request-modal').addClass("is-active");
22+
});
23+
$('.uplift-request-close').on("click", function () {
24+
$('.uplift-request-modal').removeClass("is-active");
25+
});
1826
});
1927
};

‎landoui/templates/stack/stack.html

+78-33
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,30 @@ <h2>Landing is blocked:</h2>
104104
{% endif %}
105105
</div>
106106

107-
<div class="StackPage-actions">
108-
{% if not is_user_authenticated() %}
109-
<button disabled>
110-
<div class="StackPage-actions-headline">Preview Landing</div>
111-
<div class="StackPage-actions-subtitle">You must log in first</div>
112-
</button>
113-
{% elif not user_has_phabricator_token() and (not series or dryrun is none) %}
114-
<button disabled>
115-
<div class="StackPage-actions-headline">Landing Blocked</div>
116-
<div class="StackPage-actions-subtitle">This revision is blocked from landing</div>
117-
</button>
118-
{% else %}
119-
<button class="StackPage-preview-button">
120-
<div class="StackPage-actions-headline">Preview Landing</div>
121-
</button>
122-
{% endif %}
107+
{% set can_uplift_revision = is_user_authenticated() and user_has_phabricator_token() %}
123108

109+
<div class="StackPage-actions">
110+
{% if not is_user_authenticated() %}
111+
<button disabled>
112+
<div class="StackPage-actions-headline">Preview Landing</div>
113+
<div class="StackPage-actions-subtitle">You must log in first</div>
114+
</button>
115+
{% elif not series or dryrun is none %}
116+
<button disabled>
117+
<div class="StackPage-actions-headline">Landing Blocked</div>
118+
<div class="StackPage-actions-subtitle">This revision is blocked from landing</div>
119+
</button>
120+
{% else %}
121+
<button class="StackPage-preview-button">
122+
<div class="StackPage-actions-headline">Preview Landing</div>
123+
</button>
124+
{% endif %}
125+
{% if can_uplift_revision %}
126+
<button class="button uplift-request-open is-normal">
127+
<span class="icon"><i class="fa fa-arrow-circle-up"></i></span>
128+
<div class="StackPage-actions-headline">Request Uplift</span>
129+
</button>
130+
{% endif %}
124131
</div>
125132

126133
{% if is_user_authenticated() %}
@@ -148,23 +155,6 @@ <h2>Landing is blocked:</h2>
148155
</button>
149156
<button class="StackPage-landingPreview-close button">Cancel</button>
150157
</form>
151-
{% if user_has_phabricator_token() %}
152-
<form class="StackPage-landingPreview-uplift" action="{{ url_for('revisions.uplift') }}" method="post">
153-
{{ uplift_request_form.csrf_token }}
154-
<input type="hidden" name="revision_id" value="{{ revision_id }}" />
155-
{{ uplift_request_form.repository }}
156-
<button
157-
class="button"
158-
title="Create Phabricator review requests for the selected patch stack to land in the specified uplift train." >
159-
Request uplift
160-
</button>
161-
</form>
162-
<a class="button" target="_blank" href="https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift">
163-
<span class="icon">
164-
<i class="fa fa-question-circle"></i>
165-
</span>
166-
</a>
167-
{% endif %}
168158
</footer>
169159
</div>
170160
</div>
@@ -187,5 +177,60 @@ <h2>Landing is blocked:</h2>
187177
</div>
188178
</div>
189179

180+
{% if can_uplift_revision %}
181+
<div class="uplift-request-modal modal">
182+
<form action="{{ url_for('revisions.uplift') }}" method="post">
183+
184+
<div class="modal-background"></div>
185+
186+
<div class="modal-card">
187+
{{ uplift_request_form.csrf_token }}
188+
189+
<header class="modal-card-head">
190+
<p class="modal-card-title">Request uplift</p>
191+
<button class="uplift-request-close delete" aria-label="close" type="button"></button>
192+
</header>
193+
194+
<section class="modal-card-body">
195+
<input type="hidden" name="revision_id" value="{{ revision_id }}" />
196+
197+
<p class="block">
198+
Select the repository you wish to uplift this revision to.
199+
Once you submit the request, you will be redirected to the new uplift revision on Phabricator.
200+
Scroll to the bottom of the page, select "Change uplift request form" and complete the form.
201+
Your revision will be reviewed and landed by a release manager.
202+
</p>
203+
204+
<div class="block">
205+
<a class="button" target="_blank" type="button" href="https://wiki.mozilla.org/index.php?title=Release_Management/Requesting_an_Uplift">
206+
<span class="icon">
207+
<i class="fa fa-question-circle"></i>
208+
</span>
209+
<span>Uplift request documentation</span>
210+
</a>
211+
</div>
212+
213+
<div class="field">
214+
<label class="label">Uplift repository</label>
215+
<div class="control">
216+
<div class="select">
217+
{{ uplift_request_form.repository }}
218+
</div>
219+
</div>
220+
</div>
221+
</section>
222+
223+
<footer class="modal-card-foot">
224+
<button
225+
class="button is-success"
226+
title="Create Phabricator review requests for the selected patch stack to land in the specified uplift train." >
227+
Create uplift request
228+
</button>
229+
</footer>
230+
231+
</form>
232+
</div>
233+
{% endif %}
234+
190235
</main>
191236
{% endblock %}

0 commit comments

Comments
 (0)
Failed to load comments.