Show changes across all branches and projects in topics tab

If `submitWholeTopic` is enabled this tab will show all affected
changes which would be submitted. If it is disabled however this also makes
sense as the user probably wants to group things together by the topic.

Change-Id: I0553d4384f0fdef7c911d8358aefa9e2911662af
This commit is contained in:
Stefan Beller 2015-01-27 16:14:37 -08:00
parent 820dc39971
commit ad6525f4c6
2 changed files with 15 additions and 2 deletions

View File

@ -171,6 +171,8 @@ public class RelatedChanges extends TabPanel {
} }
getTab(Tab.RELATED_CHANGES).setShowIndirectAncestors(true); getTab(Tab.RELATED_CHANGES).setShowIndirectAncestors(true);
getTab(Tab.CHERRY_PICKS).setShowBranches(true); getTab(Tab.CHERRY_PICKS).setShowBranches(true);
getTab(Tab.SAME_TOPIC).setShowBranches(true);
getTab(Tab.SAME_TOPIC).setShowProjects(true);
} }
void set(final ChangeInfo info, final String revision) { void set(final ChangeInfo info, final String revision) {
@ -198,8 +200,6 @@ public class RelatedChanges extends TabPanel {
if (info.topic() != null && !"".equals(info.topic())) { if (info.topic() != null && !"".equals(info.topic())) {
StringBuilder topicQuery = new StringBuilder(); StringBuilder topicQuery = new StringBuilder();
topicQuery.append("status:open"); topicQuery.append("status:open");
topicQuery.append(" ").append(op("project", info.project()));
topicQuery.append(" ").append(op("branch", info.branch()));
topicQuery.append(" ").append(op("topic", info.topic())); topicQuery.append(" ").append(op("topic", info.topic()));
topicQuery.append(" ").append(op("-change", info.legacy_id().get())); topicQuery.append(" ").append(op("-change", info.legacy_id().get()));
ChangeList.query(topicQuery.toString(), ChangeList.query(topicQuery.toString(),
@ -329,6 +329,7 @@ public class RelatedChanges extends TabPanel {
c.set_change_number(i.legacy_id().get()); c.set_change_number(i.legacy_id().get());
c.set_revision_number(currentRevision._number()); c.set_revision_number(currentRevision._number());
c.set_branch(i.branch()); c.set_branch(i.branch());
c.set_project(i.project());
arr.push(c); arr.push(c);
} }
} }
@ -357,6 +358,7 @@ public class RelatedChanges extends TabPanel {
public final native CommitInfo commit() /*-{ return this.commit }-*/; public final native CommitInfo commit() /*-{ return this.commit }-*/;
final native String branch() /*-{ return this.branch }-*/; final native String branch() /*-{ return this.branch }-*/;
final native String project() /*-{ return this.project }-*/;
final native void set_id(String i) final native void set_id(String i)
/*-{ if(i)this.change_id=i; }-*/; /*-{ if(i)this.change_id=i; }-*/;
@ -367,6 +369,9 @@ public class RelatedChanges extends TabPanel {
final native void set_branch(String b) final native void set_branch(String b)
/*-{ if(b)this.branch=b; }-*/; /*-{ if(b)this.branch=b; }-*/;
final native void set_project(String b)
/*-{ if(b)this.project=b; }-*/;
public final Change.Id legacy_id() { public final Change.Id legacy_id() {
return has_change_number() ? new Change.Id(_change_number()) : null; return has_change_number() ? new Change.Id(_change_number()) : null;
} }

View File

@ -86,6 +86,7 @@ class RelatedChangesTab implements IsWidget {
private final RelatedChanges.Tab subject; private final RelatedChanges.Tab subject;
private boolean showBranches; private boolean showBranches;
private boolean showProjects;
private boolean showIndirectAncestors; private boolean showIndirectAncestors;
private boolean registerKeys; private boolean registerKeys;
private int maxHeight; private int maxHeight;
@ -107,6 +108,10 @@ class RelatedChangesTab implements IsWidget {
this.showBranches = showBranches; this.showBranches = showBranches;
} }
void setShowProjects(boolean showProjects) {
this.showProjects = showProjects;
}
void setShowIndirectAncestors(boolean showIndirectAncestors) { void setShowIndirectAncestors(boolean showIndirectAncestors) {
this.showIndirectAncestors = showIndirectAncestors; this.showIndirectAncestors = showIndirectAncestors;
} }
@ -277,6 +282,9 @@ class RelatedChangesTab implements IsWidget {
if (url.startsWith("#")) { if (url.startsWith("#")) {
sb.setAttribute("onclick", OPEN); sb.setAttribute("onclick", OPEN);
} }
if (showProjects) {
sb.append(info.project()).append(": ");
}
if (showBranches) { if (showBranches) {
sb.append(info.branch()).append(": "); sb.append(info.branch()).append(": ");
} }