提交 48cb1304 编写于 作者: U Ulli Hafner

Removed "Jenkins" prefix from plugin display names.

Since sorting of plugins in the update manager is based on displayName
this name should not have a common prefix otherwise it's hard to find
a given plugin name.
上级 5155120d
......@@ -45,6 +45,7 @@ import java.util.jar.Manifest;
import java.util.logging.Logger;
import static java.util.logging.Level.WARNING;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.LogFactory;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpResponses;
......@@ -213,7 +214,7 @@ public class PluginWrapper implements Comparable<PluginWrapper>, ModelObject {
}
public String getDisplayName() {
return getLongName();
return StringUtils.removeStart(getLongName(), "Jenkins ");
}
public Api getApi() {
......
......@@ -40,6 +40,7 @@ import jenkins.model.Jenkins;
import jenkins.util.JSONSignatureValidator;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.StaplerRequest;
......@@ -637,8 +638,12 @@ public class UpdateSite {
}
public String getDisplayName() {
if(title!=null) return title;
return name;
String displayName;
if(title!=null)
displayName = title;
else
displayName = name;
return StringUtils.removeStart(displayName, "Jenkins ");
}
/**
......
......@@ -63,7 +63,7 @@ THE SOFTWARE.
<td class="pane">
<div>
<a href="${p.url}">
${p.updateInfo.title?:p.longName}
${p.updateInfo.displayName?:p.displayName}
</a>
</div>
<div class="excerpt">
......
......@@ -16,7 +16,7 @@ updateCenter.post(
"name": "tasks",
"requiredCore": "1.264",
"sha1": "wtzlciUKiMcg90H5CTYkGX6+r8Y=",
"title": "Hudson Task Scanner Plug-in",
"title": "Jenkins Task Scanner Plug-in",
"url": "tasks.jpi",
"version": "2.23"
},
......
......@@ -116,6 +116,9 @@ public class UpdateSiteTest {
assertEquals(new HashSet<String>(Arrays.asList("tasks", "dummy")), data.plugins.keySet());
assertEquals(new URL(url, "tasks.jpi").toString(), data.plugins.get("tasks").url);
assertEquals("http://nowhere.net/dummy.hpi", data.plugins.get("dummy").url);
UpdateSite.Plugin tasksPlugin = data.plugins.get("tasks");
assertEquals("Wrong name of plugin found", "Task Scanner Plug-in", tasksPlugin.getDisplayName());
}
@Test public void updateDirectlyWithJson() throws Exception {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册