Move the Groups and Plugins menu items to the top level.
It was inconsistent to access projects administration from the top-level Projects menu item and, at the same time, have to go to Admin > Groups or Admin > Plugins to access the Groups or Plugins administration. This change also removes the top-level Admin menu as it becomes unnecessary once the Groups and Plugins are moved to the top-level. Change-Id: Ia58b768317a1998165d782d81952552b5395cbc6 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
		@@ -16,6 +16,7 @@ package com.google.gerrit.client;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import static com.google.gerrit.common.data.GlobalCapability.ADMINISTRATE_SERVER;
 | 
					import static com.google.gerrit.common.data.GlobalCapability.ADMINISTRATE_SERVER;
 | 
				
			||||||
import static com.google.gerrit.common.data.GlobalCapability.CREATE_PROJECT;
 | 
					import static com.google.gerrit.common.data.GlobalCapability.CREATE_PROJECT;
 | 
				
			||||||
 | 
					import static com.google.gerrit.common.data.GlobalCapability.CREATE_GROUP;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gerrit.client.account.AccountCapabilities;
 | 
					import com.google.gerrit.client.account.AccountCapabilities;
 | 
				
			||||||
import com.google.gerrit.client.auth.openid.OpenIdSignInDialog;
 | 
					import com.google.gerrit.client.auth.openid.OpenIdSignInDialog;
 | 
				
			||||||
@@ -610,17 +611,28 @@ public class Gerrit implements EntryPoint {
 | 
				
			|||||||
    menuLeft.add(projectsBar, C.menuProjects());
 | 
					    menuLeft.add(projectsBar, C.menuProjects());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (signedIn) {
 | 
					    if (signedIn) {
 | 
				
			||||||
      final LinkMenuBar menuBar = new LinkMenuBar();
 | 
					      final LinkMenuBar groupsBar = new LinkMenuBar();
 | 
				
			||||||
      addLink(menuBar, C.menuGroups(), PageLinks.ADMIN_GROUPS);
 | 
					      addLink(groupsBar, C.menuGroupsList(), PageLinks.ADMIN_GROUPS);
 | 
				
			||||||
 | 
					      AccountCapabilities.all(new GerritCallback<AccountCapabilities>() {
 | 
				
			||||||
 | 
					        @Override
 | 
				
			||||||
 | 
					        public void onSuccess(AccountCapabilities result) {
 | 
				
			||||||
 | 
					          if (result.canPerform(CREATE_GROUP)) {
 | 
				
			||||||
 | 
					            addLink(groupsBar, C.menuGroupsCreate(), PageLinks.ADMIN_CREATE_GROUP);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }, CREATE_GROUP);
 | 
				
			||||||
 | 
					      menuLeft.add(groupsBar, C.menuGroups());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      final LinkMenuBar pluginsBar = new LinkMenuBar();
 | 
				
			||||||
      AccountCapabilities.all(new GerritCallback<AccountCapabilities>() {
 | 
					      AccountCapabilities.all(new GerritCallback<AccountCapabilities>() {
 | 
				
			||||||
        @Override
 | 
					        @Override
 | 
				
			||||||
        public void onSuccess(AccountCapabilities result) {
 | 
					        public void onSuccess(AccountCapabilities result) {
 | 
				
			||||||
          if (result.canPerform(ADMINISTRATE_SERVER)) {
 | 
					          if (result.canPerform(ADMINISTRATE_SERVER)) {
 | 
				
			||||||
            addLink(menuBar, C.menuPlugins(), PageLinks.ADMIN_PLUGINS);
 | 
					            addLink(pluginsBar, C.menuPluginsInstalled(), PageLinks.ADMIN_PLUGINS);
 | 
				
			||||||
 | 
					            menuLeft.add(pluginsBar, C.menuPlugins());
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }, ADMINISTRATE_SERVER);
 | 
					      }, ADMINISTRATE_SERVER);
 | 
				
			||||||
      menuLeft.add(menuBar, C.menuAdmin());
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (getConfig().isDocumentationAvailable()) {
 | 
					    if (getConfig().isDocumentationAvailable()) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,10 +73,12 @@ public interface GerritConstants extends Constants {
 | 
				
			|||||||
  String menuProjectsList();
 | 
					  String menuProjectsList();
 | 
				
			||||||
  String menuProjectsCreate();
 | 
					  String menuProjectsCreate();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  String menuAdmin();
 | 
					 | 
				
			||||||
  String menuPeople();
 | 
					  String menuPeople();
 | 
				
			||||||
  String menuGroups();
 | 
					  String menuGroups();
 | 
				
			||||||
 | 
					  String menuGroupsList();
 | 
				
			||||||
 | 
					  String menuGroupsCreate();
 | 
				
			||||||
  String menuPlugins();
 | 
					  String menuPlugins();
 | 
				
			||||||
 | 
					  String menuPluginsInstalled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  String menuDocumentation();
 | 
					  String menuDocumentation();
 | 
				
			||||||
  String menuDocumentationIndex();
 | 
					  String menuDocumentationIndex();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -56,10 +56,13 @@ menuProjects = Projects
 | 
				
			|||||||
menuProjectsList = List
 | 
					menuProjectsList = List
 | 
				
			||||||
menuProjectsCreate = Create New Project
 | 
					menuProjectsCreate = Create New Project
 | 
				
			||||||
 | 
					
 | 
				
			||||||
menuAdmin = Admin
 | 
					 | 
				
			||||||
menuPeople = People
 | 
					menuPeople = People
 | 
				
			||||||
menuGroups = Groups
 | 
					menuGroups = Groups
 | 
				
			||||||
 | 
					menuGroupsList = List
 | 
				
			||||||
 | 
					menuGroupsCreate = Create New Group
 | 
				
			||||||
 | 
					
 | 
				
			||||||
menuPlugins = Plugins
 | 
					menuPlugins = Plugins
 | 
				
			||||||
 | 
					menuPluginsInstalled = Installed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
menuDocumentation = Documentation
 | 
					menuDocumentation = Documentation
 | 
				
			||||||
menuDocumentationIndex = Index
 | 
					menuDocumentationIndex = Index
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -108,7 +108,6 @@ public interface AdminConstants extends Constants {
 | 
				
			|||||||
  String projectAdminTabAccess();
 | 
					  String projectAdminTabAccess();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  String plugins();
 | 
					  String plugins();
 | 
				
			||||||
  String pluginTabInstalled();
 | 
					 | 
				
			||||||
  String pluginDisabled();
 | 
					  String pluginDisabled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  String columnPluginName();
 | 
					  String columnPluginName();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -88,7 +88,6 @@ projectAdminTabBranches = Branches
 | 
				
			|||||||
projectAdminTabAccess = Access
 | 
					projectAdminTabAccess = Access
 | 
				
			||||||
 | 
					
 | 
				
			||||||
plugins = Plugins
 | 
					plugins = Plugins
 | 
				
			||||||
pluginTabInstalled = Installed
 | 
					 | 
				
			||||||
pluginDisabled = Disabled
 | 
					pluginDisabled = Disabled
 | 
				
			||||||
columnPluginName = Plugin Name
 | 
					columnPluginName = Plugin Name
 | 
				
			||||||
columnPluginVersion = Version
 | 
					columnPluginVersion = Version
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,16 +14,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.google.gerrit.client.admin;
 | 
					package com.google.gerrit.client.admin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gerrit.client.Gerrit;
 | 
					 | 
				
			||||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
 | 
					import com.google.gerrit.client.rpc.ScreenLoadCallback;
 | 
				
			||||||
import com.google.gerrit.client.ui.AccountScreen;
 | 
					import com.google.gerrit.client.ui.AccountScreen;
 | 
				
			||||||
import com.google.gerrit.client.ui.Hyperlink;
 | 
					 | 
				
			||||||
import com.google.gerrit.common.PageLinks;
 | 
					import com.google.gerrit.common.PageLinks;
 | 
				
			||||||
import com.google.gerrit.common.data.GroupList;
 | 
					import com.google.gerrit.common.data.GroupList;
 | 
				
			||||||
import com.google.gwt.user.client.ui.VerticalPanel;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class GroupListScreen extends AccountScreen {
 | 
					public class GroupListScreen extends AccountScreen {
 | 
				
			||||||
  private VerticalPanel createGroupLinkPanel;
 | 
					 | 
				
			||||||
  private GroupTable groups;
 | 
					  private GroupTable groups;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
@@ -33,7 +29,6 @@ public class GroupListScreen extends AccountScreen {
 | 
				
			|||||||
        .visibleGroups(new ScreenLoadCallback<GroupList>(this) {
 | 
					        .visibleGroups(new ScreenLoadCallback<GroupList>(this) {
 | 
				
			||||||
          @Override
 | 
					          @Override
 | 
				
			||||||
          protected void preDisplay(GroupList result) {
 | 
					          protected void preDisplay(GroupList result) {
 | 
				
			||||||
            createGroupLinkPanel.setVisible(result.isCanCreateGroup());
 | 
					 | 
				
			||||||
            groups.display(result.getGroups());
 | 
					            groups.display(result.getGroups());
 | 
				
			||||||
            groups.finishDisplay();
 | 
					            groups.finishDisplay();
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
@@ -45,12 +40,6 @@ public class GroupListScreen extends AccountScreen {
 | 
				
			|||||||
    super.onInitUI();
 | 
					    super.onInitUI();
 | 
				
			||||||
    setPageTitle(Util.C.groupListTitle());
 | 
					    setPageTitle(Util.C.groupListTitle());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    createGroupLinkPanel = new VerticalPanel();
 | 
					 | 
				
			||||||
    createGroupLinkPanel.setStyleName(Gerrit.RESOURCES.css().createGroupLink());
 | 
					 | 
				
			||||||
    createGroupLinkPanel.add(new Hyperlink(Util.C.headingCreateGroup(),
 | 
					 | 
				
			||||||
        PageLinks.ADMIN_CREATE_GROUP));
 | 
					 | 
				
			||||||
    add(createGroupLinkPanel);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    groups = new GroupTable(true /* hyperlink to admin */, PageLinks.ADMIN_GROUPS);
 | 
					    groups = new GroupTable(true /* hyperlink to admin */, PageLinks.ADMIN_GROUPS);
 | 
				
			||||||
    add(groups);
 | 
					    add(groups);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,16 +14,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
package com.google.gerrit.client.admin;
 | 
					package com.google.gerrit.client.admin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static com.google.gerrit.common.PageLinks.ADMIN_PLUGINS;
 | 
					import com.google.gerrit.client.ui.Screen;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.gerrit.client.ui.MenuScreen;
 | 
					public abstract class PluginScreen extends Screen {
 | 
				
			||||||
 | 
					 | 
				
			||||||
public abstract class PluginScreen extends MenuScreen {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public PluginScreen() {
 | 
					  public PluginScreen() {
 | 
				
			||||||
    setRequiresSignIn(true);
 | 
					    setRequiresSignIn(true);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    link(Util.C.pluginTabInstalled(), ADMIN_PLUGINS);
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @Override
 | 
					  @Override
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user