Commit 9a4c8f7e41eaec63d98431f5ff776240e2dc7604
1 parent
34cf3c49
Exists in
spb-stable
and in
2 other branches
Improve admin group page performance
Add pagination for projects and members to /admin/groups/:group page Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
22 additions
and
9 deletions
Show diff stats
app/assets/stylesheets/gl_bootstrap.scss
| @@ -253,6 +253,12 @@ ul.breadcrumb { | @@ -253,6 +253,12 @@ ul.breadcrumb { | ||
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | + .panel-footer { | ||
| 257 | + .pagination { | ||
| 258 | + margin: 0; | ||
| 259 | + } | ||
| 260 | + } | ||
| 261 | + | ||
| 256 | &.panel-small { | 262 | &.panel-small { |
| 257 | .panel-heading { | 263 | .panel-heading { |
| 258 | padding: 6px 15px; | 264 | padding: 6px 15px; |
app/controllers/admin/groups_controller.rb
| @@ -8,6 +8,8 @@ class Admin::GroupsController < Admin::ApplicationController | @@ -8,6 +8,8 @@ class Admin::GroupsController < Admin::ApplicationController | ||
| 8 | end | 8 | end |
| 9 | 9 | ||
| 10 | def show | 10 | def show |
| 11 | + @members = @group.members.order("group_access DESC").page(params[:members_page]).per(30) | ||
| 12 | + @projects = @group.projects.page(params[:projects_page]).per(30) | ||
| 11 | end | 13 | end |
| 12 | 14 | ||
| 13 | def new | 15 | def new |
app/views/admin/groups/show.html.haml
| @@ -31,11 +31,12 @@ | @@ -31,11 +31,12 @@ | ||
| 31 | 31 | ||
| 32 | .panel.panel-default | 32 | .panel.panel-default |
| 33 | .panel-heading | 33 | .panel-heading |
| 34 | - Projects | ||
| 35 | - %small | ||
| 36 | - (#{@group.projects.count}) | 34 | + %h3.panel-title |
| 35 | + Projects | ||
| 36 | + %span.badge | ||
| 37 | + #{@group.projects.count} | ||
| 37 | %ul.well-list | 38 | %ul.well-list |
| 38 | - - @group.projects.sort_by(&:name).each do |project| | 39 | + - @projects.each do |project| |
| 39 | %li | 40 | %li |
| 40 | %strong | 41 | %strong |
| 41 | = link_to project.name_with_namespace, [:admin, project] | 42 | = link_to project.name_with_namespace, [:admin, project] |
| @@ -43,6 +44,8 @@ | @@ -43,6 +44,8 @@ | ||
| 43 | = repository_size(project) | 44 | = repository_size(project) |
| 44 | %span.pull-right.light | 45 | %span.pull-right.light |
| 45 | %span.monospace= project.path_with_namespace + ".git" | 46 | %span.monospace= project.path_with_namespace + ".git" |
| 47 | + .panel-footer | ||
| 48 | + = paginate @projects, param_name: 'projects_page', theme: 'gitlab' | ||
| 46 | 49 | ||
| 47 | .col-md-6 | 50 | .col-md-6 |
| 48 | .panel.panel-default | 51 | .panel.panel-default |
| @@ -62,12 +65,12 @@ | @@ -62,12 +65,12 @@ | ||
| 62 | = submit_tag 'Add users into group', class: "btn btn-create" | 65 | = submit_tag 'Add users into group', class: "btn btn-create" |
| 63 | .panel.panel-default | 66 | .panel.panel-default |
| 64 | .panel-heading | 67 | .panel-heading |
| 65 | - %strong #{@group.name} | ||
| 66 | - Group Members | ||
| 67 | - %small | ||
| 68 | - (#{@group.users_groups.count}) | 68 | + %h3.panel-title |
| 69 | + Members | ||
| 70 | + %span.badge | ||
| 71 | + #{@group.users_groups.count} | ||
| 69 | %ul.well-list.group-users-list | 72 | %ul.well-list.group-users-list |
| 70 | - - @group.users_groups.order('group_access DESC').each do |member| | 73 | + - @members.each do |member| |
| 71 | - user = member.user | 74 | - user = member.user |
| 72 | %li{class: dom_class(user)} | 75 | %li{class: dom_class(user)} |
| 73 | .list-item-name | 76 | .list-item-name |
| @@ -77,3 +80,5 @@ | @@ -77,3 +80,5 @@ | ||
| 77 | = member.human_access | 80 | = member.human_access |
| 78 | = 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 | 81 | = 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 |
| 79 | %i.icon-minus.icon-white | 82 | %i.icon-minus.icon-white |
| 83 | + .panel-footer | ||
| 84 | + = paginate @members, param_name: 'members_page', theme: 'gitlab' |