Direct default links to queries

When we started using change queries to implement the default links
I forgot to actually update the menus and keyboard bindings.  They
kept using the old anchors and were relying on Dispatcher to rewrite
them to the new change query format.

Move them all over to use the change query anchor instead.

Change-Id: Ibc6e81560d0fc0b6db124e888c81619be49df936
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2010-08-06 11:49:41 -07:00
parent 850d878946
commit ae59d1bf23
6 changed files with 17 additions and 27 deletions

View File

@@ -38,14 +38,6 @@ public class PageLinks {
public static final String TOP = "n,z";
public static final String MINE = "mine";
public static final String MINE_STARRED = "mine,starred";
public static final String MINE_DRAFTS = "mine,drafts";
public static final String MINE_WATCHED = "mine,watched," + TOP;
public static final String ALL_ABANDONED = "all,abandoned," + TOP;
public static final String ALL_MERGED = "all,merged," + TOP;
public static final String ALL_OPEN = "all,open," + TOP;
public static final String ADMIN_GROUPS = "admin,groups";
public static final String ADMIN_PROJECTS = "admin,projects";

View File

@@ -17,8 +17,6 @@ package com.google.gerrit.client;
import static com.google.gerrit.common.PageLinks.ADMIN_GROUPS;
import static com.google.gerrit.common.PageLinks.ADMIN_PROJECTS;
import static com.google.gerrit.common.PageLinks.MINE;
import static com.google.gerrit.common.PageLinks.MINE_DRAFTS;
import static com.google.gerrit.common.PageLinks.MINE_STARRED;
import static com.google.gerrit.common.PageLinks.REGISTER;
import static com.google.gerrit.common.PageLinks.SETTINGS;
import static com.google.gerrit.common.PageLinks.SETTINGS_AGREEMENTS;
@@ -157,10 +155,10 @@ public class Dispatcher {
return r;
}
} else if (MINE_STARRED.equals(token)) {
} else if ("mine,starred".equals(token)) {
return QueryScreen.forQuery("is:starred");
} else if (MINE_DRAFTS.equals(token)) {
} else if ("mine,drafts".equals(token)) {
return QueryScreen.forQuery("has:draft");
} else {

View File

@@ -400,7 +400,7 @@ public class Gerrit implements EntryPoint {
if (isSignedIn()) {
display(PageLinks.MINE);
} else {
display(PageLinks.ALL_OPEN);
display(PageLinks.toChangeQuery("status:open"));
}
} else {
display(History.getToken());
@@ -416,17 +416,17 @@ public class Gerrit implements EntryPoint {
LinkMenuBar m;
m = new LinkMenuBar();
addLink(m, C.menuAllOpen(), PageLinks.ALL_OPEN);
addLink(m, C.menuAllMerged(), PageLinks.ALL_MERGED);
addLink(m, C.menuAllAbandoned(), PageLinks.ALL_ABANDONED);
addLink(m, C.menuAllOpen(), PageLinks.toChangeQuery("status:open"));
addLink(m, C.menuAllMerged(), PageLinks.toChangeQuery("status:merged"));
addLink(m, C.menuAllAbandoned(), PageLinks.toChangeQuery("status:abandoned"));
menuLeft.add(m, C.menuAll());
if (signedIn) {
m = new LinkMenuBar();
addLink(m, C.menuMyChanges(), PageLinks.MINE);
addLink(m, C.menuMyDrafts(), PageLinks.MINE_DRAFTS);
addLink(m, C.menuMyWatchedChanges(), PageLinks.MINE_WATCHED);
addLink(m, C.menuMyStarredChanges(), PageLinks.MINE_STARRED);
addLink(m, C.menuMyDrafts(), PageLinks.toChangeQuery("has:draft"));
addLink(m, C.menuMyWatchedChanges(), PageLinks.toChangeQuery("is:watched status:open"));
addLink(m, C.menuMyStarredChanges(), PageLinks.toChangeQuery("is:starred"));
menuLeft.add(m, C.menuMine());
menuLeft.selectTab(1);
} else {

View File

@@ -29,19 +29,19 @@ class JumpKeys {
jumps.add(new KeyCommand(0, 'o', Gerrit.C.jumpAllOpen()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.ALL_OPEN);
Gerrit.display(PageLinks.toChangeQuery("status:open"));
}
});
jumps.add(new KeyCommand(0, 'm', Gerrit.C.jumpAllMerged()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.ALL_MERGED);
Gerrit.display(PageLinks.toChangeQuery("status:merged"));
}
});
jumps.add(new KeyCommand(0, 'a', Gerrit.C.jumpAllAbandoned()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.ALL_ABANDONED);
Gerrit.display(PageLinks.toChangeQuery("status:abandoned"));
}
});
@@ -55,19 +55,19 @@ class JumpKeys {
jumps.add(new KeyCommand(0, 'd', Gerrit.C.jumpMineDrafts()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.MINE_DRAFTS);
Gerrit.display(PageLinks.toChangeQuery("has:draft"));
}
});
jumps.add(new KeyCommand(0, 'w', Gerrit.C.jumpMineWatched()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.MINE_WATCHED);
Gerrit.display(PageLinks.toChangeQuery("is:watched status:open"));
}
});
jumps.add(new KeyCommand(0, 's', Gerrit.C.jumpMineStarred()) {
@Override
public void onKeyPress(final KeyPressEvent event) {
Gerrit.display(PageLinks.MINE_STARRED);
Gerrit.display(PageLinks.toChangeQuery("is:starred"));
}
});
}

View File

@@ -356,7 +356,7 @@ public class ChangeScreen extends Screen {
if (Gerrit.isSignedIn()) {
Gerrit.display(PageLinks.MINE);
} else {
Gerrit.display(PageLinks.ALL_OPEN);
Gerrit.display(PageLinks.toChangeQuery("status:open"));
}
}
}

View File

@@ -119,7 +119,7 @@ public abstract class Screen extends View {
/** Invoked if this screen is the current screen and the user signs out. */
public void onSignOut() {
if (isRequiresSignIn()) {
History.newItem(PageLinks.ALL_OPEN);
History.newItem(PageLinks.toChangeQuery("status:open"));
}
}