Make documentation base URL configurable
Administrators may want to store documentation on a separate static content server from the actual Gerrit server, or use a reverse proxy configuration to serve the docs from somewhere other than /Documentation. Allow this with a new configuration option, gerrit.docUrl. For parallelism while loading the app we still probe /Documentation/index.html; the result of this request is simply discarded if the server config endpoint later returns a configured documentation URL. Change-Id: I98477e3539f5c6271014cedd03354c3345e7379b
This commit is contained in:
@@ -113,6 +113,7 @@ public class Gerrit implements EntryPoint {
|
||||
private static String myHost;
|
||||
private static ServerInfo myServerInfo;
|
||||
private static boolean hasDocumentation;
|
||||
private static String docUrl;
|
||||
private static HostPageData.Theme myTheme;
|
||||
private static Account myAccount;
|
||||
private static String defaultScreenToken;
|
||||
@@ -434,12 +435,18 @@ public class Gerrit implements EntryPoint {
|
||||
@Override
|
||||
public void onSuccess(DocInfo indexInfo) {
|
||||
hasDocumentation = indexInfo != null;
|
||||
docUrl = selfRedirect("/Documentation/");
|
||||
}
|
||||
}));
|
||||
ConfigServerApi.serverInfo(cbg.add(new GerritCallback<ServerInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ServerInfo info) {
|
||||
myServerInfo = info;
|
||||
String du = info.gerrit().docUrl();
|
||||
if (du != null && !du.isEmpty()) {
|
||||
hasDocumentation = true;
|
||||
docUrl = du;
|
||||
}
|
||||
}
|
||||
}));
|
||||
HostPageDataService hpd = GWT.create(HostPageDataService.class);
|
||||
@@ -1001,7 +1008,7 @@ public class Gerrit implements EntryPoint {
|
||||
|
||||
private static void addDocLink(final LinkMenuBar m, final String text,
|
||||
final String href) {
|
||||
final Anchor atag = anchor(text, selfRedirect("/Documentation/" + href));
|
||||
final Anchor atag = anchor(text, docUrl + href);
|
||||
atag.setTarget("_blank");
|
||||
m.add(atag);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ public class GerritInfo extends JavaScriptObject {
|
||||
|
||||
public final native String allProjects() /*-{ return this.all_projects; }-*/;
|
||||
public final native String allUsers() /*-{ return this.all_users; }-*/;
|
||||
public final native String docUrl() /*-{ return this.doc_url; }-*/;
|
||||
public final native String reportBugUrl() /*-{ return this.report_bug_url; }-*/;
|
||||
public final native String reportBugText() /*-{ return this.report_bug_text; }-*/;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user