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
Boxiang Sun
gitlab-ce
Commits
42e490ea
Commit
42e490ea
authored
Feb 22, 2017
by
Alex Sanford
Committed by
Clement Ho
Feb 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CSS classes
parent
e051ef69
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
3 deletions
+59
-3
app/helpers/builds_helper.rb
app/helpers/builds_helper.rb
+7
-0
app/views/projects/builds/_header.html.haml
app/views/projects/builds/_header.html.haml
+6
-3
changelogs/unreleased/25920-create-issue-from-failing-build.yml
...logs/unreleased/25920-create-issue-from-failing-build.yml
+4
-0
spec/views/projects/builds/show.html.haml_spec.rb
spec/views/projects/builds/show.html.haml_spec.rb
+42
-0
No files found.
app/helpers/builds_helper.rb
View file @
42e490ea
...
...
@@ -15,4 +15,11 @@ module BuildsHelper
log_state:
@build
.
trace_with_state
[
:state
].
to_s
}
end
def
build_failed_issue_options
{
title:
"Build Failed #
#{
@build
.
id
}
"
,
description:
namespace_project_build_url
(
@project
.
namespace
,
@project
,
@build
)
}
end
end
app/views/projects/builds/_header.html.haml
View file @
42e490ea
.content-block.build-header
.content-block.build-header
.top-area
.header-content
=
render
'ci/status/badge'
,
status:
@build
.
detailed_status
(
current_user
),
link:
false
Job
...
...
@@ -16,7 +16,10 @@
-
if
@build
.
user
=
render
"user"
=
time_ago_with_tooltip
(
@build
.
created_at
)
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary pull-right'
,
method: :post
.nav-controls
-
if
can?
(
current_user
,
:create_issue
,
@project
)
&&
@build
.
failed?
=
link_to
"New issue"
,
new_namespace_project_issue_path
(
@project
.
namespace
,
@project
,
issue:
build_failed_issue_options
),
class:
'btn btn-new btn-inverted'
-
if
can?
(
current_user
,
:update_build
,
@build
)
&&
@build
.
retryable?
=
link_to
"Retry job"
,
retry_namespace_project_build_path
(
@project
.
namespace
,
@project
,
@build
),
class:
'btn btn-inverted-secondary'
,
method: :post
%button
.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle
{
role:
"button"
,
type:
"button"
}
=
icon
(
'angle-double-left'
)
changelogs/unreleased/25920-create-issue-from-failing-build.yml
0 → 100644
View file @
42e490ea
---
title
:
Add button to create issue for failing build
merge_request
:
9391
author
:
Alex Sanford
spec/views/projects/builds/show.html.haml_spec.rb
View file @
42e490ea
...
...
@@ -209,6 +209,10 @@ describe 'projects/builds/show', :view do
it
'does not show retry button'
do
expect
(
rendered
).
not_to
have_link
(
'Retry'
)
end
it
'does not show New issue button'
do
expect
(
rendered
).
not_to
have_link
(
'New issue'
)
end
end
context
'when job is not running'
do
...
...
@@ -220,6 +224,23 @@ describe 'projects/builds/show', :view do
it
'shows retry button'
do
expect
(
rendered
).
to
have_link
(
'Retry'
)
end
context
'if build passed'
do
it
'does not show New issue button'
do
expect
(
rendered
).
not_to
have_link
(
'New issue'
)
end
end
context
'if build failed'
do
before
do
build
.
status
=
'failed'
render
end
it
'shows New issue button'
do
expect
(
rendered
).
to
have_link
(
'New issue'
)
end
end
end
describe
'commit title in sidebar'
do
...
...
@@ -248,4 +269,25 @@ describe 'projects/builds/show', :view do
expect
(
rendered
).
to
have_css
(
'.js-build-value'
,
visible:
false
,
text:
'TRIGGER_VALUE_2'
)
end
end
describe
'New issue button'
do
before
do
build
.
status
=
'failed'
render
end
it
'links to issues/new with the title and description filled in'
do
title
=
"Build Failed #
#{
build
.
id
}
"
build_url
=
namespace_project_build_url
(
project
.
namespace
,
project
,
build
)
href
=
new_namespace_project_issue_path
(
project
.
namespace
,
project
,
issue:
{
title:
title
,
description:
build_url
}
)
expect
(
rendered
).
to
have_link
(
'New issue'
,
href:
href
)
end
end
end
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