Add a possible tab "Submitted Together"

As the MergeQueue is gone we also submit ancestors
of a change on its submission. So we want an easy way
to inform the user what happens when clicking on the
submit button. Before the MergeQueue was removed the
"Same Topic" tab did this exactly as all the changes
listed there were submitted if change.submitWholeTopic
was enabled. (If it was disabled it was still there,
but the information was not of any value as topics do
not have meaning apart from informal bundling changes.)

To make a better user experience we need a tab which
displays all the changes which would be submitted,
when clicking on the submit button. As the "Same Topic"
tab comes close to this, we'll reuse it for this
purpose and rename it to "Submitted Together" to
hint at the intent of this tab.

Change-Id: Ie23970aa737da4041c2ed7bea84c34a9a376f8fe
This commit is contained in:
Stefan Beller 2015-06-29 16:20:10 -07:00
parent bf2767cd64
commit 09feaaccbc
6 changed files with 42 additions and 1 deletions

View File

@ -571,6 +571,17 @@ change. Only open changes are included in the list.
+
image::images/user-review-ui-change-screen-same-topic.png[width=800, link="images/user-review-ui-change-screen-same-topic.png"]
- [[submitted-together]]`Submitted Together`:
+
This tab page shows changes that will be submitted together with the
currently viewed change, when clicking the submit button. It includes
ancestors of the current patch set.
+
This may include changes and its ancestors with the same topic if
`change.submitWholeTopic` is enabled. Only open changes with the
same topic are included in the list.
+
- [[cherry-picks]]`Cherry-Picks`:
+
This tab page shows changes with the same link:user-changeid.html[

View File

@ -43,6 +43,8 @@ interface ChangeConstants extends Constants {
String cherryPicksTooltip();
String sameTopic();
String sameTopicTooltip();
String submittedTogether();
String submittedTogetherTooltip();
String noChanges();
String indirectAncestor();
String merged();

View File

@ -24,6 +24,8 @@ cherryPicks = Cherry-Picks
cherryPicksTooltip = Changes with the same Change-Id
sameTopic = Same Topic
sameTopicTooltip = Changes with the same topic
submittedTogether = Submitted Together
submittedTogetherTooltip = Changes submitted together with this change
noChanges = No Changes
indirectAncestor = Indirect ancestor
merged = Merged

View File

@ -27,5 +27,7 @@ public interface ChangeMessages extends Messages {
String cherryPicks(String count);
String sameTopic(int count);
String sameTopic(String count);
String submittedTogether(int count);
String submittedTogether(String count);
String editPatchSet(int patchSet);
}

View File

@ -4,4 +4,5 @@ relatedChanges = Related Changes ({0})
conflictingChanges = Conflicts With ({0})
cherryPicks = Cherry-Picks ({0})
sameTopic = Same Topic ({0})
submittedTogether = Submitted Together ({0})
editPatchSet = edit:{0}

View File

@ -16,12 +16,14 @@ package com.google.gerrit.client.change;
import static com.google.gerrit.common.PageLinks.op;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.changes.ChangeApi;
import com.google.gerrit.client.changes.ChangeInfo;
import com.google.gerrit.client.changes.ChangeInfo.CommitInfo;
import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
import com.google.gerrit.client.changes.ChangeList;
import com.google.gerrit.client.rpc.Natives;
import com.google.gerrit.client.rpc.RestApi;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@ -78,6 +80,19 @@ public class RelatedChanges extends TabPanel {
}
},
SUBMITTED_TOGETHER(Resources.C.submittedTogether(),
Resources.C.submittedTogether()) {
@Override
String getTitle(int count) {
return Resources.M.submittedTogether(count);
}
@Override
String getTitle(String count) {
return Resources.M.submittedTogether(count);
}
},
SAME_TOPIC(Resources.C.sameTopic(),
Resources.C.sameTopicTooltip()) {
@Override
@ -174,6 +189,9 @@ public class RelatedChanges extends TabPanel {
getTab(Tab.SAME_TOPIC).setShowBranches(true);
getTab(Tab.SAME_TOPIC).setShowProjects(true);
getTab(Tab.SAME_TOPIC).setShowSubmittable(true);
getTab(Tab.SUBMITTED_TOGETHER).setShowBranches(true);
getTab(Tab.SUBMITTED_TOGETHER).setShowProjects(true);
getTab(Tab.SUBMITTED_TOGETHER).setShowSubmittable(true);
}
void set(final ChangeInfo info, final String revision) {
@ -198,7 +216,12 @@ public class RelatedChanges extends TabPanel {
EnumSet.of(ListChangesOption.CURRENT_REVISION, ListChangesOption.CURRENT_COMMIT),
new TabChangeListCallback(Tab.CHERRY_PICKS, info.project(), revision));
if (info.topic() != null && !"".equals(info.topic())) {
if (Gerrit.info().change().isSubmitWholeTopicEnabled()) {
// TODO(sbeller): show only on latest revision
ChangeApi.change(info.legacyId().get()).view("submitted_together")
.get(new TabChangeListCallback(Tab.SUBMITTED_TOGETHER,
info.project(), revision));
} else if (info.topic() != null && !"".equals(info.topic())) {
StringBuilder topicQuery = new StringBuilder();
topicQuery.append("status:open");
topicQuery.append(" ").append(op("topic", info.topic()));