Merge pull request #8041 from colinux/manager-massive-table-without-pagination
perf(manager): ne fait pas de .count sur les tables massives
This commit is contained in:
commit
95a049d0eb
8 changed files with 24 additions and 14 deletions
14
Gemfile.lock
14
Gemfile.lock
|
@ -82,14 +82,12 @@ GEM
|
|||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
administrate (0.16.0)
|
||||
administrate (0.18.0)
|
||||
actionpack (>= 5.0)
|
||||
actionview (>= 5.0)
|
||||
activerecord (>= 5.0)
|
||||
datetime_picker_rails (~> 0.0.7)
|
||||
jquery-rails (>= 4.0)
|
||||
kaminari (>= 1.0)
|
||||
momentjs-rails (~> 2.8)
|
||||
sassc-rails (~> 2.1)
|
||||
selectize-rails (~> 0.6)
|
||||
administrate-field-enum (0.0.9)
|
||||
|
@ -177,8 +175,6 @@ GEM
|
|||
css_parser (1.9.0)
|
||||
addressable
|
||||
daemons (1.3.1)
|
||||
datetime_picker_rails (0.0.7)
|
||||
momentjs-rails (>= 2.8.1)
|
||||
deep_cloneable (3.0.0)
|
||||
activerecord (>= 3.1.0, < 7)
|
||||
delayed_cron_job (0.7.4)
|
||||
|
@ -354,7 +350,7 @@ GEM
|
|||
rails (>= 5.0)
|
||||
io-wait (0.2.1)
|
||||
ipaddress (0.8.3)
|
||||
jquery-rails (4.4.0)
|
||||
jquery-rails (4.5.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
|
@ -422,8 +418,6 @@ GEM
|
|||
mini_mime (1.1.2)
|
||||
mini_portile2 (2.8.0)
|
||||
minitest (5.16.3)
|
||||
momentjs-rails (2.20.1)
|
||||
railties (>= 3.1)
|
||||
msgpack (1.4.2)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.1.1)
|
||||
|
@ -494,7 +488,7 @@ GEM
|
|||
public_suffix (4.0.7)
|
||||
puma (5.6.4)
|
||||
nio4r (~> 2.0)
|
||||
pundit (2.1.0)
|
||||
pundit (2.2.0)
|
||||
activesupport (>= 3.0.0)
|
||||
raabro (1.4.0)
|
||||
racc (1.6.0)
|
||||
|
@ -792,7 +786,7 @@ GEM
|
|||
nokogiri (~> 1.11)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.6.1)
|
||||
zeitwerk (2.6.6)
|
||||
zip_tricks (5.6.0)
|
||||
zipline (1.4.1)
|
||||
actionpack (>= 6.0, < 8.0)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class ApplicationController < ActionController::Base
|
||||
include TrustedDeviceConcern
|
||||
include Pundit
|
||||
include Pundit::Authorization
|
||||
include Devise::StoreLocationExtension
|
||||
include ApplicationController::LongLivedAuthenticityToken
|
||||
include ApplicationController::ErrorHandling
|
||||
|
|
|
@ -21,5 +21,9 @@ module Manager
|
|||
def unfiltered_list?
|
||||
action_name == "index" && !params[:search]
|
||||
end
|
||||
|
||||
def paginate_resources(_resources)
|
||||
super.without_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,8 @@ module Manager
|
|||
render locals: {
|
||||
resources: resources,
|
||||
page: page,
|
||||
show_search_bar: false
|
||||
show_search_bar: false,
|
||||
search_term: nil
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,8 @@ module Manager
|
|||
render locals: {
|
||||
resources: resources,
|
||||
page: page,
|
||||
show_search_bar: false
|
||||
show_search_bar: false,
|
||||
search_term: nil
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -89,5 +89,9 @@ module Manager
|
|||
def targeted_email
|
||||
params[:user][:email]
|
||||
end
|
||||
|
||||
def paginate_resources(_resources)
|
||||
super.without_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
6
app/views/administrate/application/_pagination.html.haml
Normal file
6
app/views/administrate/application/_pagination.html.haml
Normal file
|
@ -0,0 +1,6 @@
|
|||
- if resources.singleton_class.included_modules.include?(Kaminari::PaginatableWithoutCount)
|
||||
%nav.pagination
|
||||
= link_to_prev_page resources, t("views.pagination.previous"), param_name: "_page"
|
||||
= link_to_next_page resources, t("views.pagination.next"), param_name: "_page"
|
||||
- else
|
||||
= paginate resources, param_name: "_page"
|
|
@ -66,7 +66,7 @@ describe Manager::ProceduresController, type: :controller do
|
|||
get :index, params: { procedure: { direction: :asc, order: :dossiers } }
|
||||
end
|
||||
|
||||
it { expect(response.body).to include('1 dossier') }
|
||||
it { expect(response.body).to include('1 Dossier') }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue