Fix columns in project tables

Sometimes the status column existed but was not or wrongly populated.

On project creation when browsing the project to select a parent project
the project name was shown in the status column and the project
description was shown in the name column

Bug: Issue 6473
Change-Id: I01216d56fda1707473a77795eb4122643d58cbd0
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin 2017-06-12 09:01:19 +02:00
parent 41c2e73da2
commit ab94a754ed
4 changed files with 31 additions and 25 deletions

View File

@ -212,6 +212,7 @@ public class CreateProjectScreen extends Screen {
@Override
protected void populate(final int row, final ProjectInfo k) {
populateState(row, k);
final Anchor projectLink = new Anchor(k.name());
projectLink.addClickHandler(
new ClickHandler() {
@ -222,8 +223,8 @@ public class CreateProjectScreen extends Screen {
}
});
table.setWidget(row, 2, projectLink);
table.setText(row, 3, k.description());
table.setWidget(row, ProjectsTable.C_NAME, projectLink);
table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
setRowItem(row, k);
}

View File

@ -35,7 +35,6 @@ import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwtexpui.globalkey.client.NpTextBox;
import java.util.List;
@ -109,25 +108,8 @@ public class ProjectListScreen extends PaginatedProjectScreen {
}
@Override
protected void populate(final int row, final ProjectInfo k) {
Image state = new Image();
switch (k.state()) {
case HIDDEN:
state.setResource(Gerrit.RESOURCES.redNot());
state.setTitle(Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case READ_ONLY:
state.setResource(Gerrit.RESOURCES.readOnly());
state.setTitle(Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case ACTIVE:
default:
// Intentionally left blank, do not show an icon when active.
break;
}
protected void populate(int row, ProjectInfo k) {
populateState(row, k);
FlowPanel fp = new FlowPanel();
fp.add(new ProjectSearchLink(k.name_key()));
fp.add(new HighlightingInlineHyperlink(k.name(), link(k), match));

View File

@ -28,8 +28,10 @@ public class HighlightingProjectsTable extends ProjectsTable {
@Override
protected void populate(final int row, final ProjectInfo k) {
table.setWidget(row, 1, new InlineHTML(Util.highlight(k.name(), toHighlight)));
table.setText(row, 2, k.description());
populateState(row, k);
table.setWidget(
row, ProjectsTable.C_NAME, new InlineHTML(Util.highlight(k.name(), toHighlight)));
table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
setRowItem(row, k);
}

View File

@ -19,6 +19,7 @@ import com.google.gerrit.client.projects.ProjectInfo;
import com.google.gerrit.client.projects.ProjectMap;
import com.google.gerrit.client.rpc.Natives;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.google.gwt.user.client.ui.Image;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@ -98,10 +99,30 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
}
protected void populate(final int row, final ProjectInfo k) {
table.setText(row, C_STATE, k.state().toString());
populateState(row, k);
table.setText(row, C_NAME, k.name());
table.setText(row, C_DESCRIPTION, k.description());
setRowItem(row, k);
}
protected void populateState(int row, ProjectInfo k) {
Image state = new Image();
switch (k.state()) {
case HIDDEN:
state.setResource(Gerrit.RESOURCES.redNot());
state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case READ_ONLY:
state.setResource(Gerrit.RESOURCES.readOnly());
state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
table.setWidget(row, ProjectsTable.C_STATE, state);
break;
case ACTIVE:
default:
// Intentionally left blank, do not show an icon when active.
break;
}
}
}