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
Tatuya Kamada
gitlab-ce
Commits
ec970763
Commit
ec970763
authored
Mar 16, 2017
by
Filipa Lacerda
Committed by
Jacob Schatz
Mar 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds pipeline mini-graph to system information box in Commit View
parent
acb1b3ee
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
127 additions
and
10 deletions
+127
-10
app/assets/javascripts/dispatcher.js
app/assets/javascripts/dispatcher.js
+4
-1
app/assets/stylesheets/pages/commits.scss
app/assets/stylesheets/pages/commits.scss
+32
-0
app/models/commit.rb
app/models/commit.rb
+4
-0
app/views/projects/commit/_commit_box.html.haml
app/views/projects/commit/_commit_box.html.haml
+7
-7
changelogs/unreleased/28494-mini-pipeline-graph-commit-view.yml
...logs/unreleased/28494-mini-pipeline-graph-commit-view.yml
+4
-0
features/steps/project/commits/commits.rb
features/steps/project/commits/commits.rb
+1
-1
spec/features/projects/commit/mini_pipeline_graph_spec.rb
spec/features/projects/commit/mini_pipeline_graph_spec.rb
+55
-0
spec/models/commit_spec.rb
spec/models/commit_spec.rb
+19
-0
spec/views/projects/commit/_commit_box.html.haml_spec.rb
spec/views/projects/commit/_commit_box.html.haml_spec.rb
+1
-1
No files found.
app/assets/javascripts/dispatcher.js
View file @
ec970763
...
@@ -201,10 +201,13 @@ const UserCallout = require('./user_callout');
...
@@ -201,10 +201,13 @@ const UserCallout = require('./user_callout');
new
gl
.
Diff
();
new
gl
.
Diff
();
new
ZenMode
();
new
ZenMode
();
shortcut_handler
=
new
ShortcutsNavigation
();
shortcut_handler
=
new
ShortcutsNavigation
();
new
MiniPipelineGraph
({
container
:
'
.js-commit-pipeline-graph
'
,
}).
bindEvents
();
break
;
break
;
case
'
projects:commit:pipelines
'
:
case
'
projects:commit:pipelines
'
:
new
MiniPipelineGraph
({
new
MiniPipelineGraph
({
container
:
'
.js-
pipeline-table
'
,
container
:
'
.js-
commit-pipeline-graph
'
,
}).
bindEvents
();
}).
bindEvents
();
break
;
break
;
case
'
projects:commits:show
'
:
case
'
projects:commits:show
'
:
...
...
app/assets/stylesheets/pages/commits.scss
View file @
ec970763
...
@@ -38,6 +38,38 @@
...
@@ -38,6 +38,38 @@
}
}
}
}
.pipeline-info
{
.status-icon-container
{
display
:
inline-block
;
vertical-align
:
middle
;
margin-right
:
3px
;
svg
{
display
:
block
;
width
:
22px
;
height
:
22px
;
}
}
.mr-widget-pipeline-graph
{
display
:
inline-block
;
vertical-align
:
middle
;
margin
:
0
-6px
0
0
;
.dropdown-menu
{
margin-top
:
11px
;
}
}
}
.branch-info
.commit-icon
{
margin-right
:
3px
;
svg
{
top
:
3px
;
}
}
/*
/*
* Commit message textarea for web editor and
* Commit message textarea for web editor and
* custom merge request message
* custom merge request message
...
...
app/models/commit.rb
View file @
ec970763
...
@@ -231,6 +231,10 @@ class Commit
...
@@ -231,6 +231,10 @@ class Commit
project
.
pipelines
.
where
(
sha:
sha
)
project
.
pipelines
.
where
(
sha:
sha
)
end
end
def
latest_pipeline
pipelines
.
last
end
def
status
(
ref
=
nil
)
def
status
(
ref
=
nil
)
@statuses
||=
{}
@statuses
||=
{}
...
...
app/views/projects/commit/_commit_box.html.haml
View file @
ec970763
...
@@ -63,15 +63,15 @@
...
@@ -63,15 +63,15 @@
-
if
@commit
.
status
-
if
@commit
.
status
.well-segment.pipeline-info
.well-segment.pipeline-info
%div
{
class:
"icon-container
ci-status-icon-#{@commit.status}"
}
.status-icon-container
{
class:
"
ci-status-icon-#{@commit.status}"
}
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
pipelines
.
last
.
id
)
do
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
latest_pipeline
.
id
)
do
=
ci_icon_for_status
(
@commit
.
status
)
=
ci_icon_for_status
(
@commit
.
status
)
Pipeline
Pipeline
=
link_to
"#
#{
@commit
.
pipelines
.
last
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
pipelines
.
last
.
id
),
class:
"monospace"
=
link_to
"#
#{
@commit
.
latest_pipeline
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
latest_pipeline
.
id
),
class:
"monospace"
for
=
ci_label_for_status
(
@commit
.
status
)
=
link_to
@commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
),
class:
"monospace"
-
if
@commit
.
latest_pipeline
.
stages
.
any?
%span
.ci-status-label
.mr-widget-pipeline-graph
=
ci_label_for_status
(
@commit
.
status
)
=
render
'shared/mini_pipeline_graph'
,
pipeline:
@commit
.
latest_pipeline
,
klass:
'js-commit-pipeline-graph'
in
in
=
time_interval_in_words
@commit
.
pipelines
.
total_duration
=
time_interval_in_words
@commit
.
pipelines
.
total_duration
...
...
changelogs/unreleased/28494-mini-pipeline-graph-commit-view.yml
0 → 100644
View file @
ec970763
---
title
:
Adds pipeline mini-graph to system information box in Commit View
merge_request
:
author
:
features/steps/project/commits/commits.rb
View file @
ec970763
...
@@ -163,7 +163,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
...
@@ -163,7 +163,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
end
step
'I see commit ci info'
do
step
'I see commit ci info'
do
expect
(
page
).
to
have_content
"Pipeline #1
for 570e7b2a
pending"
expect
(
page
).
to
have_content
"Pipeline #1 pending"
end
end
step
'I search "submodules" commits'
do
step
'I search "submodules" commits'
do
...
...
spec/features/projects/commit/mini_pipeline_graph_spec.rb
0 → 100644
View file @
ec970763
require
'rails_helper'
feature
'Mini Pipeline Graph in Commit View'
,
:js
,
:feature
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
login_as
(
user
)
end
context
'when commit has pipelines'
do
let
(
:pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
ref:
project
.
default_branch
,
sha:
project
.
commit
.
sha
)
end
let
(
:build
)
do
create
(
:ci_build
,
pipeline:
pipeline
)
end
before
do
build
.
run
visit
namespace_project_commit_path
(
project
.
namespace
,
project
,
project
.
commit
.
id
)
end
it
'should display a mini pipeline graph'
do
expect
(
page
).
to
have_selector
(
'.mr-widget-pipeline-graph'
)
end
it
'should show the builds list when stage is clicked'
do
first
(
'.mini-pipeline-graph-dropdown-toggle'
).
click
wait_for_ajax
page
.
within
'.js-builds-dropdown-list'
do
expect
(
page
).
to
have_selector
(
'.ci-status-icon-running'
)
expect
(
page
).
to
have_content
(
build
.
stage
)
end
end
end
context
'when commit does not have pipelines'
do
before
do
visit
namespace_project_commit_path
(
project
.
namespace
,
project
,
project
.
commit
.
id
)
end
it
'should not display a mini pipeline graph'
do
expect
(
page
).
not_to
have_selector
(
'.mr-widget-pipeline-graph'
)
end
end
end
spec/models/commit_spec.rb
View file @
ec970763
...
@@ -212,6 +212,25 @@ eos
...
@@ -212,6 +212,25 @@ eos
end
end
end
end
describe
'#latest_pipeline'
do
let!
(
:first_pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
status:
'success'
)
end
let!
(
:second_pipeline
)
do
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
commit
.
sha
,
status:
'success'
)
end
it
'returns latest pipeline'
do
expect
(
commit
.
latest_pipeline
).
to
eq
second_pipeline
end
end
describe
'#status'
do
describe
'#status'
do
context
'without ref argument'
do
context
'without ref argument'
do
before
do
before
do
...
...
spec/views/projects/commit/_commit_box.html.haml_spec.rb
View file @
ec970763
...
@@ -25,7 +25,7 @@ describe 'projects/commit/_commit_box.html.haml' do
...
@@ -25,7 +25,7 @@ describe 'projects/commit/_commit_box.html.haml' do
render
render
expect
(
rendered
).
to
have_text
(
"Pipeline #
#{
third_pipeline
.
id
}
f
or
#{
Commit
.
truncate_sha
(
project
.
commit
.
sha
)
}
f
ailed"
)
expect
(
rendered
).
to
have_text
(
"Pipeline #
#{
third_pipeline
.
id
}
failed"
)
end
end
context
'viewing a commit'
do
context
'viewing a commit'
do
...
...
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