Link to owner query from user name

Instead of linking to change owners' dashboards, link to a
search for other changes owned by that user.

Change-Id: If823dfd4574812be7af733d7942f58f9cf9e1dfe
This commit is contained in:
Nasser Grainawi
2012-05-10 15:27:34 -07:00
parent b7a0622b72
commit 302f4d7979
6 changed files with 26 additions and 27 deletions

View File

@@ -17,8 +17,8 @@ package com.google.gerrit.client.admin;
import com.google.gerrit.client.Dispatcher; import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.ui.AccountDashboardLink;
import com.google.gerrit.client.ui.AccountGroupSuggestOracle; import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.AddMemberBox; import com.google.gerrit.client.ui.AddMemberBox;
import com.google.gerrit.client.ui.FancyFlexTable; import com.google.gerrit.client.ui.FancyFlexTable;
import com.google.gerrit.client.ui.Hyperlink; import com.google.gerrit.client.ui.Hyperlink;
@@ -286,7 +286,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
CheckBox checkBox = new CheckBox(); CheckBox checkBox = new CheckBox();
table.setWidget(row, 1, checkBox); table.setWidget(row, 1, checkBox);
checkBox.setEnabled(enabled); checkBox.setEnabled(enabled);
table.setWidget(row, 2, AccountDashboardLink.link(accounts, accountId)); table.setWidget(row, 2, AccountLink.link(accounts, accountId));
table.setText(row, 3, accounts.get(accountId).getPreferredEmail()); table.setText(row, 3, accounts.get(accountId).getPreferredEmail());
final FlexCellFormatter fmt = table.getFlexCellFormatter(); final FlexCellFormatter fmt = table.getFlexCellFormatter();

View File

@@ -21,7 +21,7 @@ import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.patches.PatchUtil; import com.google.gerrit.client.patches.PatchUtil;
import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.ui.AccountDashboardLink; import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.AddMemberBox; import com.google.gerrit.client.ui.AddMemberBox;
import com.google.gerrit.client.ui.ReviewerSuggestOracle; import com.google.gerrit.client.ui.ReviewerSuggestOracle;
import com.google.gerrit.common.data.AccountInfoCache; import com.google.gerrit.common.data.AccountInfoCache;
@@ -129,8 +129,8 @@ public class ApprovalTable extends Composite {
accountCache = aic; accountCache = aic;
} }
private AccountDashboardLink link(final Account.Id id) { private AccountLink link(final Account.Id id) {
return AccountDashboardLink.link(accountCache, id); return AccountLink.link(accountCache, id);
} }
void display(ChangeDetail detail) { void display(ChangeDetail detail) {

View File

@@ -17,7 +17,7 @@ package com.google.gerrit.client.changes;
import static com.google.gerrit.client.FormatUtil.mediumFormat; import static com.google.gerrit.client.FormatUtil.mediumFormat;
import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.ui.AccountDashboardLink; import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.BranchLink; import com.google.gerrit.client.ui.BranchLink;
import com.google.gerrit.client.ui.ChangeLink; import com.google.gerrit.client.ui.ChangeLink;
import com.google.gerrit.client.ui.ProjectLink; import com.google.gerrit.client.ui.ProjectLink;
@@ -92,7 +92,7 @@ public class ChangeInfoBlock extends Composite {
changeIdLabel.setPreviewText(chg.getKey().get()); changeIdLabel.setPreviewText(chg.getKey().get());
table.setWidget(R_CHANGE_ID, 1, changeIdLabel); table.setWidget(R_CHANGE_ID, 1, changeIdLabel);
table.setWidget(R_OWNER, 1, AccountDashboardLink.link(acc, chg.getOwner())); table.setWidget(R_OWNER, 1, AccountLink.link(acc, chg.getOwner()));
table.setWidget(R_PROJECT, 1, new ProjectLink(chg.getProject(), chg.getStatus())); table.setWidget(R_PROJECT, 1, new ProjectLink(chg.getProject(), chg.getStatus()));
table.setWidget(R_BRANCH, 1, new BranchLink(dst.getShortName(), chg table.setWidget(R_BRANCH, 1, new BranchLink(dst.getShortName(), chg
.getProject(), chg.getStatus(), dst.get(), null)); .getProject(), chg.getStatus(), dst.get(), null));

View File

@@ -20,7 +20,7 @@ import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.patches.PatchUtil; import com.google.gerrit.client.patches.PatchUtil;
import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.ui.AccountDashboardLink; import com.google.gerrit.client.ui.AccountLink;
import com.google.gerrit.client.ui.BranchLink; import com.google.gerrit.client.ui.BranchLink;
import com.google.gerrit.client.ui.ChangeLink; import com.google.gerrit.client.ui.ChangeLink;
import com.google.gerrit.client.ui.NavigationTable; import com.google.gerrit.client.ui.NavigationTable;
@@ -226,8 +226,8 @@ public class ChangeTable extends NavigationTable<ChangeInfo> {
setRowItem(row, c); setRowItem(row, c);
} }
private AccountDashboardLink link(final Account.Id id) { private AccountLink link(final Account.Id id) {
return AccountDashboardLink.link(accountCache, id); return AccountLink.link(accountCache, id);
} }
public void addSection(final Section s) { public void addSection(final Section s) {

View File

@@ -20,9 +20,9 @@ import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.GitwebLink; import com.google.gerrit.client.GitwebLink;
import com.google.gerrit.client.patches.PatchUtil; import com.google.gerrit.client.patches.PatchUtil;
import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gerrit.client.ui.AccountDashboardLink;
import com.google.gerrit.client.ui.CommentedActionDialog; import com.google.gerrit.client.ui.CommentedActionDialog;
import com.google.gerrit.client.ui.ComplexDisclosurePanel; import com.google.gerrit.client.ui.ComplexDisclosurePanel;
import com.google.gerrit.client.ui.InlineHyperlink;
import com.google.gerrit.client.ui.ListenableAccountDiffPreference; import com.google.gerrit.client.ui.ListenableAccountDiffPreference;
import com.google.gerrit.common.PageLinks; import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.data.ChangeDetail; import com.google.gerrit.common.data.ChangeDetail;
@@ -383,7 +383,8 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
if (who.getName() != null) { if (who.getName() != null) {
final Account.Id aId = who.getAccount(); final Account.Id aId = who.getAccount();
if (aId != null) { if (aId != null) {
fp.add(new AccountDashboardLink(who.getName(), aId)); fp.add(new InlineHyperlink(who.getName(), PageLinks.toAccountQuery(who
.getName())));
} else { } else {
final InlineLabel lbl = new InlineLabel(who.getName()); final InlineLabel lbl = new InlineLabel(who.getName());
lbl.setStyleName(Gerrit.RESOURCES.css().accountName()); lbl.setStyleName(Gerrit.RESOURCES.css().accountName());

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2008 The Android Open Source Project // Copyright (C) 2012 The Android Open Source Project
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@@ -16,41 +16,39 @@ package com.google.gerrit.client.ui;
import com.google.gerrit.client.FormatUtil; import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.changes.AccountDashboardScreen; import com.google.gerrit.client.changes.QueryScreen;
import com.google.gerrit.common.PageLinks; import com.google.gerrit.common.PageLinks;
import com.google.gerrit.common.data.AccountInfo; import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.common.data.AccountInfoCache; import com.google.gerrit.common.data.AccountInfoCache;
import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account;
/** Link to any user's account dashboard. */ /** Link to any user's account dashboard. */
public class AccountDashboardLink extends InlineHyperlink { public class AccountLink extends InlineHyperlink {
/** Create a link after locating account details from an active cache. */ /** Create a link after locating account details from an active cache. */
public static AccountDashboardLink link(final AccountInfoCache cache, public static AccountLink link(final AccountInfoCache cache,
final Account.Id id) { final Account.Id id) {
final AccountInfo ai = cache.get(id); final AccountInfo ai = cache.get(id);
return ai != null ? new AccountDashboardLink(ai) : null; return ai != null ? new AccountLink(ai) : null;
} }
private Account.Id accountId; private final String query;
public AccountDashboardLink(final AccountInfo ai) { public AccountLink(final AccountInfo ai) {
this(FormatUtil.name(ai), ai); this(FormatUtil.name(ai), ai);
} }
public AccountDashboardLink(final String text, final AccountInfo ai) { public AccountLink(final String text, final AccountInfo ai) {
this(text, ai.getId()); super(text, PageLinks.toAccountQuery(FormatUtil.name(ai)));
setTitle(FormatUtil.nameEmail(ai)); setTitle(FormatUtil.nameEmail(ai));
this.query = "owner:\"" + FormatUtil.name(ai) + "\"";
} }
public AccountDashboardLink(final String text, final Account.Id ai) { private Screen createScreen() {
super(text, PageLinks.toAccountDashboard(ai)); return QueryScreen.forQuery(query);
addStyleName(Gerrit.RESOURCES.css().accountName());
accountId = ai;
} }
@Override @Override
public void go() { public void go() {
Gerrit.display(getTargetHistoryToken(), // Gerrit.display(getTargetHistoryToken(), createScreen());
new AccountDashboardScreen(accountId));
} }
} }