Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
0dd2dbc0
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,发现更多精彩内容 >>
提交
0dd2dbc0
编写于
4月 29, 2015
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
差异文件
[FIXED JENKINS-23197] add timestamp to node-offline message
Merge pull request #1605.
上级
8d3cd91e
15d32562
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
39 addition
and
6 deletion
+39
-6
changelog.html
changelog.html
+3
-0
core/src/main/java/hudson/slaves/OfflineCause.java
core/src/main/java/hudson/slaves/OfflineCause.java
+25
-2
core/src/main/resources/hudson/slaves/OfflineCause/cause.jelly
...src/main/resources/hudson/slaves/OfflineCause/cause.jelly
+9
-2
test/src/test/java/hudson/model/NodeTest.java
test/src/test/java/hudson/model/NodeTest.java
+2
-2
未找到文件。
changelog.html
浏览文件 @
0dd2dbc0
...
...
@@ -55,6 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
rfe
>
add datestamp to node-offline message
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-23917"
>
issue 23917
</a>
)
<li
class=
rfe
>
Larger minimum popup menu height.
(
<a
href=
"https://issues.jenkins-ci.org/browse/JENKINS-27067"
>
issue 27067
</a>
)
...
...
core/src/main/java/hudson/slaves/OfflineCause.java
浏览文件 @
0dd2dbc0
...
...
@@ -29,11 +29,13 @@ import hudson.Functions;
import
hudson.model.Computer
;
import
hudson.model.User
;
import
org.acegisecurity.Authentication
;
import
org.jvnet.localizer.Localizable
;
import
org.kohsuke.stapler.export.ExportedBean
;
import
org.kohsuke.stapler.export.Exported
;
import
javax.annotation.Nonnull
;
import
java.util.Date
;
/**
* Represents a cause that puts a {@linkplain Computer#isOffline() computer offline}.
*
...
...
@@ -41,13 +43,34 @@ import org.kohsuke.stapler.export.Exported;
* <p>
* {@link OfflineCause} must have <tt>cause.jelly</tt> that renders a cause
* into HTML. This is used to tell users why the node is put offline.
* This view should render a block element like DIV.
* This view should render a block element like DIV.
*
* @author Kohsuke Kawaguchi
* @since 1.320
*/
@ExportedBean
public
abstract
class
OfflineCause
{
protected
final
long
timestamp
=
System
.
currentTimeMillis
();
/**
* Timestamp in which the event happened.
*
* @since 1.612
*/
@Exported
public
long
getTimestamp
()
{
return
timestamp
;
}
/**
* Same as {@link #getTimestamp()} but in a different type.
*
* @since 1.612
*/
public
final
@Nonnull
Date
getTime
()
{
return
new
Date
(
timestamp
);
}
/**
* {@link OfflineCause} that renders a static text,
* but without any further UI.
...
...
core/src/main/resources/hudson/slaves/OfflineCause/cause.jelly
浏览文件 @
0dd2dbc0
...
...
@@ -23,6 +23,13 @@ THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<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">
<p class="warning"><j:out value="${it}" /></p>
<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" xmlns:i="jelly:fmt">
<div class="warning">
<div class="timestamp">
<i:formatDate value="${it.time}" type="both" dateStyle="medium" timeStyle="medium"/>
</div>
<div class="message">
<j:out value="${it}" />
</div>
</div>
</j:jelly>
test/src/test/java/hudson/model/NodeTest.java
浏览文件 @
0dd2dbc0
...
...
@@ -103,7 +103,7 @@ public class NodeTest {
computer
.
doToggleOffline
(
"original message"
);
cause
=
(
UserCause
)
computer
.
getOfflineCause
();
assert
Equals
(
"Disconnected by someone@somewhere.com : original message"
,
cause
.
toString
(
));
assert
True
(
cause
.
toString
(),
cause
.
toString
().
matches
(
"^.*?Disconnected by someone@somewhere.com : original message"
));
assertEquals
(
someone
,
cause
.
getUser
());
final
User
root
=
User
.
get
(
"root@localhost"
);
...
...
@@ -111,7 +111,7 @@ public class NodeTest {
computer
.
doChangeOfflineCause
(
"new message"
);
cause
=
(
UserCause
)
computer
.
getOfflineCause
();
assert
Equals
(
"Disconnected by root@localhost : new message"
,
cause
.
toString
(
));
assert
True
(
cause
.
toString
(),
cause
.
toString
().
matches
(
"^.*?Disconnected by root@localhost : new message"
));
assertEquals
(
root
,
cause
.
getUser
());
computer
.
doToggleOffline
(
null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录