Opt-in to ChangeScreen2 as a per-tab preference
If the user visits ChangeScreen2 using #c2/... within this application session always redirect all #c/... links to ChangeScreen2. This makes for a smoother flow from search results and the dashboard into the new UI. Users can get rid of the new UI by simply opening a new tab or a reload in the current one without #c2/ in the URL. Change-Id: Ie4890e2d564fa2b896e9dbf52e38f43804d9e470
This commit is contained in:
parent
097b957915
commit
c5e1654bb6
@ -92,6 +92,8 @@ import com.google.gwt.user.client.Window;
|
||||
import com.google.gwtorm.client.KeyUtil;
|
||||
|
||||
public class Dispatcher {
|
||||
private static boolean useChangeScreen2;
|
||||
|
||||
public static String toPatchSideBySide(final Patch.Key id) {
|
||||
return toPatch("", null, id);
|
||||
}
|
||||
@ -467,8 +469,8 @@ public class Dispatcher {
|
||||
}
|
||||
|
||||
if (rest.isEmpty()) {
|
||||
Gerrit.display(token, panel== null //
|
||||
? new ChangeScreen(id) //
|
||||
Gerrit.display(token, panel== null
|
||||
? (useChangeScreen2 ? new ChangeScreen2(id, null) : new ChangeScreen(id))
|
||||
: new NotFoundScreen());
|
||||
return;
|
||||
}
|
||||
@ -499,7 +501,9 @@ public class Dispatcher {
|
||||
patch(token, base, p, 0, null, null, panel);
|
||||
} else {
|
||||
if (panel == null) {
|
||||
Gerrit.display(token, new ChangeScreen(ps));
|
||||
Gerrit.display(token, useChangeScreen2
|
||||
? new ChangeScreen2(id, String.valueOf(ps.get()))
|
||||
: new ChangeScreen(id));
|
||||
} else if ("publish".equals(panel)) {
|
||||
publish(ps);
|
||||
} else {
|
||||
@ -519,6 +523,7 @@ public class Dispatcher {
|
||||
id = Change.Id.parse(rest);
|
||||
rest = "";
|
||||
}
|
||||
useChangeScreen2 = true;
|
||||
Gerrit.display(token, new ChangeScreen2(id, rest));
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ public class ChangeTable2 extends NavigationTable<ChangeInfo> {
|
||||
protected void onOpenRow(final int row) {
|
||||
final ChangeInfo c = getRowItem(row);
|
||||
final Change.Id id = c.legacy_id();
|
||||
Gerrit.display(PageLinks.toChange(id), new ChangeScreen(id));
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
}
|
||||
|
||||
private void insertNoneRow(final int row) {
|
||||
|
@ -55,7 +55,7 @@ public class QueryScreen extends PagedSingleListScreen implements
|
||||
if (result.length() == 1 && isSingleQuery(query)) {
|
||||
ChangeInfo c = result.get(0);
|
||||
Change.Id id = c.legacy_id();
|
||||
Gerrit.display(PageLinks.toChange(id), new ChangeScreen(id));
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
} else {
|
||||
display(result);
|
||||
QueryScreen.this.display();
|
||||
|
@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.client.ui;
|
||||
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.changes.ChangeScreen;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.common.data.ChangeInfo;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@ -57,14 +56,6 @@ public class ChangeLink extends InlineHyperlink {
|
||||
|
||||
@Override
|
||||
public void go() {
|
||||
Gerrit.display(getTargetHistoryToken(), createScreen());
|
||||
}
|
||||
|
||||
private Screen createScreen() {
|
||||
if (psid != null) {
|
||||
return new ChangeScreen(psid);
|
||||
} else {
|
||||
return new ChangeScreen(cid);
|
||||
}
|
||||
Gerrit.display(getTargetHistoryToken());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user