Dashboard: Link dashboard section titles to the underlying search
Change-Id: I71e80335e9dd2e8a155f800cbd9a79c5cdbd5f1d
This commit is contained in:
parent
d1d3fcfdd2
commit
1a0c7a7d31
@ -18,7 +18,9 @@ import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.NotFoundScreen;
|
||||
import com.google.gerrit.client.rpc.Natives;
|
||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||
import com.google.gerrit.client.ui.InlineHyperlink;
|
||||
import com.google.gerrit.client.ui.Screen;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.extensions.client.ListChangesOption;
|
||||
import com.google.gerrit.reviewdb.client.Account;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
@ -61,10 +63,14 @@ public class AccountDashboardScreen extends Screen implements ChangeListScreen {
|
||||
incoming = new ChangeTable.Section();
|
||||
closed = new ChangeTable.Section();
|
||||
|
||||
outgoing.setTitleText(Util.C.outgoingReviews());
|
||||
incoming.setTitleText(Util.C.incomingReviews());
|
||||
String who = mine ? "self" : ownerId.toString();
|
||||
outgoing.setTitleWidget(new InlineHyperlink(Util.C.outgoingReviews(),
|
||||
PageLinks.toChangeQuery(queryOutGoing(who))));
|
||||
incoming.setTitleWidget(new InlineHyperlink(Util.C.incomingReviews(),
|
||||
PageLinks.toChangeQuery(queryInComing(who))));
|
||||
incoming.setHighlightUnreviewed(mine);
|
||||
closed.setTitleText(Util.C.recentlyClosed());
|
||||
closed.setTitleWidget(new InlineHyperlink(Util.C.recentlyClosed(),
|
||||
PageLinks.toChangeQuery(queryClosed(who))));
|
||||
|
||||
table.addSection(outgoing);
|
||||
table.addSection(incoming);
|
||||
@ -73,6 +79,18 @@ public class AccountDashboardScreen extends Screen implements ChangeListScreen {
|
||||
table.setSavePointerId("owner:" + ownerId);
|
||||
}
|
||||
|
||||
private static String queryOutGoing(String who) {
|
||||
return "is:open owner:" + who;
|
||||
}
|
||||
|
||||
private static String queryInComing(String who) {
|
||||
return "is:open reviewer:" + who + " -owner:" + who;
|
||||
}
|
||||
|
||||
private static String queryClosed(String who) {
|
||||
return "is:closed (owner:" + who + " OR reviewer:" + who + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
@ -88,9 +106,9 @@ public class AccountDashboardScreen extends Screen implements ChangeListScreen {
|
||||
mine
|
||||
? EnumSet.of(ListChangesOption.REVIEWED)
|
||||
: EnumSet.noneOf(ListChangesOption.class),
|
||||
"is:open owner:" + who,
|
||||
"is:open reviewer:" + who + " -owner:" + who,
|
||||
"is:closed (owner:" + who + " OR reviewer:" + who + ") -age:4w limit:10");
|
||||
queryOutGoing(who),
|
||||
queryInComing(who),
|
||||
queryClosed(who) + " -age:4w limit:10");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user