Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
e1837ec7
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e1837ec7
编写于
3月 30, 2011
作者:
K
Kohsuke Kawaguchi
提交者:
Stephen Connolly
3月 31, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Actions can now override their rendering in the parent model object.
上级
f4132a57
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
75 addition
and
7 deletion
+75
-7
changelog.html
changelog.html
+2
-1
core/src/main/java/hudson/model/Action.java
core/src/main/java/hudson/model/Action.java
+14
-0
core/src/main/java/hudson/model/Hudson.java
core/src/main/java/hudson/model/Hudson.java
+5
-2
core/src/main/resources/lib/hudson/actions.jelly
core/src/main/resources/lib/hudson/actions.jelly
+7
-4
test/src/test/java/lib/hudson/ActionsTest.java
test/src/test/java/lib/hudson/ActionsTest.java
+42
-0
test/src/test/resources/lib/hudson/ActionsTest/RootActionImpl/action.jelly
...ources/lib/hudson/ActionsTest/RootActionImpl/action.jelly
+5
-0
未找到文件。
changelog.html
浏览文件 @
e1837ec7
...
...
@@ -58,7 +58,6 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
>
<li
class=
bug
>
PAM authentication fails to restore group membership information on "remember me" tokens.
(
<a
href=
"http://issues.jenkins-ci.org/browse/JENKINS-9094"
>
issue 9094
</a>
)
...
...
@@ -66,6 +65,8 @@ Upcoming changes</a>
Added an extension point to allow adding transient actions to computers.
<li
class=
rfe
>
Added an extension point to allow associating custom properties with views.
<li
class=
rfe
>
Actions can now override their rendering in the parent model object.
</ul>
</div>
<!--=TRUNK-END=-->
...
...
core/src/main/java/hudson/model/Action.java
浏览文件 @
e1837ec7
...
...
@@ -39,6 +39,7 @@ import hudson.tasks.test.TestResultProjectAction;
* while others do the former without the latter (for example, to just draw some graphs in <tt>floatingBox.jelly</tt>),
* and still some others do both.
*
* <h2>Views</h2>
* <p>
* If an action has a view named <tt>floatingBox.jelly</tt>,
* it will be displayed as a floating box on the top page of
...
...
@@ -46,6 +47,19 @@ import hudson.tasks.test.TestResultProjectAction;
* the JUnit test result trend shows up in the project top page.
* See {@link TestResultProjectAction}.
*
* <p>
* On the target {@link ModelObject} page, actions are rendered as an item in the side panel
* by the "/lib/hudson:actions" jelly tag, but you can override this for your action by
* writing {@code action.jelly}. See the "actions" tag for what the default handling is and
* tweak from there. One of the use cases of this is to show nested actions, like where
* Jenkins show the option to wipe out the workspace inside the workspace link:
*
* <pre>
* <l:task icon="images/24x24/folder.gif" href="${url}/ws/" title="${%Workspace}">
* <l:task icon="images/24x24/folder-delete.gif" href="${url}/wipeOutWorkspace" title="${%Wipe Out Workspace}" />
* </l:task>
* </pre>
*
* <h2>Persistence</h2>
* <p>
* Actions are often persisted as a part of {@link Actionable}
...
...
core/src/main/java/hudson/model/Hudson.java
浏览文件 @
e1837ec7
...
...
@@ -2388,9 +2388,12 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
}
public
Object
getDynamic
(
String
token
)
{
for
(
Action
a
:
getActions
())
if
(
a
.
getUrlName
().
equals
(
token
)
||
a
.
getUrlName
().
equals
(
'/'
+
token
))
for
(
Action
a
:
getActions
())
{
String
url
=
a
.
getUrlName
();
if
(
url
==
null
)
continue
;
if
(
url
.
equals
(
token
)
||
url
.
equals
(
'/'
+
token
))
return
a
;
}
for
(
Action
a
:
getManagementLinks
())
if
(
a
.
getUrlName
().
equals
(
token
))
return
a
;
...
...
core/src/main/resources/lib/hudson/actions.jelly
浏览文件 @
e1837ec7
...
...
@@ -27,9 +27,12 @@ THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:forEach var="action" items="${it.actions}">
<j:if test="${action.iconFileName!=null}">
<l:task icon="${h.getIconFilePath(action)}" title="${action.displayName}"
href="${h.getActionUrl(it.url,action)}" />
</j:if>
<!-- allow the action to take over the rendering, but otherwise fall back to the default -->
<st:include page="action.jelly" from="${action}" optional="true">
<j:if test="${action.iconFileName!=null}">
<l:task icon="${h.getIconFilePath(action)}" title="${action.displayName}"
href="${h.getActionUrl(it.url,action)}" />
</j:if>
</st:include>
</j:forEach>
</j:jelly>
\ No newline at end of file
test/src/test/java/lib/hudson/ActionsTest.java
0 → 100644
浏览文件 @
e1837ec7
/*
* The MIT License
*
* Copyright (c) 2011, CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
lib.hudson
;
import
hudson.model.InvisibleAction
;
import
hudson.model.RootAction
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.TestExtension
;
/**
* @author Kohsuke Kawaguchi
*/
public
class
ActionsTest
extends
HudsonTestCase
{
public
void
testOverride
()
throws
Exception
{
assertNotNull
(
createWebClient
().
goTo
(
""
).
getElementById
(
"bravo"
));
}
@TestExtension
public
static
class
RootActionImpl
extends
InvisibleAction
implements
RootAction
{
}
}
test/src/test/resources/lib/hudson/ActionsTest/RootActionImpl/action.jelly
0 → 100644
浏览文件 @
e1837ec7
<j:jelly xmlns:j="jelly:core">
<div>
<b id='bravo'>Bravo</b>
</div>
</j:jelly>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录