Partially revert GroupDetail to fix Admin > Groups issues

Loading Admin > Groups on a large server is horribly slow because
someone thought it was a good idea to reuse GroupDetail in
fccf928042. That caused the entire
group membership database to be downloaded to the browser when
showing just the list of groups, only to have the data discarded and
reloaded after selecting a specific group to view. If a server has
7k users and 17k groups, it could take ages to show the groups list.

Strip out GroupDetail and switch back to the more lightweight
AccountGroup type when showing the groups in a list format.

Since there are only 3 SYSTEM groups using well known names, and
everything else returned is of type INTERNAL because the LDAP type
no longer exists, drop the type column from the table, it isn't
really interesting anymore.

This change does drop the Owner group name column header. Displaying
it can really slow down on large servers when there are a lot of
groups. So skip displaying the owner name. Its more important to me
that the Admin > Groups table doesn't download the entire database
than having the owner group resolved in the list view. If someone
really cares enough, they can reattempt what fccf928042 was trying
to accomplish, without downloading the entire membership database.

Change-Id: I884a5129d238b7aaaf6db8a886e7c0a49f73cf74
This commit is contained in:
Shawn O. Pearce
2012-08-01 12:30:49 -07:00
parent 0dbb8188a2
commit 7e031f38f7
8 changed files with 34 additions and 55 deletions

View File

@@ -16,7 +16,7 @@ package com.google.gerrit.client.account;
import com.google.gerrit.client.admin.GroupTable;
import com.google.gerrit.client.rpc.ScreenLoadCallback;
import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.reviewdb.client.AccountGroup;
import java.util.List;
@@ -33,8 +33,9 @@ public class MyGroupsScreen extends SettingsScreen {
@Override
protected void onLoad() {
super.onLoad();
Util.ACCOUNT_SEC.myGroups(new ScreenLoadCallback<List<GroupDetail>>(this) {
public void preDisplay(final List<GroupDetail> result) {
Util.ACCOUNT_SEC.myGroups(new ScreenLoadCallback<List<AccountGroup>>(this) {
@Override
public void preDisplay(final List<AccountGroup> result) {
groups.display(result);
}
});

View File

@@ -18,7 +18,6 @@ import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.ui.Hyperlink;
import com.google.gerrit.client.ui.NavigationTable;
import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@@ -32,7 +31,7 @@ import java.util.List;
public class GroupTable extends NavigationTable<AccountGroup> {
private static final int NUM_COLS = 5;
private static final int NUM_COLS = 3;
private final boolean enableLink;
@@ -52,9 +51,7 @@ public class GroupTable extends NavigationTable<AccountGroup> {
table.setText(0, 1, Util.C.columnGroupName());
table.setText(0, 2, Util.C.columnGroupDescription());
table.setText(0, 3, Util.C.headingOwner());
table.setText(0, 4, Util.C.columnGroupType());
table.setText(0, 5, Util.C.columnGroupVisibleToAll());
table.setText(0, 3, Util.C.columnGroupVisibleToAll());
table.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -82,20 +79,19 @@ public class GroupTable extends NavigationTable<AccountGroup> {
History.newItem(Dispatcher.toGroup(getRowItem(row).getId()));
}
public void display(final List<GroupDetail> result) {
public void display(final List<AccountGroup> result) {
while (1 < table.getRowCount())
table.removeRow(table.getRowCount() - 1);
for(GroupDetail detail : result) {
for(AccountGroup group : result) {
final int row = table.getRowCount();
table.insertRow(row);
applyDataRowStyle(row);
populate(row, detail);
populate(row, group);
}
}
void populate(final int row, final GroupDetail detail) {
AccountGroup k = detail.group;
void populate(final int row, final AccountGroup k) {
if (enableLink) {
table.setWidget(row, 1, new Hyperlink(k.getName(),
Dispatcher.toGroup(k.getId())));
@@ -103,10 +99,8 @@ public class GroupTable extends NavigationTable<AccountGroup> {
table.setText(row, 1, k.getName());
}
table.setText(row, 2, k.getDescription());
table.setText(row, 3, detail.ownerGroup.getName());
table.setText(row, 4, k.getType().toString());
if (k.isVisibleToAll()) {
table.setWidget(row, 5, new Image(Gerrit.RESOURCES.greenCheck()));
table.setWidget(row, 3, new Image(Gerrit.RESOURCES.greenCheck()));
}
final FlexCellFormatter fmt = table.getFlexCellFormatter();