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
dc917552
Commit
dc917552
authored
Jun 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache graph log
parent
367a5d1b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
17 deletions
+36
-17
app/controllers/projects/graphs_controller.rb
app/controllers/projects/graphs_controller.rb
+11
-3
app/models/repository.rb
app/models/repository.rb
+8
-0
app/views/projects/graphs/show.js.haml
app/views/projects/graphs/show.js.haml
+17
-14
No files found.
app/controllers/projects/graphs_controller.rb
View file @
dc917552
...
@@ -8,10 +8,18 @@ class Projects::GraphsController < Projects::ApplicationController
...
@@ -8,10 +8,18 @@ class Projects::GraphsController < Projects::ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
js
do
format
.
js
do
@repo
=
@project
.
repository
fetch_graph
@stats
=
Gitlab
::
Git
::
GitStats
.
new
(
@repo
.
raw
,
@repo
.
root_ref
)
@log
=
@stats
.
parsed_log
.
to_json
rescue
[]
end
end
end
end
end
end
private
def
fetch_graph
@log
=
@project
.
repository
.
graph_log
.
to_json
@success
=
true
rescue
=>
ex
@log
=
[]
@success
=
false
end
end
end
app/models/repository.rb
View file @
dc917552
...
@@ -61,6 +61,14 @@ class Repository
...
@@ -61,6 +61,14 @@ class Repository
Rails
.
cache
.
delete
(
cache_key
(
:size
))
Rails
.
cache
.
delete
(
cache_key
(
:size
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
Rails
.
cache
.
delete
(
cache_key
(
:graph_log
))
end
def
graph_log
Rails
.
cache
.
fetch
(
cache_key
(
:graph
))
do
stats
=
Gitlab
::
Git
::
GitStats
.
new
(
raw
,
root_ref
)
stats
.
parsed_log
end
end
end
def
cache_key
(
type
)
def
cache_key
(
type
)
...
...
app/views/projects/graphs/show.js.haml
View file @
dc917552
:plain
-
if
@success
controller = new ContributorsStatGraph
:plain
controller.init(
#{
@log
}
)
controller = new ContributorsStatGraph
controller.init(
#{
@log
}
)
$("select").change( function () {
$("select").change( function () {
var field = $(this).val()
var field = $(this).val()
controller.set_current_field(field)
controller.set_current_field(field)
controller.redraw_master()
controller.redraw_master()
controller.redraw_authors()
controller.redraw_authors()
})
})
$("#brush_change").change( function () {
controller.change_date_header()
controller.redraw_authors()
})
$("#brush_change").change( function () {
controller.change_date_header()
controller.redraw_authors()
})
-
else
:plain
$('.stat-graph').replaceWith('<div class="alert alert-error">Failed to load graph</div>')
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