Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
ed4ec0da
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ed4ec0da
编写于
12月 05, 2016
作者:
G
Grzegorz Bizon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for detailed status to status helpers
上级
5e3cfe2f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
24 deletion
+36
-24
app/helpers/ci_status_helper.rb
app/helpers/ci_status_helper.rb
+32
-21
app/views/projects/ci/pipelines/_pipeline.html.haml
app/views/projects/ci/pipelines/_pipeline.html.haml
+3
-2
app/views/projects/pipelines/_info.html.haml
app/views/projects/pipelines/_info.html.haml
+1
-1
未找到文件。
app/helpers/ci_status_helper.rb
浏览文件 @
ed4ec0da
...
@@ -6,7 +6,8 @@ module CiStatusHelper
...
@@ -6,7 +6,8 @@ module CiStatusHelper
def
ci_status_with_icon
(
status
,
target
=
nil
)
def
ci_status_with_icon
(
status
,
target
=
nil
)
content
=
ci_icon_for_status
(
status
)
+
ci_label_for_status
(
status
)
content
=
ci_icon_for_status
(
status
)
+
ci_label_for_status
(
status
)
klass
=
"ci-status ci-
#{
status
}
"
klass
=
"ci-status ci-
#{
status
}
"
# TODO, add support for detailed status
if
target
if
target
link_to
content
,
target
,
class:
klass
link_to
content
,
target
,
class:
klass
else
else
...
@@ -15,11 +16,13 @@ module CiStatusHelper
...
@@ -15,11 +16,13 @@ module CiStatusHelper
end
end
def
ci_label_for_status
(
status
)
def
ci_label_for_status
(
status
)
if
detailed_status?
(
status
)
return
status
.
label
end
case
status
case
status
when
'success'
when
'success'
'passed'
'passed'
when
'success_with_warnings'
'passed with warnings'
else
else
status
status
end
end
...
@@ -32,25 +35,27 @@ module CiStatusHelper
...
@@ -32,25 +35,27 @@ module CiStatusHelper
def
ci_icon_for_status
(
status
)
def
ci_icon_for_status
(
status
)
icon_name
=
icon_name
=
case
status
if
detailed_status?
(
status
)
when
'success'
status
.
icon
'icon_status_success'
when
'success_with_warnings'
'icon_status_warning'
when
'failed'
'icon_status_failed'
when
'pending'
'icon_status_pending'
when
'running'
'icon_status_running'
when
'play'
'icon_play'
when
'created'
'icon_status_created'
when
'skipped'
'icon_status_skipped'
else
else
'icon_status_canceled'
case
status
when
'success'
'icon_status_success'
when
'failed'
'icon_status_failed'
when
'pending'
'icon_status_pending'
when
'running'
'icon_status_running'
when
'play'
'icon_play'
when
'created'
'icon_status_created'
when
'skipped'
'icon_status_skipped'
else
'icon_status_canceled'
end
end
end
custom_icon
(
icon_name
)
custom_icon
(
icon_name
)
...
@@ -94,4 +99,10 @@ module CiStatusHelper
...
@@ -94,4 +99,10 @@ module CiStatusHelper
class:
klass
,
title:
title
,
data:
data
class:
klass
,
title:
title
,
data:
data
end
end
end
end
def
detailed_status?
(
status
)
status
.
respond_to?
(
:text
)
&&
status
.
respond_to?
(
:label
)
&&
status
.
respond_to?
(
:icon
)
end
end
end
app/views/projects/ci/pipelines/_pipeline.html.haml
浏览文件 @
ed4ec0da
-
status
=
pipeline
.
status
-
status
=
pipeline
.
status
-
detailed_status
=
pipeline
.
detailed_status
-
show_commit
=
local_assigns
.
fetch
(
:show_commit
,
true
)
-
show_commit
=
local_assigns
.
fetch
(
:show_commit
,
true
)
-
show_branch
=
local_assigns
.
fetch
(
:show_branch
,
true
)
-
show_branch
=
local_assigns
.
fetch
(
:show_branch
,
true
)
%tr
.commit
%tr
.commit
%td
.commit-link
%td
.commit-link
=
link_to
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
),
class:
"ci-status ci-
#{
status
}
"
do
=
link_to
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
),
class:
"ci-status ci-
#{
status
}
"
do
=
ci_icon_for_status
(
status
)
=
ci_icon_for_status
(
detailed_
status
)
=
ci_label_for_status
(
status
)
=
ci_label_for_status
(
detailed_
status
)
%td
%td
=
link_to
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
)
do
=
link_to
namespace_project_pipeline_path
(
pipeline
.
project
.
namespace
,
pipeline
.
project
,
pipeline
.
id
)
do
...
...
app/views/projects/pipelines/_info.html.haml
浏览文件 @
ed4ec0da
.page-content-header
.page-content-header
.header-main-content
.header-main-content
=
ci_status_with_icon
(
@pipeline
.
status
)
=
ci_status_with_icon
(
@pipeline
.
detailed_
status
)
%strong
Pipeline ##{@commit.pipelines.last.id}
%strong
Pipeline ##{@commit.pipelines.last.id}
triggered
#{
time_ago_with_tooltip
(
@commit
.
authored_date
)
}
by
triggered
#{
time_ago_with_tooltip
(
@commit
.
authored_date
)
}
by
=
author_avatar
(
@commit
,
size:
24
)
=
author_avatar
(
@commit
,
size:
24
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录