Introduce top-menu APIs
Expose the ability to invoke the list of top-menu items provided by plugins through the GerritApi. Main use-case is enabling the automation of tests that need to verify the top-menu items configuration. Change-Id: Ic2f5b6c9dc07e9695a75f07372d11c5e6d731761
This commit is contained in:
committed by
David Pursehouse
parent
b9368021a3
commit
a95b8da931
@@ -25,18 +25,21 @@ import com.google.gerrit.extensions.client.EditPreferencesInfo;
|
||||
import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
|
||||
import com.google.gerrit.extensions.common.ServerInfo;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.webui.TopMenu;
|
||||
import com.google.gerrit.server.config.ConfigResource;
|
||||
import com.google.gerrit.server.restapi.config.CheckConsistency;
|
||||
import com.google.gerrit.server.restapi.config.GetDiffPreferences;
|
||||
import com.google.gerrit.server.restapi.config.GetEditPreferences;
|
||||
import com.google.gerrit.server.restapi.config.GetPreferences;
|
||||
import com.google.gerrit.server.restapi.config.GetServerInfo;
|
||||
import com.google.gerrit.server.restapi.config.ListTopMenus;
|
||||
import com.google.gerrit.server.restapi.config.SetDiffPreferences;
|
||||
import com.google.gerrit.server.restapi.config.SetEditPreferences;
|
||||
import com.google.gerrit.server.restapi.config.SetPreferences;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.List;
|
||||
|
||||
@Singleton
|
||||
public class ServerImpl implements Server {
|
||||
@@ -48,6 +51,7 @@ public class ServerImpl implements Server {
|
||||
private final SetEditPreferences setEditPreferences;
|
||||
private final GetServerInfo getServerInfo;
|
||||
private final Provider<CheckConsistency> checkConsistency;
|
||||
private final ListTopMenus listTopMenus;
|
||||
|
||||
@Inject
|
||||
ServerImpl(
|
||||
@@ -58,7 +62,8 @@ public class ServerImpl implements Server {
|
||||
GetEditPreferences getEditPreferences,
|
||||
SetEditPreferences setEditPreferences,
|
||||
GetServerInfo getServerInfo,
|
||||
Provider<CheckConsistency> checkConsistency) {
|
||||
Provider<CheckConsistency> checkConsistency,
|
||||
ListTopMenus listTopMenus) {
|
||||
this.getPreferences = getPreferences;
|
||||
this.setPreferences = setPreferences;
|
||||
this.getDiffPreferences = getDiffPreferences;
|
||||
@@ -67,6 +72,7 @@ public class ServerImpl implements Server {
|
||||
this.setEditPreferences = setEditPreferences;
|
||||
this.getServerInfo = getServerInfo;
|
||||
this.checkConsistency = checkConsistency;
|
||||
this.listTopMenus = listTopMenus;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,4 +154,9 @@ public class ServerImpl implements Server {
|
||||
throw asRestApiException("Cannot check consistency", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TopMenu.MenuEntry> topMenus() {
|
||||
return listTopMenus.apply(new ConfigResource()).value();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user