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
befff32e
Commit
befff32e
authored
Dec 08, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'languages-graph' into 'master'
Languages graph See merge request !2009
parents
038c9a65
9b20731d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
0 deletions
+70
-0
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+20
-0
app/views/projects/graphs/_head.html.haml
app/views/projects/graphs/_head.html.haml
+2
-0
app/views/projects/graphs/languages.html.haml
app/views/projects/graphs/languages.html.haml
+32
-0
config/routes.rb
config/routes.rb
+1
-0
features/project/graph.feature
features/project/graph.feature
+5
-0
features/steps/project/graph.rb
features/steps/project/graph.rb
+9
-0
No files found.
CHANGELOG
View file @
befff32e
...
@@ -20,6 +20,7 @@ v 8.3.0 (unreleased)
...
@@ -20,6 +20,7 @@ v 8.3.0 (unreleased)
- Fix 500 error when creating a merge request that removes a submodule
- Fix 500 error when creating a merge request that removes a submodule
- Run custom Git hooks when branch is created or deleted.
- Run custom Git hooks when branch is created or deleted.
- Fix bug when simultaneously accepting multiple MRs results in MRs that are of "merged" status, but not merged to the target branch
- Fix bug when simultaneously accepting multiple MRs results in MRs that are of "merged" status, but not merged to the target branch
- Add languages page to graphs
v 8.2.3
v 8.2.3
- Fix application settings cache not expiring after changes (Stan Hu)
- Fix application settings cache not expiring after changes (Stan Hu)
...
...
app/controllers/projects/graphs_controller.rb
View file @
befff32e
...
@@ -34,6 +34,26 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -34,6 +34,26 @@ class Projects::GraphsController < Projects::ApplicationController
@charts
[
:build_times
]
=
Ci
::
Charts
::
BuildTime
.
new
(
ci_project
)
@charts
[
:build_times
]
=
Ci
::
Charts
::
BuildTime
.
new
(
ci_project
)
end
end
def
languages
@languages
=
Linguist
::
Repository
.
new
(
@repository
.
rugged
,
@repository
.
rugged
.
head
.
target_id
).
languages
total
=
@languages
.
map
(
&
:last
).
sum
@languages
=
@languages
.
map
do
|
language
|
name
,
share
=
language
color
=
Digest
::
SHA256
.
hexdigest
(
name
)[
0
...
6
]
{
value:
(
share
.
to_f
*
100
/
total
).
round
(
2
),
label:
name
,
color:
"#
#{
color
}
"
,
highlight:
"#
#{
color
}
"
}
end
@languages
.
sort!
do
|
x
,
y
|
y
[
:value
]
<=>
x
[
:value
]
end
end
private
private
def
fetch_graph
def
fetch_graph
...
...
app/views/projects/graphs/_head.html.haml
View file @
befff32e
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
=
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
=
nav_link
(
action: :languages
)
do
=
link_to
'Languages'
,
languages_namespace_project_graph_path
-
if
@project
.
builds_enabled?
-
if
@project
.
builds_enabled?
=
nav_link
(
action: :ci
)
do
=
nav_link
(
action: :ci
)
do
=
link_to
ci_namespace_project_graph_path
do
=
link_to
ci_namespace_project_graph_path
do
...
...
app/views/projects/graphs/languages.html.haml
0 → 100644
View file @
befff32e
-
page_title
"Languages"
,
"Graphs"
=
render
"header_title"
=
render
'head'
.gray-content-block.append-bottom-default
.oneline
Programming languages used in this repository
.row
.col-md-8
%canvas
#languages-chart
{
height:
400
}
.col-md-4
%ul
.bordered-list
-
@languages
.
each
do
|
language
|
%li
%span
{
style:
"color: #{language[:color]}"
}
=
icon
(
'circle'
)
=
language
[
:label
]
.pull-right
=
language
[
:value
]
\%
:javascript
var
data
=
#{
@languages
.
to_json
}
;
var
ctx
=
$
(
"
#languages-chart
"
).
get
(
0
).
getContext
(
"
2d
"
);
var
options
=
{
scaleOverlay
:
true
,
responsive
:
true
,
maintainAspectRatio
:
false
}
var
myPieChart
=
new
Chart
(
ctx
).
Pie
(
data
,
options
);
config/routes.rb
View file @
befff32e
...
@@ -500,6 +500,7 @@ Rails.application.routes.draw do
...
@@ -500,6 +500,7 @@ Rails.application.routes.draw do
member
do
member
do
get
:commits
get
:commits
get
:ci
get
:ci
get
:languages
end
end
end
end
...
...
features/project/graph.feature
View file @
befff32e
...
@@ -18,3 +18,8 @@ Feature: Project Graph
...
@@ -18,3 +18,8 @@ Feature: Project Graph
Given
project
"Shop"
has CI enabled
Given
project
"Shop"
has CI enabled
When
I visit project
"Shop"
CI graph page
When
I visit project
"Shop"
CI graph page
Then
page should have CI graphs
Then
page should have CI graphs
@javascript
Scenario
:
I
should see project languages graphs
When
I visit project
"Shop"
languages graph page
Then
page should have languages graphs
features/steps/project/graph.rb
View file @
befff32e
...
@@ -14,6 +14,15 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
...
@@ -14,6 +14,15 @@ class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
visit
commits_namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
visit
commits_namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
end
end
step
'I visit project "Shop" languages graph page'
do
visit
languages_namespace_project_graph_path
(
project
.
namespace
,
project
,
"master"
)
end
step
'page should have languages graphs'
do
expect
(
page
).
to
have_content
"Ruby 66.63 %"
expect
(
page
).
to
have_content
"JavaScript 22.96 %"
end
step
'page should have commits graphs'
do
step
'page should have commits graphs'
do
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"
...
...
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