Remove backend support for HTML UI plugins
Frontend support was removed in change 299364. So there is no point for the backend to send HTML plugins to be loaded to the frontend. :-) Change-Id: I44cc0d15910937de7e1f9b9780a799d4b85b0673
This commit is contained in:
@@ -1941,6 +1941,9 @@ extensions by plugins.
|
||||
|Field Name ||Description
|
||||
|`has_avatars` |not set if `false`|
|
||||
Whether an avatar provider is registered.
|
||||
|`js_resource_paths`||
|
||||
A list of relative paths (strings). Each path points to a frontend plugin that
|
||||
should be loaded, e.g. `plugins/codemirror_editor/static/codemirror_editor.js`.
|
||||
|===========================
|
||||
|
||||
[[receive-info]]
|
||||
|
@@ -19,5 +19,4 @@ import java.util.List;
|
||||
public class PluginConfigInfo {
|
||||
public Boolean hasAvatars;
|
||||
public List<String> jsResourcePaths;
|
||||
public List<String> htmlResourcePaths;
|
||||
}
|
||||
|
@@ -40,8 +40,7 @@ class JsPlugin extends Plugin {
|
||||
String fileName = getSrcFile().getFileName().toString();
|
||||
int firstDash = fileName.indexOf("-");
|
||||
if (firstDash > 0) {
|
||||
int extension =
|
||||
fileName.endsWith(".js") ? fileName.lastIndexOf(".js") : fileName.lastIndexOf(".html");
|
||||
int extension = fileName.lastIndexOf(".js");
|
||||
if (extension > 0) {
|
||||
return fileName.substring(firstDash + 1, extension);
|
||||
}
|
||||
|
@@ -733,7 +733,7 @@ public class PluginLoader implements LifecycleListener {
|
||||
}
|
||||
|
||||
private boolean isUiPlugin(String name) {
|
||||
return isPlugin(name, "js") || isPlugin(name, "html");
|
||||
return isPlugin(name, "js");
|
||||
}
|
||||
|
||||
private boolean isPlugin(String fileName, String ext) {
|
||||
|
@@ -320,17 +320,12 @@ public class GetServerInfo implements RestReadView<ConfigResource> {
|
||||
PluginConfigInfo info = new PluginConfigInfo();
|
||||
info.hasAvatars = toBoolean(avatar.hasImplementation());
|
||||
info.jsResourcePaths = new ArrayList<>();
|
||||
info.htmlResourcePaths = new ArrayList<>();
|
||||
plugins.runEach(
|
||||
plugin -> {
|
||||
String path =
|
||||
String.format(
|
||||
"plugins/%s/%s", plugin.getPluginName(), plugin.getJavaScriptResourcePath());
|
||||
if (path.endsWith(".html")) {
|
||||
info.htmlResourcePaths.add(path);
|
||||
} else {
|
||||
info.jsResourcePaths.add(path);
|
||||
}
|
||||
info.jsResourcePaths.add(path);
|
||||
});
|
||||
return info;
|
||||
}
|
||||
|
@@ -48,18 +48,14 @@ import org.junit.Test;
|
||||
@NoHttpd
|
||||
public class PluginIT extends AbstractDaemonTest {
|
||||
private static final String JS_PLUGIN = "Gerrit.install(function(self){});\n";
|
||||
private static final String HTML_PLUGIN =
|
||||
String.format("<dom-module id=\"test\"><script>%s</script></dom-module>", JS_PLUGIN);
|
||||
private static final RawInput JS_PLUGIN_CONTENT = RawInputUtil.create(JS_PLUGIN.getBytes(UTF_8));
|
||||
private static final RawInput HTML_PLUGIN_CONTENT =
|
||||
RawInputUtil.create(HTML_PLUGIN.getBytes(UTF_8));
|
||||
|
||||
private static final ImmutableList<String> PLUGINS =
|
||||
ImmutableList.of(
|
||||
"plugin-a.js",
|
||||
"plugin-b.html",
|
||||
"plugin-b.js",
|
||||
"plugin-c.js",
|
||||
"plugin-d.html",
|
||||
"plugin-d.js",
|
||||
"plugin-normal.jar",
|
||||
"plugin-empty.jar",
|
||||
"plugin-unset.jar",
|
||||
@@ -97,7 +93,7 @@ public class PluginIT extends AbstractDaemonTest {
|
||||
assertPlugins(list().start(1).limit(2).get(), PLUGINS.subList(1, 3));
|
||||
|
||||
// With prefix
|
||||
assertPlugins(list().prefix("plugin-b").get(), ImmutableList.of("plugin-b.html"));
|
||||
assertPlugins(list().prefix("plugin-b").get(), ImmutableList.of("plugin-b.js"));
|
||||
assertPlugins(list().prefix("PLUGIN-").get(), ImmutableList.of());
|
||||
|
||||
// With substring
|
||||
@@ -105,7 +101,7 @@ public class PluginIT extends AbstractDaemonTest {
|
||||
assertPlugins(list().substring("lugin-").start(1).limit(2).get(), PLUGINS.subList(1, 3));
|
||||
|
||||
// With regex
|
||||
assertPlugins(list().regex(".*in-b").get(), ImmutableList.of("plugin-b.html"));
|
||||
assertPlugins(list().regex(".*in-b").get(), ImmutableList.of("plugin-b.js"));
|
||||
assertPlugins(list().regex("plugin-.*").get(), PLUGINS.subList(0, PLUGINS.size() - 1));
|
||||
assertPlugins(list().regex("plugin-.*").start(1).limit(2).get(), PLUGINS.subList(1, 3));
|
||||
|
||||
@@ -147,7 +143,7 @@ public class PluginIT extends AbstractDaemonTest {
|
||||
com.google.gerrit.extensions.common.InstallPluginInput input =
|
||||
new com.google.gerrit.extensions.common.InstallPluginInput();
|
||||
input.raw = JS_PLUGIN_CONTENT;
|
||||
gApi.plugins().install("legacy.html", input);
|
||||
gApi.plugins().install("legacy.js", input);
|
||||
gApi.plugins().name("legacy").get();
|
||||
}
|
||||
|
||||
@@ -198,9 +194,6 @@ public class PluginIT extends AbstractDaemonTest {
|
||||
if (plugin.endsWith(".js")) {
|
||||
return JS_PLUGIN_CONTENT;
|
||||
}
|
||||
if (plugin.endsWith(".html")) {
|
||||
return HTML_PLUGIN_CONTENT;
|
||||
}
|
||||
assertThat(plugin).endsWith(".jar");
|
||||
return pluginJarContent(plugin);
|
||||
}
|
||||
|
Reference in New Issue
Block a user