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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
081a0ddc
Commit
081a0ddc
authored
Sep 24, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
827367ea
24e8445a
Changes
20
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
151 additions
and
70 deletions
+151
-70
CHANGELOG
CHANGELOG
+2
-0
app/controllers/ci/charts_controller.rb
app/controllers/ci/charts_controller.rb
+0
-24
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+6
-0
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+11
-0
app/helpers/graph_helper.rb
app/helpers/graph_helper.rb
+4
-1
app/helpers/version_check_helper.rb
app/helpers/version_check_helper.rb
+1
-1
app/views/ci/charts/show.html.haml
app/views/ci/charts/show.html.haml
+0
-4
app/views/help/index.html.haml
app/views/help/index.html.haml
+10
-20
app/views/layouts/ci/_nav_project.html.haml
app/views/layouts/ci/_nav_project.html.haml
+0
-6
app/views/projects/graphs/_head.html.haml
app/views/projects/graphs/_head.html.haml
+4
-0
app/views/projects/graphs/ci.html.haml
app/views/projects/graphs/ci.html.haml
+7
-0
app/views/projects/graphs/ci/_build_times.haml
app/views/projects/graphs/ci/_build_times.haml
+0
-0
app/views/projects/graphs/ci/_builds.haml
app/views/projects/graphs/ci/_builds.haml
+0
-0
app/views/projects/graphs/ci/_overall.haml
app/views/projects/graphs/ci/_overall.haml
+22
-0
config/routes.rb
config/routes.rb
+1
-0
features/project/graph.feature
features/project/graph.feature
+6
-0
features/steps/project/graph.rb
features/steps/project/graph.rb
+20
-2
spec/features/ci/projects_spec.rb
spec/features/ci/projects_spec.rb
+0
-12
spec/helpers/graph_helper_spec.rb
spec/helpers/graph_helper_spec.rb
+16
-0
spec/views/help/index.html.haml_spec.rb
spec/views/help/index.html.haml_spec.rb
+41
-0
No files found.
CHANGELOG
View file @
081a0ddc
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.1.0 (unreleased)
v 8.1.0 (unreleased)
- Show CI status on all pages where commits list is rendered
- Show CI status on all pages where commits list is rendered
- Automatically enable CI when push .gitlab-ci.yml file to repository
- Automatically enable CI when push .gitlab-ci.yml file to repository
- Move CI charts to project graphs area
- Fix cases where Markdown did not render links in activity feed (Stan Hu)
- Fix cases where Markdown did not render links in activity feed (Stan Hu)
- Add first and last to pagination (Zeger-Jan van de Weg)
- Add first and last to pagination (Zeger-Jan van de Weg)
...
@@ -15,6 +16,7 @@ v 8.0.2 (unreleased)
...
@@ -15,6 +16,7 @@ v 8.0.2 (unreleased)
- Fix LDAP attribute mapping
- Fix LDAP attribute mapping
v 8.0.1
v 8.0.1
- Remove git refs used internally by GitLab from network graph (Stan Hu)
- Improve CI migration procedure and documentation
- Improve CI migration procedure and documentation
v 8.0.0
v 8.0.0
...
...
app/controllers/ci/charts_controller.rb
deleted
100644 → 0
View file @
827367ea
module
Ci
class
ChartsController
<
Ci
::
ApplicationController
before_action
:authenticate_user!
before_action
:project
before_action
:authorize_access_project!
before_action
:authorize_manage_project!
layout
'ci/project'
def
show
@charts
=
{}
@charts
[
:week
]
=
Ci
::
Charts
::
WeekChart
.
new
(
@project
)
@charts
[
:month
]
=
Ci
::
Charts
::
MonthChart
.
new
(
@project
)
@charts
[
:year
]
=
Ci
::
Charts
::
YearChart
.
new
(
@project
)
@charts
[
:build_times
]
=
Ci
::
Charts
::
BuildTime
.
new
(
@project
)
end
protected
def
project
@project
=
Ci
::
Project
.
find
(
params
[
:project_id
])
end
end
end
app/controllers/projects/application_controller.rb
View file @
081a0ddc
...
@@ -25,4 +25,10 @@ class Projects::ApplicationController < ApplicationController
...
@@ -25,4 +25,10 @@ class Projects::ApplicationController < ApplicationController
)
)
end
end
end
end
private
def
ci_enabled
return
render_404
unless
@project
.
gitlab_ci?
end
end
end
app/controllers/projects/graphs_controller.rb
View file @
081a0ddc
...
@@ -5,6 +5,7 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -5,6 +5,7 @@ class Projects::GraphsController < Projects::ApplicationController
before_action
:require_non_empty_project
before_action
:require_non_empty_project
before_action
:assign_ref_vars
before_action
:assign_ref_vars
before_action
:authorize_download_code!
before_action
:authorize_download_code!
before_action
:ci_enabled
,
only: :ci
def
show
def
show
respond_to
do
|
format
|
respond_to
do
|
format
|
...
@@ -23,6 +24,16 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -23,6 +24,16 @@ class Projects::GraphsController < Projects::ApplicationController
@commits_per_month
=
@commits_graph
.
commits_per_month
@commits_per_month
=
@commits_graph
.
commits_per_month
end
end
def
ci
ci_project
=
@project
.
gitlab_ci_project
@charts
=
{}
@charts
[
:week
]
=
Ci
::
Charts
::
WeekChart
.
new
(
ci_project
)
@charts
[
:month
]
=
Ci
::
Charts
::
MonthChart
.
new
(
ci_project
)
@charts
[
:year
]
=
Ci
::
Charts
::
YearChart
.
new
(
ci_project
)
@charts
[
:build_times
]
=
Ci
::
Charts
::
BuildTime
.
new
(
ci_project
)
end
private
private
def
fetch_graph
def
fetch_graph
...
...
app/helpers/graph_helper.rb
View file @
081a0ddc
module
GraphHelper
module
GraphHelper
def
get_refs
(
repo
,
commit
)
def
get_refs
(
repo
,
commit
)
refs
=
""
refs
=
""
refs
<<
commit
.
ref_names
(
repo
).
join
(
' '
)
# Commit::ref_names already strips the refs/XXX from important refs (e.g. refs/heads/XXX)
# so anything leftover is internally used by GitLab
commit_refs
=
commit
.
ref_names
(
repo
).
reject
{
|
name
|
name
.
starts_with?
(
'refs/'
)
}
refs
<<
commit_refs
.
join
(
' '
)
# append note count
# append note count
refs
<<
"[
#{
@graph
.
notes
[
commit
.
id
]
}
]"
if
@graph
.
notes
[
commit
.
id
]
>
0
refs
<<
"[
#{
@graph
.
notes
[
commit
.
id
]
}
]"
if
@graph
.
notes
[
commit
.
id
]
>
0
...
...
app/helpers/version_check_helper.rb
View file @
081a0ddc
module
VersionCheckHelper
module
VersionCheckHelper
def
version_status_badge
def
version_status_badge
if
Rails
.
env
.
production?
if
Rails
.
env
.
production?
&&
current_application_settings
.
version_check_enabled
image_tag
VersionCheck
.
new
.
url
image_tag
VersionCheck
.
new
.
url
end
end
end
end
...
...
app/views/ci/charts/show.html.haml
deleted
100644 → 0
View file @
827367ea
#charts
.ci-charts
=
render
'builds'
=
render
'build_times'
=
render
'overall'
app/views/help/index.html.haml
View file @
081a0ddc
%div
%div
%h1
%h1
GitLab
GitLab
Community Edition
-
if
user_signed_in?
%span
=
Gitlab
::
VERSION
%span
=
Gitlab
::
VERSION
%small
=
Gitlab
::
REVISION
%small
=
Gitlab
::
REVISION
-
if
current_application_settings
.
version_check_enabled
=
version_status_badge
=
version_status_badge
%p
.slead
%p
.slead
GitLab is open source software to collaborate on code.
GitLab is open source software to collaborate on code.
%br
%br
Manage git repositories with fine
grained access controls that keep your code secure.
Manage git repositories with fine
-
grained access controls that keep your code secure.
%br
%br
Perform code reviews and enhance collaboration with merge requests.
Perform code reviews and enhance collaboration with merge requests.
%br
%br
...
@@ -33,19 +34,8 @@
...
@@ -33,19 +34,8 @@
.panel-heading
.panel-heading
Quick help
Quick help
%ul
.well-list
%ul
.well-list
%li
%li
=
link_to
'See our website for getting help'
,
promo_url
+
'/getting-help/'
See our website for
%li
=
link_to
'Use the search bar on the top of this page'
,
'#'
,
onclick:
'Shortcuts.focusSearch(event)'
=
link_to
'getting help'
,
promo_url
+
'/getting-help/'
%li
=
link_to
'Use shortcuts'
,
'#'
,
onclick:
'Shortcuts.showHelp(event)'
%li
%li
=
link_to
'Get a support subscription'
,
'https://about.gitlab.com/pricing/'
Use the
%li
=
link_to
'Compare GitLab editions'
,
'https://about.gitlab.com/features/#compare'
=
link_to
'search bar'
,
'#'
,
onclick:
'Shortcuts.focusSearch(event)'
on the top of this page
%li
Use
=
link_to
'shortcuts'
,
'#'
,
onclick:
'Shortcuts.showHelp(event)'
%li
Get a support
=
link_to
'subscription'
,
'https://about.gitlab.com/pricing/'
%li
=
link_to
'Compare'
,
'https://about.gitlab.com/features/#compare'
GitLab editions
app/views/layouts/ci/_nav_project.html.haml
View file @
081a0ddc
...
@@ -10,12 +10,6 @@
...
@@ -10,12 +10,6 @@
%span
%span
Commits
Commits
%span
.count
=
@project
.
commits
.
count
%span
.count
=
@project
.
commits
.
count
-
if
can?
(
current_user
,
:admin_project
,
gl_project
)
=
nav_link
path:
'charts#show'
do
=
link_to
ci_project_charts_path
(
@project
)
do
=
icon
(
'bar-chart fw'
)
%span
Charts
=
nav_link
path:
[
'runners#index'
,
'runners#show'
,
'runners#edit'
]
do
=
nav_link
path:
[
'runners#index'
,
'runners#show'
,
'runners#edit'
]
do
=
link_to
ci_project_runners_path
(
@project
)
do
=
link_to
ci_project_runners_path
(
@project
)
do
=
icon
(
'cog fw'
)
=
icon
(
'cog fw'
)
...
...
app/views/projects/graphs/_head.html.haml
View file @
081a0ddc
...
@@ -3,3 +3,7 @@
...
@@ -3,3 +3,7 @@
=
link_to
'Contributors'
,
namespace_project_graph_path
=
link_to
'Contributors'
,
namespace_project_graph_path
=
nav_link
(
action: :commits
)
do
=
nav_link
(
action: :commits
)
do
=
link_to
'Commits'
,
commits_namespace_project_graph_path
=
link_to
'Commits'
,
commits_namespace_project_graph_path
-
if
@project
.
gitlab_ci?
=
nav_link
(
action: :ci
)
do
=
link_to
ci_namespace_project_graph_path
do
Continuous Integration
app/views/projects/graphs/ci.html.haml
0 → 100644
View file @
081a0ddc
-
page_title
"Continuous Integration"
,
"Graphs"
=
render
"header_title"
=
render
'head'
#charts
.ci-charts
=
render
'projects/graphs/ci/builds'
=
render
'projects/graphs/ci/build_times'
=
render
'projects/graphs/ci/overall'
app/views/
ci/charts
/_build_times.haml
→
app/views/
projects/graphs/ci
/_build_times.haml
View file @
081a0ddc
File moved
app/views/
ci/charts
/_builds.haml
→
app/views/
projects/graphs/ci
/_builds.haml
View file @
081a0ddc
File moved
app/views/
ci/charts
/_overall.haml
→
app/views/
projects/graphs/ci
/_overall.haml
View file @
081a0ddc
-
ci_project
=
@project
.
gitlab_ci_project
%fieldset
%fieldset
%legend
Overall
%legend
Overall
%p
%p
Total:
Total:
%strong
=
pluralize
@
project
.
builds
.
count
(
:all
),
'build'
%strong
=
pluralize
ci_
project
.
builds
.
count
(
:all
),
'build'
%p
%p
Successful:
Successful:
%strong
=
pluralize
@
project
.
builds
.
success
.
count
(
:all
),
'build'
%strong
=
pluralize
ci_
project
.
builds
.
success
.
count
(
:all
),
'build'
%p
%p
Failed:
Failed:
%strong
=
pluralize
@
project
.
builds
.
failed
.
count
(
:all
),
'build'
%strong
=
pluralize
ci_
project
.
builds
.
failed
.
count
(
:all
),
'build'
%p
%p
Success ratio:
Success ratio:
%strong
%strong
#{
success_ratio
(
@project
.
builds
.
success
,
@
project
.
builds
.
failed
)
}
%
#{
success_ratio
(
ci_project
.
builds
.
success
,
ci_
project
.
builds
.
failed
)
}
%
%p
%p
Commits covered:
Commits covered:
%strong
%strong
=
@
project
.
commits
.
count
(
:all
)
=
ci_
project
.
commits
.
count
(
:all
)
config/routes.rb
View file @
081a0ddc
...
@@ -511,6 +511,7 @@ Gitlab::Application.routes.draw do
...
@@ -511,6 +511,7 @@ Gitlab::Application.routes.draw do
resources
:graphs
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!json$))+/
,
format:
/json/
}
do
resources
:graphs
,
only:
[
:show
],
constraints:
{
id:
/(?:[^.]|\.(?!json$))+/
,
format:
/json/
}
do
member
do
member
do
get
:commits
get
:commits
get
:ci
end
end
end
end
...
...
features/project/graph.feature
View file @
081a0ddc
...
@@ -12,3 +12,9 @@ Feature: Project Graph
...
@@ -12,3 +12,9 @@ Feature: Project Graph
Scenario
:
I
should see project commits graphs
Scenario
:
I
should see project commits graphs
When
I visit project
"Shop"
commits graph page
When
I visit project
"Shop"
commits graph page
Then
page should have commits graphs
Then
page should have commits graphs
@javascript
Scenario
:
I
should see project ci graphs
Given
project
"Shop"
has CI enabled
When
I visit project
"Shop"
CI graph page
Then
page should have CI graphs
features/steps/project/graph.rb
View file @
081a0ddc
...
@@ -7,12 +7,10 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
...
@@ -7,12 +7,10 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
end
end
When
'I visit project "Shop" graph page'
do
When
'I visit project "Shop" graph page'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
visit
namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
visit
namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
end
end
step
'I visit project "Shop" commits graph page'
do
step
'I visit project "Shop" commits graph page'
do
project
=
Project
.
find_by
(
name:
"Shop"
)
visit
commits_namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
visit
commits_namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
end
end
...
@@ -20,4 +18,24 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
...
@@ -20,4 +18,24 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
expect
(
page
).
to
have_content
"Commit statistics for master"
expect
(
page
).
to
have_content
"Commit statistics for master"
expect
(
page
).
to
have_content
"Commits per day of month"
expect
(
page
).
to
have_content
"Commits per day of month"
end
end
step
'I visit project "Shop" CI graph page'
do
visit
ci_namespace_project_graph_path
(
project
.
namespace
,
project
,
'master'
)
end
step
'project "Shop" has CI enabled'
do
project
.
enable_ci
(
@user
)
end
step
'page should have CI graphs'
do
expect
(
page
).
to
have_content
'Overall'
expect
(
page
).
to
have_content
'Builds chart for last week'
expect
(
page
).
to
have_content
'Builds chart for last month'
expect
(
page
).
to
have_content
'Builds chart for last year'
expect
(
page
).
to
have_content
'Commit duration in minutes for last 30 commits'
end
def
project
project
||=
Project
.
find_by
(
name:
"Shop"
)
end
end
end
spec/features/ci/projects_spec.rb
View file @
081a0ddc
...
@@ -45,16 +45,4 @@ describe "Projects" do
...
@@ -45,16 +45,4 @@ describe "Projects" do
expect
(
find_field
(
'Timeout'
).
value
).
to
eq
'70'
expect
(
find_field
(
'Timeout'
).
value
).
to
eq
'70'
end
end
end
end
describe
"GET /ci/projects/:id/charts"
do
before
do
visit
ci_project_charts_path
(
@project
)
end
it
{
expect
(
page
).
to
have_content
'Overall'
}
it
{
expect
(
page
).
to
have_content
'Builds chart for last week'
}
it
{
expect
(
page
).
to
have_content
'Builds chart for last month'
}
it
{
expect
(
page
).
to
have_content
'Builds chart for last year'
}
it
{
expect
(
page
).
to
have_content
'Commit duration in minutes for last 30 commits'
}
end
end
end
spec/helpers/graph_helper_spec.rb
0 → 100644
View file @
081a0ddc
require
'spec_helper'
describe
GraphHelper
do
describe
'#get_refs'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:commit
)
{
project
.
commit
(
"master"
)
}
let
(
:graph
)
{
Network
::
Graph
.
new
(
project
,
'master'
,
commit
,
''
)
}
it
'filter our refs used by GitLab'
do
allow
(
commit
).
to
receive
(
:ref_names
).
and_return
([
'refs/merge-requests/abc'
,
'master'
,
'refs/tmp/xyz'
])
self
.
instance_variable_set
(
:@graph
,
graph
)
refs
=
get_refs
(
project
.
repository
,
commit
)
expect
(
refs
).
to
eq
(
'master'
)
end
end
end
spec/views/help/index.html.haml_spec.rb
0 → 100644
View file @
081a0ddc
require
'rails_helper'
describe
'help/index'
do
describe
'version information'
do
it
'is hidden from guests'
do
stub_user
(
nil
)
stub_version
(
'8.0.2'
,
'abcdefg'
)
stub_helpers
render
expect
(
rendered
).
not_to
match
'8.0.2'
expect
(
rendered
).
not_to
match
'abcdefg'
end
it
'is shown to users'
do
stub_user
stub_version
(
'8.0.2'
,
'abcdefg'
)
stub_helpers
render
expect
(
rendered
).
to
match
'8.0.2'
expect
(
rendered
).
to
match
'abcdefg'
end
end
def
stub_user
(
user
=
double
)
allow
(
view
).
to
receive
(
:user_signed_in?
).
and_return
(
user
)
end
def
stub_version
(
version
,
revision
)
stub_const
(
'Gitlab::VERSION'
,
version
)
stub_const
(
'Gitlab::REVISION'
,
revision
)
end
def
stub_helpers
allow
(
view
).
to
receive
(
:markdown
).
and_return
(
''
)
allow
(
view
).
to
receive
(
:version_status_badge
).
and_return
(
''
)
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