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
a8a328b1
Commit
a8a328b1
authored
Feb 18, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DB performance improvements to GitLab
parent
367d9a2d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
53 additions
and
39 deletions
+53
-39
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+9
-6
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+11
-6
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+8
-5
app/controllers/users_controller.rb
app/controllers/users_controller.rb
+4
-3
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+7
-1
app/views/dashboard/_activities.html.haml
app/views/dashboard/_activities.html.haml
+1
-6
app/views/dashboard/_project.html.haml
app/views/dashboard/_project.html.haml
+1
-1
app/views/groups/_projects.html.haml
app/views/groups/_projects.html.haml
+1
-1
app/views/groups/show.html.haml
app/views/groups/show.html.haml
+1
-4
app/views/projects/_home_panel.html.haml
app/views/projects/_home_panel.html.haml
+1
-1
lib/gitlab/current_settings.rb
lib/gitlab/current_settings.rb
+9
-5
No files found.
app/controllers/dashboard_controller.rb
View file @
a8a328b1
...
@@ -12,11 +12,7 @@ class DashboardController < ApplicationController
...
@@ -12,11 +12,7 @@ class DashboardController < ApplicationController
@groups
=
current_user
.
authorized_groups
.
order_name_asc
@groups
=
current_user
.
authorized_groups
.
order_name_asc
@has_authorized_projects
=
@projects
.
count
>
0
@has_authorized_projects
=
@projects
.
count
>
0
@projects_count
=
@projects
.
count
@projects_count
=
@projects
.
count
@projects
=
@projects
.
limit
(
@projects_limit
)
@projects
=
@projects
.
includes
(
:namespace
).
limit
(
@projects_limit
)
@events
=
Event
.
in_projects
(
current_user
.
authorized_projects
.
pluck
(
:id
))
@events
=
@event_filter
.
apply_filter
(
@events
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@last_push
=
current_user
.
recent_push
@last_push
=
current_user
.
recent_push
...
@@ -24,7 +20,14 @@ class DashboardController < ApplicationController
...
@@ -24,7 +20,14 @@ class DashboardController < ApplicationController
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
json
{
pager_json
(
"events/_events"
,
@events
.
count
)
}
format
.
json
do
@events
=
Event
.
in_projects
(
current_user
.
authorized_projects
.
pluck
(
:id
))
@events
=
@event_filter
.
apply_filter
(
@events
).
includes
(
:target
,
project: :namespace
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
pager_json
(
"events/_events"
,
@events
.
count
)
end
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
end
end
end
end
...
...
app/controllers/groups_controller.rb
View file @
a8a328b1
...
@@ -10,11 +10,11 @@ class GroupsController < ApplicationController
...
@@ -10,11 +10,11 @@ class GroupsController < ApplicationController
# Load group projects
# Load group projects
before_filter
:load_projects
,
except:
[
:new
,
:create
,
:projects
,
:edit
,
:update
]
before_filter
:load_projects
,
except:
[
:new
,
:create
,
:projects
,
:edit
,
:update
]
before_filter
:event_filter
,
only: :show
before_filter
:set_title
,
only:
[
:new
,
:create
]
layout
:determine_layout
layout
:determine_layout
before_filter
:set_title
,
only:
[
:new
,
:create
]
def
new
def
new
@group
=
Group
.
new
@group
=
Group
.
new
end
end
...
@@ -32,14 +32,19 @@ class GroupsController < ApplicationController
...
@@ -32,14 +32,19 @@ class GroupsController < ApplicationController
end
end
def
show
def
show
@events
=
Event
.
in_projects
(
project_ids
)
@events
=
event_filter
.
apply_filter
(
@events
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
@last_push
=
current_user
.
recent_push
if
current_user
@last_push
=
current_user
.
recent_push
if
current_user
@projects
=
@projects
.
includes
(
:namespace
)
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
format
.
html
format
.
json
{
pager_json
(
"events/_events"
,
@events
.
count
)
}
format
.
json
do
@events
=
Event
.
in_projects
(
project_ids
)
@events
=
event_filter
.
apply_filter
(
@events
).
includes
(
:target
,
project: :namespace
)
@events
=
@events
.
limit
(
20
).
offset
(
params
[
:offset
]
||
0
)
pager_json
(
"events/_events"
,
@events
.
count
)
end
format
.
atom
{
render
layout:
false
}
format
.
atom
{
render
layout:
false
}
end
end
end
end
...
...
app/controllers/projects_controller.rb
View file @
a8a328b1
...
@@ -5,9 +5,10 @@ class ProjectsController < ApplicationController
...
@@ -5,9 +5,10 @@ class ProjectsController < ApplicationController
# Authorize
# Authorize
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
]
before_filter
:authorize_admin_project!
,
only:
[
:edit
,
:update
,
:destroy
,
:transfer
,
:archive
,
:unarchive
]
before_filter
:set_title
,
only:
[
:new
,
:create
]
before_filter
:event_filter
,
only: :show
layout
'navless'
,
only:
[
:new
,
:create
,
:fork
]
layout
'navless'
,
only:
[
:new
,
:create
,
:fork
]
before_filter
:set_title
,
only:
[
:new
,
:create
]
def
new
def
new
@project
=
Project
.
new
@project
=
Project
.
new
...
@@ -56,9 +57,6 @@ class ProjectsController < ApplicationController
...
@@ -56,9 +57,6 @@ class ProjectsController < ApplicationController
end
end
limit
=
(
params
[
:limit
]
||
20
).
to_i
limit
=
(
params
[
:limit
]
||
20
).
to_i
@events
=
@project
.
events
.
recent
@events
=
event_filter
.
apply_filter
(
@events
)
@events
=
@events
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
@show_star
=
!
(
current_user
&&
current_user
.
starred?
(
@project
))
@show_star
=
!
(
current_user
&&
current_user
.
starred?
(
@project
))
...
@@ -76,7 +74,12 @@ class ProjectsController < ApplicationController
...
@@ -76,7 +74,12 @@ class ProjectsController < ApplicationController
end
end
end
end
format
.
json
{
pager_json
(
'events/_events'
,
@events
.
count
)
}
format
.
json
do
@events
=
@project
.
events
.
recent
@events
=
event_filter
.
apply_filter
(
@events
).
includes
(
:target
,
project: :namespace
)
@events
=
@events
.
limit
(
limit
).
offset
(
params
[
:offset
]
||
0
)
pager_json
(
'events/_events'
,
@events
.
count
)
end
end
end
end
end
...
...
app/controllers/users_controller.rb
View file @
a8a328b1
...
@@ -9,17 +9,18 @@ class UsersController < ApplicationController
...
@@ -9,17 +9,18 @@ class UsersController < ApplicationController
authorized_projects_ids
=
visible_projects
.
pluck
(
:id
)
authorized_projects_ids
=
visible_projects
.
pluck
(
:id
)
@contributed_projects
=
Project
.
where
(
id:
authorized_projects_ids
).
@contributed_projects
=
Project
.
where
(
id:
authorized_projects_ids
).
in_group_namespace
in_group_namespace
.
includes
(
:namespace
)
@projects
=
@user
.
personal_projects
.
@projects
=
@user
.
personal_projects
.
where
(
id:
authorized_projects_ids
)
where
(
id:
authorized_projects_ids
)
.
includes
(
:namespace
)
# Collect only groups common for both users
# Collect only groups common for both users
@groups
=
@user
.
groups
&
GroupsFinder
.
new
.
execute
(
current_user
)
@groups
=
@user
.
groups
&
GroupsFinder
.
new
.
execute
(
current_user
)
# Get user activity feed for projects common for both users
# Get user activity feed for projects common for both users
@events
=
@user
.
recent_events
.
@events
=
@user
.
recent_events
.
where
(
project_id:
authorized_projects_ids
).
limit
(
30
)
where
(
project_id:
authorized_projects_ids
).
includes
(
:target
,
project: :namespace
).
limit
(
30
)
@title
=
@user
.
name
@title
=
@user
.
name
@title_url
=
user_path
(
@user
)
@title_url
=
user_path
(
@user
)
...
...
app/helpers/application_helper.rb
View file @
a8a328b1
...
@@ -51,7 +51,13 @@ module ApplicationHelper
...
@@ -51,7 +51,13 @@ module ApplicationHelper
end
end
def
project_icon
(
project_id
,
options
=
{})
def
project_icon
(
project_id
,
options
=
{})
project
=
Project
.
find_with_namespace
(
project_id
)
project
=
if
project_id
.
is_a?
(
Project
)
project
=
project_id
else
Project
.
find_with_namespace
(
project_id
)
end
if
project
.
avatar
.
present?
if
project
.
avatar
.
present?
image_tag
project
.
avatar
.
url
,
options
image_tag
project
.
avatar
.
url
,
options
elsif
project
.
avatar_in_git
elsif
project
.
avatar_in_git
...
...
app/views/dashboard/_activities.html.haml
View file @
a8a328b1
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/event_filter'
=
render
'shared/event_filter'
.content_list
-
if
@events
.
any?
.content_list
-
else
.nothing-here-block
Projects activity will be displayed here
=
spinner
=
spinner
app/views/dashboard/_project.html.haml
View file @
a8a328b1
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
.dash-project-avatar
.dash-project-avatar
=
project_icon
(
project
.
to_param
,
alt:
''
,
class:
'avatar project-avatar s40'
)
=
project_icon
(
project
,
alt:
''
,
class:
'avatar project-avatar s40'
)
.dash-project-access-icon
.dash-project-access-icon
=
visibility_level_icon
(
project
.
visibility_level
)
=
visibility_level_icon
(
project
.
visibility_level
)
%span
.str-truncated
%span
.str-truncated
...
...
app/views/groups/_projects.html.haml
View file @
a8a328b1
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
%li
.project-row
%li
.project-row
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
=
link_to
project_path
(
project
),
class:
dom_class
(
project
)
do
.dash-project-avatar
.dash-project-avatar
=
project_icon
(
project
.
to_param
,
alt:
''
,
class:
'avatar s40'
)
=
project_icon
(
project
,
alt:
''
,
class:
'avatar s40'
)
.dash-project-access-icon
.dash-project-access-icon
=
visibility_level_icon
(
project
.
visibility_level
)
=
visibility_level_icon
(
project
.
visibility_level
)
%span
.str-truncated
%span
.str-truncated
...
...
app/views/groups/show.html.haml
View file @
a8a328b1
...
@@ -13,10 +13,7 @@
...
@@ -13,10 +13,7 @@
-
if
current_user
-
if
current_user
=
render
"events/event_last_push"
,
event:
@last_push
=
render
"events/event_last_push"
,
event:
@last_push
=
render
'shared/event_filter'
=
render
'shared/event_filter'
-
if
@events
.
any?
.content_list
.content_list
-
else
.nothing-here-block
Project activity will be displayed here
=
spinner
=
spinner
%aside
.side.col-md-4
%aside
.side.col-md-4
=
render
"projects"
,
projects:
@projects
=
render
"projects"
,
projects:
@projects
app/views/projects/_home_panel.html.haml
View file @
a8a328b1
-
empty_repo
=
@project
.
empty_repo?
-
empty_repo
=
@project
.
empty_repo?
.project-home-panel
{
:class
=>
(
"empty-project"
if
empty_repo
)}
.project-home-panel
{
:class
=>
(
"empty-project"
if
empty_repo
)}
.project-identicon-holder
.project-identicon-holder
=
project_icon
(
@project
.
to_param
,
alt:
''
,
class:
'avatar project-avatar'
)
=
project_icon
(
@project
,
alt:
''
,
class:
'avatar project-avatar'
)
.project-home-row
.project-home-row
.project-home-desc
.project-home-desc
-
if
@project
.
description
.
present?
-
if
@project
.
description
.
present?
...
...
lib/gitlab/current_settings.rb
View file @
a8a328b1
module
Gitlab
module
Gitlab
module
CurrentSettings
module
CurrentSettings
def
current_application_settings
def
current_application_settings
if
ActiveRecord
::
Base
.
connected?
&&
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
key
=
:current_application_settings
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
RequestStore
.
store
[
key
]
||=
begin
else
if
ActiveRecord
::
Base
.
connected?
&&
ActiveRecord
::
Base
.
connection
.
table_exists?
(
'application_settings'
)
fake_application_settings
RequestStore
.
store
[
:current_application_settings
]
=
(
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
)
else
fake_application_settings
end
end
end
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