Rebase chain UI improvements
- do not show warning 'breaks relation chain' when rebase chain checked
- do not show input rebase chain when change doesn't have parent
Release-Notes: skip
Google-Bug-Id: b/246166556
Change-Id: I67e7b81555885d9d0e417ea6ae727711954467f1
diff --git a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
index b0dbda5..6f8bd9a 100644
--- a/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
+++ b/polygerrit-ui/app/elements/change/gr-confirm-rebase-dialog/gr-confirm-rebase-dialog.ts
@@ -71,6 +71,9 @@
text = '';
@state()
+ shouldRebaseChain = false;
+
+ @state()
private query: AutocompleteQuery;
@state()
@@ -184,7 +187,7 @@
/>
<label id="rebaseOnTipLabel" for="rebaseOnTipInput">
Rebase on top of the ${this.branch} branch<span
- ?hidden=${!this.hasParent}
+ ?hidden=${!this.hasParent || this.shouldRebaseChain}
>
(breaks relation chain)
</span>
@@ -206,7 +209,9 @@
/>
<label id="rebaseOnOtherLabel" for="rebaseOnOtherInput">
Rebase on a specific change, ref, or commit
- <span ?hidden=${!this.hasParent}> (breaks relation chain) </span>
+ <span ?hidden=${!this.hasParent || this.shouldRebaseChain}>
+ (breaks relation chain)
+ </span>
</label>
</div>
<div class="parentRevisionContainer">
@@ -230,10 +235,17 @@
>
</div>
${when(
- this.flagsService.isEnabled(KnownExperimentId.REBASE_CHAIN),
+ this.flagsService.isEnabled(KnownExperimentId.REBASE_CHAIN) &&
+ this.hasParent,
() =>
html`<div>
- <input id="rebaseChain" type="checkbox" />
+ <input
+ id="rebaseChain"
+ type="checkbox"
+ @change=${() => {
+ this.shouldRebaseChain = !!this.rebaseChain?.checked;
+ }}
+ />
<label for="rebaseChain">Rebase all ancestors</label>
</div>`
)}