Fix the link another identity button
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -21,6 +21,7 @@ public interface GerritConstants extends Constants {
|
||||
String menuSignOut();
|
||||
String menuSettings();
|
||||
String signInDialogTitle();
|
||||
String linkIdentityDialogTitle();
|
||||
|
||||
String errorDialogTitle();
|
||||
String errorDialogClose();
|
||||
|
@@ -2,6 +2,7 @@ menuSignIn = Sign In
|
||||
menuSignOut = Sign Out
|
||||
menuSettings = Settings
|
||||
signInDialogTitle = Code Review - Sign In
|
||||
linkIdentityDialogTitle = Code Review - Link Identity
|
||||
|
||||
errorDialogTitle = Code Review - Unexpected Error
|
||||
errorDialogClose = Close
|
||||
|
@@ -54,7 +54,7 @@ public class SignInDialog extends AutoCenterDialogBox {
|
||||
|
||||
private static SignInDialog current;
|
||||
|
||||
private Mode mode = Mode.SIGN_IN;
|
||||
private final Mode mode;
|
||||
private final CallbackHandle<SignInResult> signInCallback;
|
||||
private final AsyncCallback<?> appCallback;
|
||||
private final Frame loginFrame;
|
||||
@@ -66,8 +66,20 @@ public class SignInDialog extends AutoCenterDialogBox {
|
||||
* This can be used to trigger sending an RPC or some other action.
|
||||
*/
|
||||
public SignInDialog(final AsyncCallback<?> callback) {
|
||||
this(Mode.SIGN_IN, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new dialog to handle user sign in.
|
||||
*
|
||||
* @param signInMode type of mode the login will perform.
|
||||
* @param callback optional; onSuccess will be called if sign is completed.
|
||||
* This can be used to trigger sending an RPC or some other action.
|
||||
*/
|
||||
public SignInDialog(final Mode signInMode, final AsyncCallback<?> callback) {
|
||||
super(/* auto hide */true, /* modal */true);
|
||||
|
||||
mode = signInMode;
|
||||
signInCallback =
|
||||
com.google.gerrit.client.account.Util.LOGIN_SVC
|
||||
.signIn(new GerritCallback<SignInResult>() {
|
||||
@@ -80,11 +92,14 @@ public class SignInDialog extends AutoCenterDialogBox {
|
||||
loginFrame = new Frame();
|
||||
onResize(Window.getClientWidth(), Window.getClientHeight());
|
||||
add(loginFrame);
|
||||
setText(Gerrit.C.signInDialogTitle());
|
||||
}
|
||||
|
||||
public void setMode(final Mode m) {
|
||||
mode = m;
|
||||
switch (mode) {
|
||||
case LINK_IDENTIY:
|
||||
setText(Gerrit.C.linkIdentityDialogTitle());
|
||||
break;
|
||||
default:
|
||||
setText(Gerrit.C.signInDialogTitle());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -53,12 +53,13 @@ class ExternalIdPanel extends Composite {
|
||||
}
|
||||
|
||||
void doLinkIdentity() {
|
||||
final SignInDialog d = new SignInDialog(new GerritCallback<Object>() {
|
||||
public void onSuccess(final Object result) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
d.setMode(SignInDialog.Mode.LINK_IDENTIY);
|
||||
final SignInDialog d =
|
||||
new SignInDialog(SignInDialog.Mode.LINK_IDENTIY,
|
||||
new GerritCallback<Object>() {
|
||||
public void onSuccess(final Object result) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
d.center();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user