Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
f46e44bb
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,发现更多精彩内容 >>
提交
f46e44bb
编写于
4月 01, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[FIXED JENKINS-9009] Fixed a bug in handling ' and " in matrix build
label axis
上级
2d3608c2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
62 addition
and
2 deletion
+62
-2
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/Functions.java
core/src/main/java/hudson/Functions.java
+24
-0
core/src/main/java/hudson/matrix/LabelAxis.java
core/src/main/java/hudson/matrix/LabelAxis.java
+22
-0
core/src/main/resources/hudson/matrix/LabelAxis/config.jelly
core/src/main/resources/hudson/matrix/LabelAxis/config.jelly
+2
-2
test/src/test/groovy/hudson/matrix/MatrixProjectTest.groovy
test/src/test/groovy/hudson/matrix/MatrixProjectTest.groovy
+11
-0
未找到文件。
changelog.html
浏览文件 @
f46e44bb
...
...
@@ -67,6 +67,9 @@ Upcoming changes</a>
In matrix security, newly added rows weren't removable
<li
class=
bug
>
Improve the stability of the test harness
<li
class=
bug
>
Fixed a bug in handling ' and " in matrix build label axis
(
<a
href=
"http://issues.jenkins-ci.org/browse/JENKINS-9009"
>
issue 9009
</a>
)
<li
class=
rfe
>
Performance: Specify image sizes for faster page loading
(
<a
href=
"http://issues.jenkins-ci.org/browse/JENKINS-9182"
>
issue 9182
</a>
)
...
...
core/src/main/java/hudson/Functions.java
浏览文件 @
f46e44bb
...
...
@@ -538,6 +538,30 @@ public class Functions {
return
Util
.
xmlEscape
(
s
);
}
public
static
String
htmlAttributeEscape
(
String
text
)
{
StringBuilder
buf
=
new
StringBuilder
(
text
.
length
()+
64
);
for
(
int
i
=
0
;
i
<
text
.
length
();
i
++
)
{
char
ch
=
text
.
charAt
(
i
);
if
(
ch
==
'<'
)
buf
.
append
(
"<"
);
else
if
(
ch
==
'>'
)
buf
.
append
(
">"
);
else
if
(
ch
==
'&'
)
buf
.
append
(
"&"
);
else
if
(
ch
==
'"'
)
buf
.
append
(
"""
);
else
if
(
ch
==
'\''
)
buf
.
append
(
"'"
);
else
buf
.
append
(
ch
);
}
return
buf
.
toString
();
}
public
static
void
checkPermission
(
Permission
permission
)
throws
IOException
,
ServletException
{
checkPermission
(
Hudson
.
getInstance
(),
permission
);
}
...
...
core/src/main/java/hudson/matrix/LabelAxis.java
浏览文件 @
f46e44bb
...
...
@@ -24,9 +24,13 @@
package
hudson.matrix
;
import
hudson.Extension
;
import
hudson.Functions
;
import
hudson.Util
;
import
hudson.model.Hudson
;
import
hudson.model.labels.LabelAtom
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
java.text.MessageFormat
;
import
java.util.List
;
/**
...
...
@@ -45,6 +49,11 @@ public class LabelAxis extends Axis {
return
true
;
}
@Override
public
String
getValueString
()
{
return
Util
.
join
(
getValues
(),
"/"
);
}
@Extension
public
static
class
DescriptorImpl
extends
AxisDescriptor
{
@Override
...
...
@@ -60,5 +69,18 @@ public class LabelAxis extends Axis {
Hudson
h
=
Hudson
.
getInstance
();
return
!
h
.
getNodes
().
isEmpty
()
||
!
h
.
clouds
.
isEmpty
();
}
private
String
jsstr
(
String
body
,
Object
...
args
)
{
return
'\"'
+
Functions
.
jsStringEscape
(
String
.
format
(
body
,
args
))+
'\"'
;
}
public
String
buildLabelCheckBox
(
LabelAtom
la
,
LabelAxis
instance
)
{
return
jsstr
(
"<input type='checkbox' name='values' json='%s' "
,
Functions
.
htmlAttributeEscape
(
la
.
getName
()))
+
String
.
format
(
"+has(%s)+"
,
jsstr
(
la
.
getName
()))
+
jsstr
(
"/><label class='attach-previous'>%s (%s)</label>"
,
la
.
getName
(),
la
.
getDescription
());
// '${h.jsStringEscape('<input type="checkbox" name="values" json="'+h.htmlAttributeEscape(l.name)+'" ')}'+has("${h.jsStringEscape(l.name)}")+'${h.jsStringEscape('/><label class="attach-previous">'+l.name+' ('+l.description+')</label>')}'
}
}
}
core/src/main/resources/hudson/matrix/LabelAxis/config.jelly
浏览文件 @
f46e44bb
...
...
@@ -35,12 +35,12 @@ THE SOFTWARE.
var labels = new YAHOO.widget.TextNode("${%Labels}", tree.getRoot(), false);
var machines = new YAHOO.widget.TextNode("${%Individual nodes}", tree.getRoot(), false);
var values = (e.getAttribute("values") || "").split(
/[ \n]/
);
var values = (e.getAttribute("values") || "").split(
"/"
);
function has(v) {
return values.include(v) ? 'checked="checked" ' : "";
}
<j:forEach var="l" items="${app.labelAtoms}">
new YAHOO.widget.TextNode(
'<input type="checkbox" name="values" json="${l.name}" '+has("${l.name}")+'/><label class="attach-previous">${h.jsStringEscape(l.name)} (${h.jsStringEscape(l.description)})</label>'
, ${l.isSelfLabel()?'machines':'labels'}, false);
new YAHOO.widget.TextNode(
<j:out value="${descriptor.buildLabelCheckBox(l,instance)}"/>
, ${l.isSelfLabel()?'machines':'labels'}, false);
</j:forEach>
tree.draw();
...
...
test/src/test/groovy/hudson/matrix/MatrixProjectTest.groovy
浏览文件 @
f46e44bb
...
...
@@ -279,4 +279,15 @@ public class MatrixProjectTest extends HudsonTestCase {
// expected
}
}
@Bug
(
9009
)
void
testTrickyNodeName
()
{
def
names
=
[
createSlave
(
"Sean's Workstation"
,
null
,
null
),
createSlave
(
"John\"s Workstation"
,
null
,
null
)
]*.
nodeName
;
def
p
=
createMatrixProject
();
p
.
setAxes
(
new
AxisList
([
new
LabelAxis
(
"label"
,
names
)]));
configRoundtrip
(
p
);
LabelAxis
a
=
p
.
axes
.
find
(
"label"
);
assertEquals
(
a
.
values
as
Set
,
names
as
Set
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录