提交 a4172953 编写于 作者: K Kohsuke Kawaguchi

Added "manage Jenkins" as a sub-menu to the Jenkins context menu.

上级 d0dbd3b8
...@@ -84,6 +84,8 @@ Upcoming changes</a> ...@@ -84,6 +84,8 @@ Upcoming changes</a>
Added REST API for view manipulation Added REST API for view manipulation
<li class="rfe"> <li class="rfe">
OS X installer now has an Uninstall tool (in /Library/Application Support/Jenkins). OS X installer now has an Uninstall tool (in /Library/Application Support/Jenkins).
<li class=rfe>
Added "manage Jenkins" as a sub-menu to the Jenkins context menu.
<li class=rfe> <li class=rfe>
Executor is exposed to the remote API Executor is exposed to the remote API
(<a href="https://github.com/jenkinsci/jenkins/pull/520">pull 520</a>) (<a href="https://github.com/jenkinsci/jenkins/pull/520">pull 520</a>)
......
...@@ -3024,7 +3024,14 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe ...@@ -3024,7 +3024,14 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
} }
public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws IOException, JellyException { public ContextMenu doContextMenu(StaplerRequest request, StaplerResponse response) throws IOException, JellyException {
return new ContextMenu().from(this,request,response); ContextMenu menu = new ContextMenu().from(this, request, response);
for (MenuItem i : menu.items) {
if (i.url.equals("/manage")) {
// add "Manage Jenkins" subitems
i.subMenu = new ContextMenu().from(this, request, response, "manage");
}
}
return menu;
} }
/** /**
......
...@@ -110,8 +110,12 @@ public interface ModelObjectWithContextMenu extends ModelObject { ...@@ -110,8 +110,12 @@ public interface ModelObjectWithContextMenu extends ModelObject {
* directly to provide alternative semantics. * directly to provide alternative semantics.
*/ */
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response) throws JellyException, IOException { public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response) throws JellyException, IOException {
return from(self,request,response,"sidepanel");
}
public ContextMenu from(ModelObjectWithContextMenu self, StaplerRequest request, StaplerResponse response, String view) throws JellyException, IOException {
WebApp webApp = WebApp.getCurrent(); WebApp webApp = WebApp.getCurrent();
final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript("sidepanel"); final Script s = webApp.getMetaClass(self).getTearOff(JellyClassTearOff.class).findScript(view);
if (s!=null) { if (s!=null) {
JellyFacet facet = webApp.getFacet(JellyFacet.class); JellyFacet facet = webApp.getFacet(JellyFacet.class);
request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us request.setAttribute("taskTags",this); // <l:task> will look for this variable and populate us
......
...@@ -31,6 +31,8 @@ THE SOFTWARE. ...@@ -31,6 +31,8 @@ THE SOFTWARE.
<d:taglib uri="local"> <d:taglib uri="local">
<!-- table to show a map --> <!-- table to show a map -->
<d:tag name="feature"> <d:tag name="feature">
<j:set var="iconUrl" value="${icon.startsWith('/') ? resURL+icon : imagesURL+'/48x48/'+icon}"/>
${taskTags!=null and attrs.contextMenu!='false' ? taskTags.add(href,iconUrl,title) : null}
<t:summary icon="${icon}" <t:summary icon="${icon}"
href="${href}" iconOnly="true"> href="${href}" iconOnly="true">
<div class="link"><a href="${href}">${title}</a></div> <div class="link"><a href="${href}">${title}</a></div>
...@@ -41,7 +43,9 @@ THE SOFTWARE. ...@@ -41,7 +43,9 @@ THE SOFTWARE.
</d:tag> </d:tag>
</d:taglib> </d:taglib>
<st:include page="sidepanel.jelly" /> <j:if test="${!taskTags}">
<st:include page="sidepanel.jelly" />
</j:if>
<l:main-panel> <l:main-panel>
<h1>${%Manage Jenkins}</h1> <h1>${%Manage Jenkins}</h1>
<j:if test="${it.checkURIEncodingEnabled}"> <j:if test="${it.checkURIEncodingEnabled}">
......
...@@ -102,9 +102,12 @@ var breadcrumbs = (function() { ...@@ -102,9 +102,12 @@ var breadcrumbs = (function() {
xhr = new Ajax.Request(combinePath(e.getAttribute("href"),"contextMenu"), { xhr = new Ajax.Request(combinePath(e.getAttribute("href"),"contextMenu"), {
onComplete:function (x) { onComplete:function (x) {
var a = x.responseText.evalJSON().items; var a = x.responseText.evalJSON().items;
a.each(function (e) { function fillMenuItem(e) {
e.text = makeMenuHtml(e.icon, e.displayName); e.text = makeMenuHtml(e.icon, e.displayName);
}); if (e.subMenu!=null)
e.subMenu = {id:"submenu"+(iota++), itemdata:e.subMenu.items.each(fillMenuItem)};
}
a.each(fillMenuItem);
e.items = function() { return a }; e.items = function() { return a };
showMenu(a); showMenu(a);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册