On project creation allow choosing parent from popup.
In the create project UI a user can now browse all projects and select one as parent for the new project. Change-Id: I2be514c60d70e895607d93f6671c3698d1b7e6de Signed-off-by: Bruce Zu <bruce.zu@sonymobile.com>
This commit is contained in:
@@ -48,6 +48,8 @@ public interface AdminConstants extends Constants {
|
||||
String suggestedGroupLabel();
|
||||
String parentSuggestions();
|
||||
|
||||
String buttonBrowseProjects();
|
||||
String projects();
|
||||
String headingGroupUUID();
|
||||
String headingOwner();
|
||||
String headingDescription();
|
||||
|
||||
@@ -17,6 +17,8 @@ buttonSelectGroup = Select
|
||||
buttonSaveChanges = Save Changes
|
||||
checkBoxEmptyCommit = Create initial empty commit
|
||||
checkBoxPermissionsOnly = Only serve as parent for other projects
|
||||
buttonBrowseProjects = Browse
|
||||
projects = All projects
|
||||
useContentMerge = Automatically resolve conflicts
|
||||
useContributorAgreements = Require a valid contributor agreement to upload
|
||||
useSignedOffBy = Require <a href="http://gerrit.googlecode.com/svn/documentation/2.0/user-signedoffby.html#Signed-off-by" target="_blank"><code>Signed-off-by</code></a> in commit message
|
||||
|
||||
@@ -21,9 +21,11 @@ import com.google.gerrit.client.projects.ProjectInfo;
|
||||
import com.google.gerrit.client.projects.ProjectMap;
|
||||
import com.google.gerrit.client.rpc.GerritCallback;
|
||||
import com.google.gerrit.client.ui.HintTextBox;
|
||||
import com.google.gerrit.client.ui.ProjectListPopup;
|
||||
import com.google.gerrit.client.ui.ProjectNameSuggestOracle;
|
||||
import com.google.gerrit.client.ui.ProjectsTable;
|
||||
import com.google.gerrit.client.ui.Screen;
|
||||
import com.google.gerrit.common.PageLinks;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
@@ -41,13 +43,16 @@ import com.google.gwtexpui.globalkey.client.NpTextBox;
|
||||
import com.google.gwtjsonrpc.common.VoidResult;
|
||||
|
||||
public class CreateProjectScreen extends Screen {
|
||||
private Grid grid;
|
||||
private NpTextBox project;
|
||||
private Button create;
|
||||
private Button browse;
|
||||
private HintTextBox parent;
|
||||
private SuggestBox sugestParent;
|
||||
private CheckBox emptyCommit;
|
||||
private CheckBox permissionsOnly;
|
||||
private ProjectsTable suggestedParentsTab;
|
||||
private ProjectListPopup projectsPopup;
|
||||
|
||||
public CreateProjectScreen() {
|
||||
super();
|
||||
@@ -60,11 +65,29 @@ public class CreateProjectScreen extends Screen {
|
||||
display();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onUnload() {
|
||||
super.onUnload();
|
||||
projectsPopup.closePopup();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onInitUI() {
|
||||
super.onInitUI();
|
||||
setPageTitle(Util.C.createProjectTitle());
|
||||
addCreateProjectPanel();
|
||||
|
||||
/* popup */
|
||||
projectsPopup = new ProjectListPopup() {
|
||||
@Override
|
||||
protected void onMovePointerTo(String projectName) {
|
||||
// prevent user input from being overwritten by simply poping up
|
||||
if (!projectsPopup.isPopingUp() || "".equals(sugestParent.getText())) {
|
||||
sugestParent.setText(projectName);
|
||||
}
|
||||
}
|
||||
};
|
||||
projectsPopup.initPopup(Util.C.projects(), PageLinks.ADMIN_PROJECTS);
|
||||
}
|
||||
|
||||
private void addCreateProjectPanel() {
|
||||
@@ -82,12 +105,11 @@ public class CreateProjectScreen extends Screen {
|
||||
fp.add(emptyCommit);
|
||||
fp.add(permissionsOnly);
|
||||
fp.add(create);
|
||||
VerticalPanel vp=new VerticalPanel();
|
||||
VerticalPanel vp = new VerticalPanel();
|
||||
vp.add(fp);
|
||||
initSuggestedParents();
|
||||
vp.add(suggestedParentsTab);
|
||||
add(vp);
|
||||
|
||||
}
|
||||
|
||||
private void initCreateTxt() {
|
||||
@@ -111,6 +133,23 @@ public class CreateProjectScreen extends Screen {
|
||||
doCreateProject();
|
||||
}
|
||||
});
|
||||
|
||||
browse = new Button(Util.C.buttonBrowseProjects());
|
||||
browse.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(final ClickEvent event) {
|
||||
int top = grid.getAbsoluteTop() - 50; // under page header
|
||||
// Try to place it to the right of everything else, but not
|
||||
// right justified
|
||||
int left =
|
||||
5 + Math.max(
|
||||
grid.getAbsoluteLeft() + grid.getOffsetWidth(),
|
||||
suggestedParentsTab.getAbsoluteLeft()
|
||||
+ suggestedParentsTab.getOffsetWidth());
|
||||
projectsPopup.setPreferredCoordinates(top, left);
|
||||
projectsPopup.displayPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void initParentBox() {
|
||||
@@ -158,13 +197,13 @@ public class CreateProjectScreen extends Screen {
|
||||
}
|
||||
|
||||
private void addGrid(final VerticalPanel fp) {
|
||||
final Grid grid = new Grid(2, 2);
|
||||
grid = new Grid(2, 3);
|
||||
grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
|
||||
grid.setText(0, 0, Util.C.columnProjectName() + ":");
|
||||
grid.setWidget(0, 1, project);
|
||||
grid.setText(1, 0, Util.C.headingParentProjectName() + ":");
|
||||
grid.setWidget(1, 1, sugestParent);
|
||||
|
||||
grid.setWidget(1, 2, browse);
|
||||
fp.add(grid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user