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
ec970763
Commit
ec970763
authored
7 years ago
by
Filipa Lacerda
Committed by
Jacob Schatz
7 years ago
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');
new
gl
.
Diff
();
new
ZenMode
();
shortcut_handler
=
new
ShortcutsNavigation
();
new
MiniPipelineGraph
({
container
:
'
.js-commit-pipeline-graph
'
,
}).
bindEvents
();
break
;
case
'
projects:commit:pipelines
'
:
new
MiniPipelineGraph
({
container
:
'
.js-
pipeline-table
'
,
container
:
'
.js-
commit-pipeline-graph
'
,
}).
bindEvents
();
break
;
case
'
projects:commits:show
'
:
...
...
This diff is collapsed.
Click to expand it.
app/assets/stylesheets/pages/commits.scss
View file @
ec970763
...
...
@@ -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
* custom merge request message
...
...
This diff is collapsed.
Click to expand it.
app/models/commit.rb
View file @
ec970763
...
...
@@ -231,6 +231,10 @@ class Commit
project
.
pipelines
.
where
(
sha:
sha
)
end
def
latest_pipeline
pipelines
.
last
end
def
status
(
ref
=
nil
)
@statuses
||=
{}
...
...
This diff is collapsed.
Click to expand it.
app/views/projects/commit/_commit_box.html.haml
View file @
ec970763
...
...
@@ -63,15 +63,15 @@
-
if
@commit
.
status
.well-segment.pipeline-info
%div
{
class:
"icon-container
ci-status-icon-#{@commit.status}"
}
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
pipelines
.
last
.
id
)
do
.status-icon-container
{
class:
"
ci-status-icon-#{@commit.status}"
}
=
link_to
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
latest_pipeline
.
id
)
do
=
ci_icon_for_status
(
@commit
.
status
)
Pipeline
=
link_to
"#
#{
@commit
.
pipelines
.
last
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
pipelines
.
last
.
id
),
class:
"monospace"
for
=
link_to
@commit
.
short_id
,
namespace_project_commit_path
(
@project
.
namespace
,
@project
,
@commit
),
class:
"monospace"
%span
.ci-status-label
=
ci_label_for_status
(
@commit
.
status
)
=
link_to
"#
#{
@commit
.
latest_pipeline
.
id
}
"
,
namespace_project_pipeline_path
(
@project
.
namespace
,
@project
,
@commit
.
latest_pipeline
.
id
),
class:
"monospace"
=
ci_label_for_status
(
@commit
.
status
)
-
if
@commit
.
latest_pipeline
.
stages
.
any?
.mr-widget-pipeline-graph
=
render
'shared/mini_pipeline_graph'
,
pipeline:
@commit
.
latest_pipeline
,
klass:
'js-commit-pipeline-graph'
in
=
time_interval_in_words
@commit
.
pipelines
.
total_duration
...
...
This diff is collapsed.
Click to expand it.
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
:
This diff is collapsed.
Click to expand it.
features/steps/project/commits/commits.rb
View file @
ec970763
...
...
@@ -163,7 +163,7 @@ class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
end
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
step
'I search "submodules" commits'
do
...
...
This diff is collapsed.
Click to expand it.
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
This diff is collapsed.
Click to expand it.
spec/models/commit_spec.rb
View file @
ec970763
...
...
@@ -212,6 +212,25 @@ eos
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
context
'without ref argument'
do
before
do
...
...
This diff is collapsed.
Click to expand it.
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
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
context
'viewing a commit'
do
...
...
This diff is collapsed.
Click to expand it.
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