Remove group type from AccountGroupInfoScreen
The information about the group type was not much helpful. All groups that can be seen in Gerrit are of type 'INTERNAL', except a few well-known system groups which are of type 'SYSTEM'. The system groups are so well-known that there is no need to display the type for them. Especially the type selection box was pretty pointless as you could only choose 'INTERNAL' as type. This change also removes the RPC for changing the group type as it is not needed anymore. Change-Id: I16d5a8056d0993bcdd810b76ab8379c67f475a6a Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -53,11 +53,6 @@ public interface GroupAdminService extends RemoteJsonService {
|
||||
void renameGroup(AccountGroup.Id groupId, String newName,
|
||||
AsyncCallback<GroupDetail> callback);
|
||||
|
||||
@Audit
|
||||
@SignInRequired
|
||||
void changeGroupType(AccountGroup.Id groupId, AccountGroup.Type newType,
|
||||
AsyncCallback<VoidResult> callback);
|
||||
|
||||
@Audit
|
||||
@SignInRequired
|
||||
void addGroupInclude(AccountGroup.Id groupId, AccountGroup.UUID incGroupUUID,
|
||||
|
@@ -131,7 +131,6 @@ public interface GerritCss extends CssResource {
|
||||
String groupOptionsPanel();
|
||||
String groupOwnerPanel();
|
||||
String groupOwnerTextBox();
|
||||
String groupTypePanel();
|
||||
String groupTypeSelectListBox();
|
||||
String groupUUIDPanel();
|
||||
String header();
|
||||
|
@@ -24,14 +24,10 @@ import com.google.gerrit.client.ui.SmallHeading;
|
||||
import com.google.gerrit.common.data.GroupDetail;
|
||||
import com.google.gerrit.common.data.GroupOptions;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ListBox;
|
||||
import com.google.gwt.user.client.ui.SuggestBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwtexpui.clippy.client.CopyableLabel;
|
||||
@@ -52,10 +48,6 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
private NpTextArea descTxt;
|
||||
private Button saveDesc;
|
||||
|
||||
private Label typeSystem;
|
||||
private ListBox typeSelect;
|
||||
private Button saveType;
|
||||
|
||||
private CheckBox visibleToAllCheckBox;
|
||||
private Button saveGroupOptions;
|
||||
|
||||
@@ -71,14 +63,12 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
initOwner();
|
||||
initDescription();
|
||||
initGroupOptions();
|
||||
initGroupType();
|
||||
}
|
||||
|
||||
private void enableForm(final boolean canModify) {
|
||||
groupNameTxt.setEnabled(canModify);
|
||||
ownerTxtBox.setEnabled(canModify);
|
||||
descTxt.setEnabled(canModify);
|
||||
typeSelect.setEnabled(canModify);
|
||||
visibleToAllCheckBox.setEnabled(canModify);
|
||||
}
|
||||
|
||||
@@ -219,93 +209,6 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
enabler.listenTo(visibleToAllCheckBox);
|
||||
}
|
||||
|
||||
private void initGroupType() {
|
||||
typeSystem = new Label(Util.C.groupType_SYSTEM());
|
||||
|
||||
typeSelect = new ListBox();
|
||||
typeSelect.setStyleName(Gerrit.RESOURCES.css().groupTypeSelectListBox());
|
||||
typeSelect.addItem(Util.C.groupType_INTERNAL(), AccountGroup.Type.INTERNAL.name());
|
||||
typeSelect.addChangeHandler(new ChangeHandler() {
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
saveType.setEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
saveType = new Button(Util.C.buttonChangeGroupType());
|
||||
saveType.setEnabled(false);
|
||||
saveType.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
onSaveType();
|
||||
}
|
||||
});
|
||||
|
||||
switch (Gerrit.getConfig().getAuthType()) {
|
||||
case HTTP_LDAP:
|
||||
case LDAP:
|
||||
case LDAP_BIND:
|
||||
case CLIENT_SSL_CERT_LDAP:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
final VerticalPanel fp = new VerticalPanel();
|
||||
fp.setStyleName(Gerrit.RESOURCES.css().groupTypePanel());
|
||||
fp.add(new SmallHeading(Util.C.headingGroupType()));
|
||||
fp.add(typeSystem);
|
||||
fp.add(typeSelect);
|
||||
fp.add(saveType);
|
||||
add(fp);
|
||||
}
|
||||
|
||||
private void setType(final AccountGroup.Type newType) {
|
||||
final boolean system = newType == AccountGroup.Type.SYSTEM;
|
||||
|
||||
typeSystem.setVisible(system);
|
||||
typeSelect.setVisible(!system);
|
||||
saveType.setVisible(!system);
|
||||
|
||||
if (!system) {
|
||||
for (int i = 0; i < typeSelect.getItemCount(); i++) {
|
||||
if (newType.name().equals(typeSelect.getValue(i))) {
|
||||
typeSelect.setSelectedIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
saveType.setEnabled(false);
|
||||
|
||||
setMembersTabVisible(newType == AccountGroup.Type.INTERNAL);
|
||||
}
|
||||
|
||||
private void onSaveType() {
|
||||
final int idx = typeSelect.getSelectedIndex();
|
||||
final AccountGroup.Type newType =
|
||||
AccountGroup.Type.valueOf(typeSelect.getValue(idx));
|
||||
|
||||
typeSelect.setEnabled(false);
|
||||
saveType.setEnabled(false);
|
||||
|
||||
Util.GROUP_SVC.changeGroupType(getGroupId(), newType,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(VoidResult result) {
|
||||
typeSelect.setEnabled(true);
|
||||
setType(newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
typeSelect.setEnabled(true);
|
||||
saveType.setEnabled(true);
|
||||
super.onFailure(caught);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void display(final GroupDetail groupDetail) {
|
||||
final AccountGroup group = groupDetail.group;
|
||||
@@ -317,16 +220,13 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
ownerTxt.setText(Util.M.deletedReference(group.getOwnerGroupUUID().get()));
|
||||
}
|
||||
descTxt.setText(group.getDescription());
|
||||
|
||||
visibleToAllCheckBox.setValue(group.isVisibleToAll());
|
||||
|
||||
setType(group.getType());
|
||||
setMembersTabVisible(group.getType() == AccountGroup.Type.INTERNAL);
|
||||
|
||||
enableForm(groupDetail.canModify);
|
||||
saveName.setVisible(groupDetail.canModify);
|
||||
saveOwner.setVisible(groupDetail.canModify);
|
||||
saveDesc.setVisible(groupDetail.canModify);
|
||||
saveGroupOptions.setVisible(groupDetail.canModify);
|
||||
saveType.setVisible(groupDetail.canModify);
|
||||
}
|
||||
}
|
||||
|
@@ -55,7 +55,6 @@ public interface AdminConstants extends Constants {
|
||||
String headingOwner();
|
||||
String headingDescription();
|
||||
String headingProjectOptions();
|
||||
String headingGroupType();
|
||||
String headingMembers();
|
||||
String headingIncludedGroups();
|
||||
String noMembersInfo();
|
||||
@@ -75,10 +74,6 @@ public interface AdminConstants extends Constants {
|
||||
String projectState_READ_ONLY();
|
||||
String projectState_HIDDEN();
|
||||
|
||||
String groupType_SYSTEM();
|
||||
String groupType_INTERNAL();
|
||||
String groupType_LDAP();
|
||||
|
||||
String columnMember();
|
||||
String columnEmailAddress();
|
||||
String columnGroupName();
|
||||
|
@@ -36,7 +36,6 @@ headingGroupUUID = Group UUID
|
||||
headingOwner = Owners
|
||||
headingDescription = Description
|
||||
headingProjectOptions = Project Options
|
||||
headingGroupType = Group Type
|
||||
headingMembers = Members
|
||||
headingIncludedGroups = Included Groups
|
||||
noMembersInfo = Group Members can only be viewed for Gerrit internal groups. For external groups and Gerrit system groups the members cannot be displayed.
|
||||
@@ -54,10 +53,6 @@ projectState_ACTIVE = Active
|
||||
projectState_READ_ONLY = Read Only
|
||||
projectState_HIDDEN = Hidden
|
||||
|
||||
groupType_SYSTEM = System Group
|
||||
groupType_INTERNAL = Internal Group
|
||||
groupType_LDAP = LDAP Group
|
||||
|
||||
columnMember = Member
|
||||
columnEmailAddress = Email Address
|
||||
columnGroupName = Group Name
|
||||
|
@@ -1463,9 +1463,6 @@ a:hover.downloadLink {
|
||||
.groupOwnerTextBox {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.groupTypePanel {
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
.groupTypeSelectListBox {
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
@@ -136,20 +136,6 @@ class GroupAdminServiceImpl extends BaseServiceImplementation implements
|
||||
renameGroupFactory.create(groupId, newName).to(callback);
|
||||
}
|
||||
|
||||
public void changeGroupType(final AccountGroup.Id groupId,
|
||||
final AccountGroup.Type newType, final AsyncCallback<VoidResult> callback) {
|
||||
run(callback, new Action<VoidResult>() {
|
||||
public VoidResult run(final ReviewDb db) throws OrmException, Failure {
|
||||
final AccountGroup group = db.accountGroups().get(groupId);
|
||||
assertAmGroupOwner(db, group);
|
||||
group.setType(newType);
|
||||
db.accountGroups().update(Collections.singleton(group));
|
||||
groupCache.evict(group);
|
||||
return VoidResult.INSTANCE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addGroupInclude(final AccountGroup.Id groupId,
|
||||
final AccountGroup.UUID incGroupUUID, final String incGroupName,
|
||||
final AsyncCallback<GroupDetail> callback) {
|
||||
|
Reference in New Issue
Block a user