Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6ea31cb7
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,体验更适合开发者的 AI 搜索 >>
提交
6ea31cb7
编写于
5月 01, 2018
作者:
K
Kamil Trzciński
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add stages_ajax endpoint to serve old HTML
上级
f7dccbb7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
48 addition
and
3 deletion
+48
-3
app/controllers/projects/pipelines_controller.rb
app/controllers/projects/pipelines_controller.rb
+9
-0
app/views/shared/_mini_pipeline_graph.html.haml
app/views/shared/_mini_pipeline_graph.html.haml
+1
-1
config/routes/project.rb
config/routes/project.rb
+1
-0
spec/controllers/projects/pipelines_controller_spec.rb
spec/controllers/projects/pipelines_controller_spec.rb
+37
-2
未找到文件。
app/controllers/projects/pipelines_controller.rb
浏览文件 @
6ea31cb7
...
...
@@ -109,6 +109,15 @@ class Projects::PipelinesController < Projects::ApplicationController
.
represent
(
@stage
,
details:
true
)
end
# TODO: This endpoint is used by mini-pipeline-graph
# TODO: This endpoint should be migrated to `stage.json`
def
stage_ajax
@stage
=
pipeline
.
legacy_stage
(
params
[
:stage
])
return
not_found
unless
@stage
render
json:
{
html:
view_to_html_string
(
'projects/pipelines/_stage'
))
}
end
def
retry
pipeline
.
retry_failed
(
current_user
)
...
...
app/views/shared/_mini_pipeline_graph.html.haml
浏览文件 @
6ea31cb7
...
...
@@ -6,7 +6,7 @@
-
status_klass
=
"ci-status-icon ci-status-icon-
#{
detailed_status
.
group
}
"
.stage-container.dropdown
{
class:
klass
}
%button
.mini-pipeline-graph-dropdown-toggle.has-tooltip.js-builds-dropdown-button
{
class:
"ci-status-icon-#{detailed_status.group}"
,
type:
'button'
,
data:
{
toggle:
'dropdown'
,
title:
"#{stage.name}: #{detailed_status.label}"
,
placement:
'top'
,
"stage-endpoint"
=>
stage_project_pipeline_path
(
pipeline
.
project
,
pipeline
,
stage:
stage
.
name
)
}
}
%button
.mini-pipeline-graph-dropdown-toggle.has-tooltip.js-builds-dropdown-button
{
class:
"ci-status-icon-#{detailed_status.group}"
,
type:
'button'
,
data:
{
toggle:
'dropdown'
,
title:
"#{stage.name}: #{detailed_status.label}"
,
placement:
'top'
,
"stage-endpoint"
=>
stage_
ajax_
project_pipeline_path
(
pipeline
.
project
,
pipeline
,
stage:
stage
.
name
)
}
}
=
sprite_icon
(
icon_status
)
=
icon
(
'caret-down'
)
...
...
config/routes/project.rb
浏览文件 @
6ea31cb7
...
...
@@ -183,6 +183,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
member
do
get
:stage
get
:stage_ajax
post
:cancel
post
:retry
get
:builds
...
...
spec/controllers/projects/pipelines_controller_spec.rb
浏览文件 @
6ea31cb7
...
...
@@ -109,8 +109,7 @@ describe Projects::PipelinesController do
it
'returns html source for stage dropdown'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'projects/pipelines/_stage'
)
expect
(
json_response
).
to
include
(
'html'
)
expect
(
response
).
to
match_response_schema
(
'pipeline_stage'
)
end
end
...
...
@@ -133,6 +132,42 @@ describe Projects::PipelinesController do
end
end
describe
'GET stages_ajax.json'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
context
'when accessing existing stage'
do
before
do
create
(
:ci_build
,
pipeline:
pipeline
,
stage:
'build'
)
get_stage_ajax
(
'build'
)
end
it
'returns html source for stage dropdown'
do
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
'projects/pipelines/_stage'
)
expect
(
json_response
).
to
include
(
'html'
)
end
end
context
'when accessing unknown stage'
do
before
do
get_stage_ajax
(
'test'
)
end
it
'responds with not found'
do
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
def
get_stage_ajax
(
name
)
get
:stage_ajax
,
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
pipeline
.
id
,
stage:
name
,
format: :json
end
end
describe
'GET status.json'
do
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
)
}
let
(
:status
)
{
pipeline
.
detailed_status
(
double
(
'user'
))
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录