Make ServerInfo accessible by plugins
The ServerInfo information provides information about the server configuration that is relevant for rendering the UI. UI plugins should be able to access it, e.g. they need the anonymous coward name to render user names the same way as Gerrit core does (use the anonymous coward name if the user has no full name). Change-Id: I272bcb96b5ce888007f6c4fa12f74ef750cc9862 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import com.google.gerrit.client.ErrorDialog;
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.info.AccountInfo;
|
||||
import com.google.gerrit.client.info.AccountPreferencesInfo;
|
||||
import com.google.gerrit.client.info.ServerInfo;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.user.client.History;
|
||||
@@ -72,6 +73,7 @@ public class ApiGlue {
|
||||
refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
|
||||
isSignedIn: @com.google.gerrit.client.api.ApiGlue::isSignedIn(),
|
||||
showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
|
||||
getServerInfo: @com.google.gerrit.client.api.ApiGlue::getServerInfo(),
|
||||
getCurrentUser: @com.google.gerrit.client.api.ApiGlue::getCurrentUser(),
|
||||
getUserPreferences: @com.google.gerrit.client.api.ApiGlue::getUserPreferences(),
|
||||
refreshUserPreferences: @com.google.gerrit.client.api.ApiGlue::refreshUserPreferences(),
|
||||
@@ -254,6 +256,10 @@ public class ApiGlue {
|
||||
Gerrit.display(History.getToken());
|
||||
}
|
||||
|
||||
private static final ServerInfo getServerInfo() {
|
||||
return Gerrit.info();
|
||||
}
|
||||
|
||||
private static final AccountInfo getCurrentUser() {
|
||||
return Gerrit.getUserAccountInfo();
|
||||
}
|
||||
|
@@ -50,6 +50,7 @@ final class Plugin extends JavaScriptObject {
|
||||
var G = $wnd.Gerrit;
|
||||
@com.google.gerrit.client.api.Plugin::TYPE.prototype = {
|
||||
getPluginName: function(){return this.name},
|
||||
getServerInfo: @com.google.gerrit.client.api.ApiGlue::getServerInfo(),
|
||||
getCurrentUser: @com.google.gerrit.client.api.ApiGlue::getCurrentUser(),
|
||||
getUserPreferences: @com.google.gerrit.client.api.ApiGlue::getUserPreferences(),
|
||||
refreshUserPreferences: @com.google.gerrit.client.api.ApiGlue::refreshUserPreferences(),
|
||||
|
Reference in New Issue
Block a user