Allow configuring the Report Bug URL

Let site administrators direct users to their own ticket queue,
as for many servers most of the reported bugs are small internal
problems like asking for a repository to be created or updating
group memberships.

Change-Id: If79dcf9d040867393441db89452bebb4b8eb53a8
This commit is contained in:
Shawn O. Pearce
2012-08-16 17:18:58 -07:00
parent 848fbb38cd
commit b8bea1b65f
7 changed files with 40 additions and 6 deletions

View File

@@ -1110,6 +1110,13 @@ By default unset, as the HTTP daemon must be configured externally
by the system administrator, and might not even be running on the by the system administrator, and might not even be running on the
same host as Gerrit. same host as Gerrit.
[[gerrit.reportBugUrl]]gerrit.reportBugUrl::
+
URL to direct users to when they need to report a bug about the
Gerrit service. By default this links to the upstream Gerrit
Code Review's own bug tracker but could be directed to the system
administrator's ticket queue.
[[gitweb]]Section gitweb [[gitweb]]Section gitweb
~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -28,6 +28,7 @@ import java.util.Set;
public class GerritConfig implements Cloneable { public class GerritConfig implements Cloneable {
protected String registerUrl; protected String registerUrl;
protected String httpPasswordUrl; protected String httpPasswordUrl;
protected String reportBugUrl;
protected String openIdSsoUrl; protected String openIdSsoUrl;
protected List<OpenIdProviderPattern> allowedOpenIDs; protected List<OpenIdProviderPattern> allowedOpenIDs;
@@ -57,6 +58,14 @@ public class GerritConfig implements Cloneable {
registerUrl = u; registerUrl = u;
} }
public String getReportBugUrl() {
return reportBugUrl;
}
public void setReportBugUrl(String u) {
reportBugUrl = u;
}
public String getEditFullNameUrl() { public String getEditFullNameUrl() {
return editFullNameUrl; return editFullNameUrl;
} }

View File

@@ -58,8 +58,8 @@ import com.google.gwt.user.client.ui.Accessibility;
import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.InlineLabel; import com.google.gwt.user.client.ui.InlineLabel;
import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
@@ -447,9 +447,19 @@ public class Gerrit implements EntryPoint {
vs = "dev"; vs = "dev";
} }
final HTML version = new HTML(M.poweredBy(vs)); FlowPanel poweredBy = new FlowPanel();
version.setStyleName(RESOURCES.css().version()); poweredBy.setStyleName(RESOURCES.css().version());
btmmenu.add(version); poweredBy.add(new InlineHTML(M.poweredBy(vs)));
if (getConfig().getReportBugUrl() != null) {
poweredBy.add(new InlineLabel(" | "));
Anchor a = new Anchor(
C.reportBug(),
getConfig().getReportBugUrl());
a.setTarget("_blank");
a.setStyleName("");
poweredBy.add(a);
}
btmmenu.add(poweredBy);
} }
private void onModuleLoad2() { private void onModuleLoad2() {

View File

@@ -21,6 +21,7 @@ public interface GerritConstants extends Constants {
String menuSignOut(); String menuSignOut();
String menuRegister(); String menuRegister();
String menuSettings(); String menuSettings();
String reportBug();
String signInDialogTitle(); String signInDialogTitle();
String signInDialogClose(); String signInDialogClose();

View File

@@ -2,6 +2,7 @@ menuSignIn = Sign In
menuSignOut = Sign Out menuSignOut = Sign Out
menuRegister = Register menuRegister = Register
menuSettings = Settings menuSettings = Settings
reportBug = Report Bug
signInDialogTitle = Code Review - Sign In signInDialogTitle = Code Review - Sign In
signInDialogClose = Close signInDialogClose = Close

View File

@@ -1,7 +1,6 @@
windowTitle1 = {0} Code Review windowTitle1 = {0} Code Review
windowTitle2 = {0} | {1} Code Review windowTitle2 = {0} | {1} Code Review
poweredBy = Powered by <a href="http://code.google.com/p/gerrit/" target="_blank">Gerrit Code Review</a> ({0}) \ poweredBy = Powered by <a href="http://code.google.com/p/gerrit/" target="_blank">Gerrit Code Review</a> ({0})
| <a href="http://code.google.com/p/gerrit/issues/list" target="_blank">Report Bug</a>
noSuchAccountMessage = {0} is not a registered user. noSuchAccountMessage = {0} is not a registered user.

View File

@@ -121,6 +121,13 @@ class GerritConfigProvider implements Provider<GerritConfig> {
"test", false)); "test", false));
config.setAnonymousCowardName(anonymousCowardName); config.setAnonymousCowardName(anonymousCowardName);
config.setReportBugUrl(cfg.getString("gerrit", null, "reportBugUrl"));
if (config.getReportBugUrl() == null) {
config.setReportBugUrl("http://code.google.com/p/gerrit/issues/list");
} else if (config.getReportBugUrl().isEmpty()) {
config.setReportBugUrl(null);
}
final Set<Account.FieldName> fields = new HashSet<Account.FieldName>(); final Set<Account.FieldName> fields = new HashSet<Account.FieldName>();
for (final Account.FieldName n : Account.FieldName.values()) { for (final Account.FieldName n : Account.FieldName.values()) {
if (realm.allowsEdit(n)) { if (realm.allowsEdit(n)) {