Add PG UI support for new changes with base commit

This allows users to specify a non-HEAD base commit
when creating a new change from the web UI.

Bug: Issue 8857
Change-Id: Ic585fafacc4bf21cd1d8bd129e889b42180b80a7
This commit is contained in:
Aaron Gable 2018-05-04 10:17:06 -07:00
parent e8e7328f38
commit 6ff48695ec
3 changed files with 17 additions and 2 deletions
polygerrit-ui/app/elements
admin/gr-create-change-dialog
shared/gr-rest-api-interface

@ -72,6 +72,17 @@ limitations under the License.
</gr-autocomplete>
</span>
</section>
<section class$="[[_computeBranchClass(baseChange)]]">
<span class="title">Provide base commit sha1 for change</span>
<span class="value">
<input
is="iron-input"
id="baseCommitInput"
maxlength="40"
placeholder="(optional)"
bind-value="{{baseCommit}}">
</span>
</section>
<section>
<span class="title">Enter topic for new change</span>
<span class="value">

@ -37,6 +37,7 @@
},
},
baseChange: String,
baseCommit: String,
privateByDefault: String,
canCreate: {
type: Boolean,
@ -73,7 +74,8 @@
const isPrivate = this.$.privateChangeCheckBox.checked;
const isWip = true;
return this.$.restAPI.createChange(this.repoName, this.branch,
this.subject, this.topic, isPrivate, isWip, this.baseChange)
this.subject, this.topic, isPrivate, isWip, this.baseChange,
this.baseCommit)
.then(changeCreated => {
if (!changeCreated) { return; }
Gerrit.Nav.navigateToChange(changeCreated);

@ -1410,9 +1410,10 @@
* @param {boolean=} opt_isPrivate
* @param {boolean=} opt_workInProgress
* @param {string=} opt_baseChange
* @param {string=} opt_baseCommit
*/
createChange(project, branch, subject, opt_topic, opt_isPrivate,
opt_workInProgress, opt_baseChange) {
opt_workInProgress, opt_baseChange, opt_baseCommit) {
return this.send('POST', '/changes/', {
project,
branch,
@ -1421,6 +1422,7 @@
is_private: opt_isPrivate,
work_in_progress: opt_workInProgress,
base_change: opt_baseChange,
base_commit: opt_baseCommit,
}).then(response => this.getResponseObject(response));
},