Render JS plugins without href on plugin list view
Plugins are linkified on admin plugin list view. If activated, the Documentation for the plugin is shown. Because JS plugins can not have Documentation or other resources that can be activated, render them without href. To have this information on the client side, extend REST API with index_url attribute. Change-Id: I49cab14cc2b01bc4e8cd0c906f4b3bdde1da905c
This commit is contained in:

committed by
Shawn Pearce

parent
d020143837
commit
83c7986122
@@ -83,17 +83,20 @@ public class PluginListScreen extends PluginScreen {
|
||||
}
|
||||
|
||||
void populate(final int row, final PluginInfo plugin) {
|
||||
if (plugin.isDisabled()) {
|
||||
if (plugin.disabled() || plugin.indexUrl() == null) {
|
||||
table.setText(row, 1, plugin.name());
|
||||
} else {
|
||||
table.setWidget(
|
||||
row,
|
||||
1,
|
||||
new Anchor(plugin.name(), Gerrit.selfRedirect("/plugins/"
|
||||
+ plugin.name() + "/"), "_blank"));
|
||||
new Anchor(
|
||||
plugin.name(),
|
||||
Gerrit.selfRedirect(plugin.indexUrl()),
|
||||
"_blank"));
|
||||
}
|
||||
table.setText(row, 2, plugin.version());
|
||||
table.setText(row, 3, plugin.isDisabled() ? Util.C.pluginDisabled()
|
||||
table.setText(row, 3, plugin.disabled()
|
||||
? Util.C.pluginDisabled()
|
||||
: Util.C.pluginEnabled());
|
||||
|
||||
final FlexCellFormatter fmt = table.getFlexCellFormatter();
|
||||
|
@@ -17,11 +17,10 @@ package com.google.gerrit.client.plugins;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
|
||||
public class PluginInfo extends JavaScriptObject {
|
||||
|
||||
public final native String name() /*-{ return this.name; }-*/;
|
||||
public final native String version() /*-{ return this.version; }-*/;
|
||||
public final native boolean isDisabled()
|
||||
/*-{ return this.disabled ? true : false; }-*/;
|
||||
public final native String name() /*-{ return this.name }-*/;
|
||||
public final native String version() /*-{ return this.version }-*/;
|
||||
public final native String indexUrl() /*-{ return this.index_url }-*/;
|
||||
public final native boolean disabled() /*-{ return this.disabled || false }-*/;
|
||||
|
||||
protected PluginInfo() {
|
||||
}
|
||||
|
Reference in New Issue
Block a user