Merge branch 'stable-3.0'

* stable-3.0:
  Remove leftovers of unsupported urlAlias configuration settings
  Documentation: add note urlAlias only supports GWT UI pages
  Update git submodules
  Improve the UX with colors in dark theme
  Update git submodules
  Update git submodules

Change-Id: I77719dbdd14fe3aadba585b79c10175ef1fc88a4
This commit is contained in:
David Pursehouse
2019-09-26 15:26:56 +09:00
10 changed files with 0 additions and 130 deletions

View File

@@ -4783,47 +4783,6 @@ account deactivations.
link:#schedule-configuration-examples[Schedule examples] can be found
in the link:#schedule-configuration[Schedule Configuration] section.
[[urlAlias]]
=== Section urlAlias
URL aliases define regular expressions for URL tokens that are mapped
to target URL tokens.
Each URL alias must be specified in its own subsection. The subsection
name should be a descriptive name. It must be unique, but is not
interpreted in any way.
The URL aliases are applied in no particular order. The first matching
URL alias is used and further matches are ignored.
URL aliases can be used to map plugin screens into the Gerrit URL
namespace, or to replace Gerrit screens by plugin screens.
Example:
----
[urlAlias "MyPluginScreen"]
match = /myscreen/(.*)
token = /x/myplugin/myscreen/$1
[urlAlias "MyChangeScreen"]
match = /c/(.*)
token = /x/myplugin/c/$1
----
[[urlAlias.match]]urlAlias.match::
+
A regular expression for a URL token.
+
The matched URL token is replaced by `urlAlias.token`.
[[urlAlias.token]]urlAlias.token::
+
The target URL token.
+
It can contain placeholders for the groups matched by the
`urlAlias.match` regular expression: `$1` for the first matched group,
`$2` for the second matched group, etc.
[[submodule]]
=== Section submodule

View File

@@ -2764,9 +2764,6 @@ link:rest-api-config.html#top-menu-item-info[TopMenuItemInfo] entities.
|`change_table` ||
The columns to display in the change table (PolyGerrit only). The default is
empty, which will default columns as determined by the frontend.
|`url_aliases` |optional|
A map of URL path pairs, where the first URL path is an alias for the
second URL path.
|`email_strategy` ||
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for
@@ -2829,9 +2826,6 @@ link:rest-api-config.html#top-menu-item-info[TopMenuItemInfo] entities.
|`change_table` ||
The columns to display in the change table (PolyGerrit only). The default is
empty, which will default columns as determined by the frontend.
|`url_aliases` |optional|
A map of URL path pairs, where the first URL path is an alias for the
second URL path.
|`email_strategy` |optional|
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for

View File

@@ -1963,11 +1963,6 @@ entity. Not set if SSHD is disabled.
Information about the configuration from the
link:config-gerrit.html#suggest[suggest] section as link:#suggest-info[
SuggestInfo] entity.
|`url_aliases` |optional|
A map of URL aliases, where a regular expression for an URL token is
mapped to a target URL token. The target URL token can contain
placeholders for the groups matched by the regular expression: `$1` for
the first matched group, `$2` for the second matched group, etc.
|`user` ||
Information about the configuration from the
link:config-gerrit.html#user[user] section as link:#user-config-info[

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.extensions.client;
import java.util.List;
import java.util.Map;
/** Preferences about a single user. */
public class GeneralPreferencesInfo {
@@ -145,7 +144,6 @@ public class GeneralPreferencesInfo {
public Boolean workInProgressByDefault;
public List<MenuItem> my;
public List<String> changeTable;
public Map<String, String> urlAliases;
public DateFormat getDateFormat() {
if (dateFormat == null) {

View File

@@ -14,8 +14,6 @@
package com.google.gerrit.extensions.common;
import java.util.Map;
public class ServerInfo {
public AccountsInfo accounts;
public AuthInfo auth;
@@ -26,7 +24,6 @@ public class ServerInfo {
public PluginConfigInfo plugin;
public SshdInfo sshd;
public SuggestInfo suggest;
public Map<String, String> urlAliases;
public UserConfigInfo user;
public ReceiveInfo receive;
public String defaultTheme;

View File

@@ -15,7 +15,6 @@ package com.google.gerrit.server.account;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.extensions.client.DiffPreferencesInfo;
import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
@@ -77,8 +76,6 @@ public abstract class Preferences {
public abstract Optional<ImmutableList<String>> changeTable();
public abstract Optional<ImmutableMap<String, String>> urlAliases();
@AutoValue.Builder
public abstract static class Builder {
abstract Builder changesPerPage(@Nullable Integer val);
@@ -121,8 +118,6 @@ public abstract class Preferences {
abstract Builder changeTable(@Nullable ImmutableList<String> val);
abstract Builder urlAliases(@Nullable ImmutableMap<String, String> val);
abstract General build();
}
@@ -148,7 +143,6 @@ public abstract class Preferences {
.workInProgressByDefault(info.workInProgressByDefault)
.my(info.my == null ? null : ImmutableList.copyOf(info.my))
.changeTable(info.changeTable == null ? null : ImmutableList.copyOf(info.changeTable))
.urlAliases(info.urlAliases == null ? null : ImmutableMap.copyOf(info.urlAliases))
.build();
}
@@ -174,7 +168,6 @@ public abstract class Preferences {
info.workInProgressByDefault = workInProgressByDefault().orElse(null);
info.my = my().orElse(null);
info.changeTable = changeTable().orElse(null);
info.urlAliases = urlAliases().orElse(null);
return info;
}
}

View File

@@ -21,11 +21,8 @@ import static com.google.gerrit.server.config.ConfigUtil.storeSection;
import static com.google.gerrit.server.git.UserConfigSections.CHANGE_TABLE;
import static com.google.gerrit.server.git.UserConfigSections.CHANGE_TABLE_COLUMN;
import static com.google.gerrit.server.git.UserConfigSections.KEY_ID;
import static com.google.gerrit.server.git.UserConfigSections.KEY_MATCH;
import static com.google.gerrit.server.git.UserConfigSections.KEY_TARGET;
import static com.google.gerrit.server.git.UserConfigSections.KEY_TOKEN;
import static com.google.gerrit.server.git.UserConfigSections.KEY_URL;
import static com.google.gerrit.server.git.UserConfigSections.URL_ALIAS;
import static java.util.Objects.requireNonNull;
import com.google.common.base.Strings;
@@ -47,9 +44,7 @@ import com.google.gerrit.server.git.meta.VersionedMetaData;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.CommitBuilder;
@@ -151,7 +146,6 @@ public class StoredPreferences {
parseDefaultGeneralPreferences(defaultCfg, null));
setChangeTable(cfg, mergedGeneralPreferencesInput.changeTable);
setMy(cfg, mergedGeneralPreferencesInput.my);
setUrlAliases(cfg, mergedGeneralPreferencesInput.urlAliases);
// evict the cached general preferences
this.generalPreferences = null;
@@ -246,11 +240,9 @@ public class StoredPreferences {
if (input != null) {
r.changeTable = input.changeTable;
r.my = input.my;
r.urlAliases = input.urlAliases;
} else {
r.changeTable = parseChangeTableColumns(cfg, defaultCfg);
r.my = parseMyMenus(cfg, defaultCfg);
r.urlAliases = parseUrlAliases(cfg, defaultCfg);
}
return r;
}
@@ -404,14 +396,6 @@ public class StoredPreferences {
return my;
}
private static Map<String, String> parseUrlAliases(Config cfg, @Nullable Config defaultCfg) {
Map<String, String> urlAliases = urlAliases(cfg);
if (urlAliases == null && defaultCfg != null) {
urlAliases = urlAliases(defaultCfg);
}
return urlAliases;
}
public static GeneralPreferencesInfo readDefaultGeneralPreferences(
AllUsersName allUsersName, Repository allUsersRepo)
throws IOException, ConfigInvalidException {
@@ -449,7 +433,6 @@ public class StoredPreferences {
GeneralPreferencesInfo.defaults());
setMy(defaultPrefs.getConfig(), input.my);
setChangeTable(defaultPrefs.getConfig(), input.changeTable);
setUrlAliases(defaultPrefs.getConfig(), input.urlAliases);
defaultPrefs.commit(md);
return parseGeneralPreferences(defaultPrefs.getConfig(), null, null);
@@ -554,31 +537,6 @@ public class StoredPreferences {
}
}
private static Map<String, String> urlAliases(Config cfg) {
HashMap<String, String> urlAliases = new HashMap<>();
for (String subsection : cfg.getSubsections(URL_ALIAS)) {
urlAliases.put(
cfg.getString(URL_ALIAS, subsection, KEY_MATCH),
cfg.getString(URL_ALIAS, subsection, KEY_TOKEN));
}
return !urlAliases.isEmpty() ? urlAliases : null;
}
private static void setUrlAliases(Config cfg, Map<String, String> urlAliases) {
if (urlAliases != null) {
for (String subsection : cfg.getSubsections(URL_ALIAS)) {
cfg.unsetSection(URL_ALIAS, subsection);
}
int i = 1;
for (Map.Entry<String, String> e : urlAliases.entrySet()) {
cfg.setString(URL_ALIAS, URL_ALIAS + i, KEY_MATCH, e.getKey());
cfg.setString(URL_ALIAS, URL_ALIAS + i, KEY_TOKEN, e.getValue());
i++;
}
}
}
private static void unsetSection(Config cfg, String section) {
cfg.unsetSection(section, null);
for (String subsection : cfg.getSubsections(section)) {

View File

@@ -25,9 +25,6 @@ public class UserConfigSections {
public static final String KEY_URL = "url";
public static final String KEY_TARGET = "target";
public static final String KEY_ID = "id";
public static final String URL_ALIAS = "urlAlias";
public static final String KEY_MATCH = "match";
public static final String KEY_TOKEN = "token";
/** The table column user preferences. */
public static final String CHANGE_TABLE = "changeTable";

View File

@@ -66,16 +66,11 @@ import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import org.eclipse.jgit.lib.Config;
public class GetServerInfo implements RestReadView<ConfigResource> {
private static final String URL_ALIAS = "urlAlias";
private static final String KEY_MATCH = "match";
private static final String KEY_TOKEN = "token";
private final Config config;
private final AccountVisibilityProvider accountVisibilityProvider;
private final AuthConfig authConfig;
@@ -152,9 +147,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
info.sshd = getSshdInfo();
info.suggest = getSuggestInfo();
Map<String, String> urlAliases = getUrlAliasesInfo();
info.urlAliases = !urlAliases.isEmpty() ? urlAliases : null;
info.user = getUserInfo();
info.receive = getReceiveInfo();
return Response.ok(info);
@@ -347,16 +339,6 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
return null;
}
private Map<String, String> getUrlAliasesInfo() {
Map<String, String> urlAliases = new HashMap<>();
for (String subsection : config.getSubsections(URL_ALIAS)) {
urlAliases.put(
config.getString(URL_ALIAS, subsection, KEY_MATCH),
config.getString(URL_ALIAS, subsection, KEY_TOKEN));
}
return urlAliases;
}
private SshdInfo getSshdInfo() {
String[] addr = config.getStringList("sshd", null, "listenAddress");
if (addr.length == 1 && isOff(addr[0])) {

View File

@@ -38,7 +38,6 @@ import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.inject.Inject;
import com.google.inject.util.Providers;
import java.util.ArrayList;
import java.util.HashMap;
import org.junit.Before;
import org.junit.Test;
@@ -90,8 +89,6 @@ public class GeneralPreferencesIT extends AbstractDaemonTest {
i.my.add(new MenuItem("name", "url"));
i.changeTable = new ArrayList<>();
i.changeTable.add("Status");
i.urlAliases = new HashMap<>();
i.urlAliases.put("foo", "bar");
o = gApi.accounts().id(user42.id().toString()).setPreferences(i);
assertPrefs(o, i, "my");