Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
8aac35d4
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
提交
8aac35d4
编写于
9月 06, 2014
作者:
D
Daniel Beck
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1380 from daniel-beck/JENKINS-6153
[FIXED JENKINS-6153] Add description for label atoms
上级
c49649bc
f8638bab
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
57 addition
and
30 deletion
+57
-30
core/src/main/java/hudson/model/Label.java
core/src/main/java/hudson/model/Label.java
+7
-0
core/src/main/java/hudson/model/labels/LabelAtom.java
core/src/main/java/hudson/model/labels/LabelAtom.java
+36
-28
core/src/main/resources/hudson/model/AbstractModelObject/descriptionForm.jelly
...es/hudson/model/AbstractModelObject/descriptionForm.jelly
+2
-2
core/src/main/resources/hudson/model/Label/index.jelly
core/src/main/resources/hudson/model/Label/index.jelly
+4
-0
core/src/main/resources/hudson/model/Label/sidepanel.jelly
core/src/main/resources/hudson/model/Label/sidepanel.jelly
+3
-0
core/src/main/resources/hudson/model/labels/LabelAtom/configure.jelly
...n/resources/hudson/model/labels/LabelAtom/configure.jelly
+5
-0
未找到文件。
core/src/main/java/hudson/model/Label.java
浏览文件 @
8aac35d4
...
...
@@ -142,6 +142,13 @@ public abstract class Label extends Actionable implements Comparable<Label>, Mod
return
getUrl
();
}
/**
* Returns true iff this label is an atom.
*
* @since TODO
*/
public
boolean
isAtom
()
{
return
false
;
}
/**
* Evaluates whether the label expression is true given the specified value assignment.
* IOW, returns true if the assignment provided by the resolver matches this label expression.
...
...
core/src/main/java/hudson/model/labels/LabelAtom.java
浏览文件 @
8aac35d4
...
...
@@ -33,15 +33,13 @@ import hudson.XmlFile;
import
hudson.model.Action
;
import
hudson.model.Descriptor.FormException
;
import
hudson.model.Failure
;
import
hudson.util.
EditDistance
;
import
hudson.util.
*
;
import
jenkins.model.Jenkins
;
import
hudson.model.Label
;
import
hudson.model.Saveable
;
import
hudson.model.listeners.SaveableListener
;
import
hudson.util.DescribableList
;
import
hudson.util.QuotedStringTokenizer
;
import
hudson.util.VariableResolver
;
import
hudson.util.XStream2
;
import
org.kohsuke.accmod.Restricted
;
import
org.kohsuke.accmod.restrictions.DoNotUse
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerResponse
;
import
org.kohsuke.stapler.export.Exported
;
...
...
@@ -73,6 +71,8 @@ public class LabelAtom extends Label implements Saveable {
@CopyOnWrite
protected
transient
volatile
List
<
Action
>
transientActions
=
new
Vector
<
Action
>();
private
String
description
;
public
LabelAtom
(
String
name
)
{
super
(
name
);
}
...
...
@@ -85,6 +85,9 @@ public class LabelAtom extends Label implements Saveable {
return
escape
(
name
);
}
@Override
public
boolean
isAtom
()
{
return
true
;
}
/**
* {@inheritDoc}
*
...
...
@@ -106,33 +109,24 @@ public class LabelAtom extends Label implements Saveable {
protected
void
updateTransientActions
()
{
Vector
<
Action
>
ta
=
new
Vector
<
Action
>();
// add the config link
if
(!
getApplicablePropertyDescriptors
().
isEmpty
())
{
// if there's no property descriptor, there's nothing interesting to configure.
ta
.
add
(
new
Action
()
{
public
String
getIconFileName
()
{
if
(
Jenkins
.
getInstance
().
hasPermission
(
Jenkins
.
ADMINISTER
))
return
"setting.png"
;
else
return
null
;
}
public
String
getDisplayName
()
{
return
"Configure"
;
}
public
String
getUrlName
()
{
return
"configure"
;
}
});
}
for
(
LabelAtomProperty
p
:
properties
)
ta
.
addAll
(
p
.
getActions
(
this
));
transientActions
=
ta
;
}
/**
* @since TODO
*/
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
throws
IOException
{
this
.
description
=
description
;
save
();
}
/**
* Properties associated with this label.
*/
...
...
@@ -210,11 +204,25 @@ public class LabelAtom extends Label implements Saveable {
app
.
checkPermission
(
Jenkins
.
ADMINISTER
);
properties
.
rebuild
(
req
,
req
.
getSubmittedForm
(),
getApplicablePropertyDescriptors
());
this
.
description
=
req
.
getSubmittedForm
().
getString
(
"description"
);
updateTransientActions
();
save
();
// take the user back to the label top page.
rsp
.
sendRedirect2
(
"."
);
FormApply
.
success
(
"."
).
generateResponse
(
req
,
rsp
,
null
);
}
/**
* Accepts the new description.
*/
@RequirePOST
@Restricted
(
DoNotUse
.
class
)
public
synchronized
void
doSubmitDescription
(
StaplerRequest
req
,
StaplerResponse
rsp
)
throws
IOException
,
ServletException
{
Jenkins
.
getInstance
().
checkPermission
(
Jenkins
.
ADMINISTER
);
setDescription
(
req
.
getParameter
(
"description"
));
rsp
.
sendRedirect
(
"."
);
// go to the top page
}
/**
...
...
core/src/main/resources/hudson/model/AbstractModelObject/descriptionForm.jelly
浏览文件 @
8aac35d4
...
...
@@ -27,8 +27,8 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:f="/lib/form" xmlns:l="/lib/layout">
<j:if test="${it.
primaryView
!= null}">
<j:set var="it" value="${it.
primaryView
}"/>
<j:if test="${it.
getPrimaryView()
!= null}">
<j:set var="it" value="${it.
getPrimaryView()
}"/>
</j:if>
<l:ajax>
<form action="submitDescription" method="post">
...
...
core/src/main/resources/hudson/model/Label/index.jelly
浏览文件 @
8aac35d4
...
...
@@ -32,6 +32,10 @@ THE SOFTWARE.
${it.name}
</h1>
<j:if test="${it.atom}">
<t:editableDescription permission="${app.ADMINISTER}"/>
</j:if>
<j:forEach var="a" items="${it.actions}">
<st:include page="summary.jelly" from="${a}" optional="true" it="${a}" />
</j:forEach>
...
...
core/src/main/resources/hudson/model/Label/sidepanel.jelly
浏览文件 @
8aac35d4
...
...
@@ -33,6 +33,9 @@ THE SOFTWARE.
<j:set var="url" value="${h.getNearestAncestorUrl(request,it)}"/>
<l:task contextMenu="false" href="${rootURL}/" icon="icon-up icon-md" title="${%Back to Dashboard}"/>
<l:task contextMenu="false" href="${url}" icon="icon-attribute icon-md" title="${%Overview}"/>
<j:if test="${it.atom}">
<l:task href="${url}/configure" icon="icon-setting icon-md" title="${%Configure}" permission="${app.ADMINISTER}" />
</j:if>
<l:task href="${url}/load-statistics" icon="icon-monitor icon-md" title="${%Load Statistics}"/>
<st:include page="actions.jelly" />
</l:tasks>
...
...
core/src/main/resources/hudson/model/labels/LabelAtom/configure.jelly
浏览文件 @
8aac35d4
...
...
@@ -37,10 +37,15 @@ THE SOFTWARE.
<f:textbox value="${it.name}" readonly="true" />
</f:entry>
<f:entry title="${%Description}">
<f:textarea name="description" value="${it.description}" codemirror-mode="${app.markupFormatter.codeMirrorMode}" codemirror-config="${app.markupFormatter.codeMirrorConfig}" previewEndpoint="/markupFormatter/previewDescription"/>
</f:entry>
<f:descriptorList descriptors="${it.getApplicablePropertyDescriptors()}" instances="${it.properties}" />
<f:block>
<f:submit value="${%Save}"/>
<f:apply />
</f:block>
</f:form>
<st:adjunct includes="lib.form.confirm" />
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录