Commit 9a4c8f7e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Improve admin group page performance

Add pagination for projects and members to /admin/groups/:group page
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 34cf3c49
...@@ -253,6 +253,12 @@ ul.breadcrumb { ...@@ -253,6 +253,12 @@ ul.breadcrumb {
} }
} }
.panel-footer {
.pagination {
margin: 0;
}
}
&.panel-small { &.panel-small {
.panel-heading { .panel-heading {
padding: 6px 15px; padding: 6px 15px;
......
...@@ -8,6 +8,8 @@ class Admin::GroupsController < Admin::ApplicationController ...@@ -8,6 +8,8 @@ class Admin::GroupsController < Admin::ApplicationController
end end
def show def show
@members = @group.members.order("group_access DESC").page(params[:members_page]).per(30)
@projects = @group.projects.page(params[:projects_page]).per(30)
end end
def new def new
......
...@@ -31,11 +31,12 @@ ...@@ -31,11 +31,12 @@
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
Projects %h3.panel-title
%small Projects
(#{@group.projects.count}) %span.badge
#{@group.projects.count}
%ul.well-list %ul.well-list
- @group.projects.sort_by(&:name).each do |project| - @projects.each do |project|
%li %li
%strong %strong
= link_to project.name_with_namespace, [:admin, project] = link_to project.name_with_namespace, [:admin, project]
...@@ -43,6 +44,8 @@ ...@@ -43,6 +44,8 @@
= repository_size(project) = repository_size(project)
%span.pull-right.light %span.pull-right.light
%span.monospace= project.path_with_namespace + ".git" %span.monospace= project.path_with_namespace + ".git"
.panel-footer
= paginate @projects, param_name: 'projects_page', theme: 'gitlab'
.col-md-6 .col-md-6
.panel.panel-default .panel.panel-default
...@@ -62,12 +65,12 @@ ...@@ -62,12 +65,12 @@
= submit_tag 'Add users into group', class: "btn btn-create" = submit_tag 'Add users into group', class: "btn btn-create"
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
%strong #{@group.name} %h3.panel-title
Group Members Members
%small %span.badge
(#{@group.users_groups.count}) #{@group.users_groups.count}
%ul.well-list.group-users-list %ul.well-list.group-users-list
- @group.users_groups.order('group_access DESC').each do |member| - @members.each do |member|
- user = member.user - user = member.user
%li{class: dom_class(user)} %li{class: dom_class(user)}
.list-item-name .list-item-name
...@@ -77,3 +80,5 @@ ...@@ -77,3 +80,5 @@
= member.human_access = member.human_access
= link_to group_users_group_path(@group, member), data: { confirm: remove_user_from_group_message(@group, user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do = link_to group_users_group_path(@group, member), data: { confirm: remove_user_from_group_message(@group, user) }, method: :delete, remote: true, class: "btn-tiny btn btn-remove", title: 'Remove user from group' do
%i.icon-minus.icon-white %i.icon-minus.icon-white
.panel-footer
= paginate @members, param_name: 'members_page', theme: 'gitlab'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment