Merge "Adding display of project state to Projects -> List page"
This commit is contained in:
@@ -57,4 +57,7 @@ public interface GerritResources extends ClientBundle {
|
||||
|
||||
@Source("draftComments.png")
|
||||
public ImageResource draftComments();
|
||||
|
||||
@Source("readOnly.png")
|
||||
public ImageResource readOnly();
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@ import com.google.gwt.user.client.History;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
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;
|
||||
|
||||
@@ -131,6 +132,23 @@ public class ProjectListScreen extends Screen implements FilteredUserInterface {
|
||||
|
||||
@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;
|
||||
default:
|
||||
// Intentionally left blank, do not show an icon when active.
|
||||
break;
|
||||
}
|
||||
|
||||
FlowPanel fp = new FlowPanel();
|
||||
fp.add(new ProjectSearchLink(k.name_key()));
|
||||
fp.add(new HighlightingInlineHyperlink(k.name(), link(k), subname));
|
||||
|
@@ -28,6 +28,12 @@ public class ProjectInfo
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
public final native String description() /*-{ return this.description; }-*/;
|
||||
|
||||
public final Project.State state() {
|
||||
return Project.State.valueOf(getStringState());
|
||||
}
|
||||
|
||||
private final native String getStringState() /*-{ return this.state; }-*/;
|
||||
|
||||
@Override
|
||||
public final String getDisplayString() {
|
||||
if (description() != null) {
|
||||
|
BIN
gerrit-gwtui/src/main/java/com/google/gerrit/client/readOnly.png
Normal file
BIN
gerrit-gwtui/src/main/java/com/google/gerrit/client/readOnly.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 487 B |
@@ -25,9 +25,10 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
public static final int C_NAME = 1;
|
||||
public static final int C_DESCRIPTION = 2;
|
||||
public static final int C_REPO_BROWSER = 3;
|
||||
public static final int C_STATE = 1;
|
||||
public static final int C_NAME = 2;
|
||||
public static final int C_DESCRIPTION = 3;
|
||||
public static final int C_REPO_BROWSER = 4;
|
||||
|
||||
public ProjectsTable() {
|
||||
super(Util.C.projectItemHelp());
|
||||
@@ -35,10 +36,14 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
}
|
||||
|
||||
protected void initColumnHeaders() {
|
||||
table.setText(0, C_STATE, Util.C.projectStateAbbrev());
|
||||
table.getCellFormatter().getElement(0, C_STATE)
|
||||
.setTitle(Util.C.projectStateHelp());
|
||||
table.setText(0, C_NAME, Util.C.projectName());
|
||||
table.setText(0, C_DESCRIPTION, Util.C.projectDescription());
|
||||
|
||||
final FlexCellFormatter fmt = table.getFlexCellFormatter();
|
||||
fmt.addStyleName(0, C_STATE, Gerrit.RESOURCES.css().iconHeader());
|
||||
fmt.addStyleName(0, C_NAME, Gerrit.RESOURCES.css().dataHeader());
|
||||
fmt.addStyleName(0, C_DESCRIPTION, Gerrit.RESOURCES.css().dataHeader());
|
||||
}
|
||||
@@ -78,6 +83,7 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
applyDataRowStyle(row);
|
||||
|
||||
final FlexCellFormatter fmt = table.getFlexCellFormatter();
|
||||
fmt.addStyleName(row, C_STATE, Gerrit.RESOURCES.css().iconCell());
|
||||
fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().dataCell());
|
||||
fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().projectNameColumn());
|
||||
fmt.addStyleName(row, C_DESCRIPTION, Gerrit.RESOURCES.css().dataCell());
|
||||
@@ -86,6 +92,7 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
|
||||
}
|
||||
|
||||
protected void populate(final int row, final ProjectInfo k) {
|
||||
table.setText(row, C_STATE, k.state().toString());
|
||||
table.setText(row, C_NAME, k.name());
|
||||
table.setText(row, C_DESCRIPTION, k.description());
|
||||
|
||||
|
@@ -23,4 +23,6 @@ public interface UIConstants extends Constants {
|
||||
String projectName();
|
||||
String projectDescription();
|
||||
String projectItemHelp();
|
||||
String projectStateAbbrev();
|
||||
String projectStateHelp();
|
||||
}
|
||||
|
@@ -4,3 +4,5 @@ commentedActionButtonCancel = Cancel
|
||||
projectName = Project Name
|
||||
projectDescription = Project Description
|
||||
projectItemHelp = project
|
||||
projectStateAbbrev = S
|
||||
projectStateHelp = State
|
@@ -271,6 +271,7 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
||||
info.name = parentState.getProject().getName();
|
||||
info.description = Strings.emptyToNull(
|
||||
parentState.getProject().getDescription());
|
||||
info.state = parentState.getProject().getState();
|
||||
} else {
|
||||
rejected.add(parentState.getProject().getName());
|
||||
continue;
|
||||
@@ -313,6 +314,8 @@ public class ListProjects implements RestReadView<TopLevelResource> {
|
||||
info.description = Strings.emptyToNull(e.getProject().getDescription());
|
||||
}
|
||||
|
||||
info.state = e.getProject().getState();
|
||||
|
||||
try {
|
||||
if (!showBranch.isEmpty()) {
|
||||
Repository git = repoManager.openRepository(projectName);
|
||||
|
@@ -41,6 +41,7 @@ public class ProjectJson {
|
||||
Project.NameKey parentName = p.getParent(allProjects);
|
||||
info.parent = parentName != null ? parentName.get() : null;
|
||||
info.description = Strings.emptyToNull(p.getDescription());
|
||||
info.state = p.getState();
|
||||
info.finish();
|
||||
return info;
|
||||
}
|
||||
@@ -51,6 +52,7 @@ public class ProjectJson {
|
||||
public String name;
|
||||
public String parent;
|
||||
public String description;
|
||||
public Project.State state;
|
||||
public Map<String, String> branches;
|
||||
|
||||
void finish() {
|
||||
|
@@ -41,6 +41,10 @@ public class ProjectResource implements RestResource {
|
||||
return control.getProject().getNameKey();
|
||||
}
|
||||
|
||||
public Project.State getState() {
|
||||
return control.getProject().getState();
|
||||
}
|
||||
|
||||
public ProjectControl getControl() {
|
||||
return control;
|
||||
}
|
||||
|
Reference in New Issue
Block a user