Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
6ea31cb7
Commit
6ea31cb7
authored
May 01, 2018
by
Kamil Trzciński
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stages_ajax endpoint to serve old HTML
parent
f7dccbb7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
3 deletions
+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
No files found.
app/controllers/projects/pipelines_controller.rb
View file @
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
View file @
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
View file @
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
View file @
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'
))
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment