Adding display of project state to Projects -> List page
This is intended to make it more obvious if a project is hidden, read-only, or active. This shows an icon in the Projects list only if project is hidden or read-only, but not when the project is active. Change-Id: Ibb7f84abfc82483bdef9866265e823fed139d592
This commit is contained in:
		@@ -57,4 +57,7 @@ public interface GerritResources extends ClientBundle {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  @Source("draftComments.png")
 | 
					  @Source("draftComments.png")
 | 
				
			||||||
  public ImageResource draftComments();
 | 
					  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.Anchor;
 | 
				
			||||||
import com.google.gwt.user.client.ui.FlowPanel;
 | 
					import com.google.gwt.user.client.ui.FlowPanel;
 | 
				
			||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
 | 
					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.gwt.user.client.ui.Label;
 | 
				
			||||||
import com.google.gwtexpui.globalkey.client.NpTextBox;
 | 
					import com.google.gwtexpui.globalkey.client.NpTextBox;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -131,6 +132,23 @@ public class ProjectListScreen extends Screen implements FilteredUserInterface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      @Override
 | 
					      @Override
 | 
				
			||||||
      protected void populate(final int row, final ProjectInfo k) {
 | 
					      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();
 | 
					        FlowPanel fp = new FlowPanel();
 | 
				
			||||||
        fp.add(new ProjectSearchLink(k.name_key()));
 | 
					        fp.add(new ProjectSearchLink(k.name_key()));
 | 
				
			||||||
        fp.add(new HighlightingInlineHyperlink(k.name(), link(k), subname));
 | 
					        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 name() /*-{ return this.name; }-*/;
 | 
				
			||||||
  public final native String description() /*-{ return this.description; }-*/;
 | 
					  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
 | 
					  @Override
 | 
				
			||||||
  public final String getDisplayString() {
 | 
					  public final String getDisplayString() {
 | 
				
			||||||
    if (description() != null) {
 | 
					    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;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ProjectsTable extends NavigationTable<ProjectInfo> {
 | 
					public class ProjectsTable extends NavigationTable<ProjectInfo> {
 | 
				
			||||||
  public static final int C_NAME = 1;
 | 
					  public static final int C_STATE = 1;
 | 
				
			||||||
  public static final int C_DESCRIPTION = 2;
 | 
					  public static final int C_NAME = 2;
 | 
				
			||||||
  public static final int C_REPO_BROWSER = 3;
 | 
					  public static final int C_DESCRIPTION = 3;
 | 
				
			||||||
 | 
					  public static final int C_REPO_BROWSER = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public ProjectsTable() {
 | 
					  public ProjectsTable() {
 | 
				
			||||||
    super(Util.C.projectItemHelp());
 | 
					    super(Util.C.projectItemHelp());
 | 
				
			||||||
@@ -35,10 +36,14 @@ public class ProjectsTable extends NavigationTable<ProjectInfo> {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected void initColumnHeaders() {
 | 
					  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_NAME, Util.C.projectName());
 | 
				
			||||||
    table.setText(0, C_DESCRIPTION, Util.C.projectDescription());
 | 
					    table.setText(0, C_DESCRIPTION, Util.C.projectDescription());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final FlexCellFormatter fmt = table.getFlexCellFormatter();
 | 
					    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_NAME, Gerrit.RESOURCES.css().dataHeader());
 | 
				
			||||||
    fmt.addStyleName(0, C_DESCRIPTION, 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);
 | 
					    applyDataRowStyle(row);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    final FlexCellFormatter fmt = table.getFlexCellFormatter();
 | 
					    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().dataCell());
 | 
				
			||||||
    fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().projectNameColumn());
 | 
					    fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().projectNameColumn());
 | 
				
			||||||
    fmt.addStyleName(row, C_DESCRIPTION, Gerrit.RESOURCES.css().dataCell());
 | 
					    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) {
 | 
					  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_NAME, k.name());
 | 
				
			||||||
    table.setText(row, C_DESCRIPTION, k.description());
 | 
					    table.setText(row, C_DESCRIPTION, k.description());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,4 +23,6 @@ public interface UIConstants extends Constants {
 | 
				
			|||||||
  String projectName();
 | 
					  String projectName();
 | 
				
			||||||
  String projectDescription();
 | 
					  String projectDescription();
 | 
				
			||||||
  String projectItemHelp();
 | 
					  String projectItemHelp();
 | 
				
			||||||
 | 
					  String projectStateAbbrev();
 | 
				
			||||||
 | 
					  String projectStateHelp();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,4 +3,6 @@ commentedActionButtonCancel = Cancel
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
projectName = Project Name
 | 
					projectName = Project Name
 | 
				
			||||||
projectDescription = Project Description
 | 
					projectDescription = Project Description
 | 
				
			||||||
projectItemHelp = project
 | 
					projectItemHelp = project
 | 
				
			||||||
 | 
					projectStateAbbrev = S
 | 
				
			||||||
 | 
					projectStateHelp = State
 | 
				
			||||||
@@ -271,6 +271,7 @@ public class ListProjects implements RestReadView<TopLevelResource> {
 | 
				
			|||||||
              info.name = parentState.getProject().getName();
 | 
					              info.name = parentState.getProject().getName();
 | 
				
			||||||
              info.description = Strings.emptyToNull(
 | 
					              info.description = Strings.emptyToNull(
 | 
				
			||||||
                  parentState.getProject().getDescription());
 | 
					                  parentState.getProject().getDescription());
 | 
				
			||||||
 | 
					              info.state = parentState.getProject().getState();
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
              rejected.add(parentState.getProject().getName());
 | 
					              rejected.add(parentState.getProject().getName());
 | 
				
			||||||
              continue;
 | 
					              continue;
 | 
				
			||||||
@@ -313,6 +314,8 @@ public class ListProjects implements RestReadView<TopLevelResource> {
 | 
				
			|||||||
            info.description = Strings.emptyToNull(e.getProject().getDescription());
 | 
					            info.description = Strings.emptyToNull(e.getProject().getDescription());
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          info.state = e.getProject().getState();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          try {
 | 
					          try {
 | 
				
			||||||
            if (!showBranch.isEmpty()) {
 | 
					            if (!showBranch.isEmpty()) {
 | 
				
			||||||
              Repository git = repoManager.openRepository(projectName);
 | 
					              Repository git = repoManager.openRepository(projectName);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,7 @@ public class ProjectJson {
 | 
				
			|||||||
    Project.NameKey parentName = p.getParent(allProjects);
 | 
					    Project.NameKey parentName = p.getParent(allProjects);
 | 
				
			||||||
    info.parent = parentName != null ? parentName.get() : null;
 | 
					    info.parent = parentName != null ? parentName.get() : null;
 | 
				
			||||||
    info.description = Strings.emptyToNull(p.getDescription());
 | 
					    info.description = Strings.emptyToNull(p.getDescription());
 | 
				
			||||||
 | 
					    info.state = p.getState();
 | 
				
			||||||
    info.finish();
 | 
					    info.finish();
 | 
				
			||||||
    return info;
 | 
					    return info;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -51,6 +52,7 @@ public class ProjectJson {
 | 
				
			|||||||
    public String name;
 | 
					    public String name;
 | 
				
			||||||
    public String parent;
 | 
					    public String parent;
 | 
				
			||||||
    public String description;
 | 
					    public String description;
 | 
				
			||||||
 | 
					    public Project.State state;
 | 
				
			||||||
    public Map<String, String> branches;
 | 
					    public Map<String, String> branches;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void finish() {
 | 
					    void finish() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,10 @@ public class ProjectResource implements RestResource {
 | 
				
			|||||||
    return control.getProject().getNameKey();
 | 
					    return control.getProject().getNameKey();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public Project.State getState() {
 | 
				
			||||||
 | 
					    return control.getProject().getState();
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public ProjectControl getControl() {
 | 
					  public ProjectControl getControl() {
 | 
				
			||||||
    return control;
 | 
					    return control;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user