feat(exports): turbo poll for pending exports
This commit is contained in:
parent
ed057737a5
commit
3af93735a3
4 changed files with 12 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
%ul.fr-raw-list
|
||||
%ul#exports-list.fr-raw-list
|
||||
- @exports.each do |export|
|
||||
%li.fr-mb-3w
|
||||
.flex
|
||||
|
|
|
@ -231,6 +231,11 @@ module Instructeurs
|
|||
value: DateTime.current,
|
||||
expires: Export::MAX_DUREE_GENERATION + Export::MAX_DUREE_CONSERVATION_EXPORT
|
||||
}
|
||||
|
||||
respond_to do |format|
|
||||
format.turbo_stream
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def email_usagers
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
= render Dsfr::CalloutComponent.new(title: nil) do |c|
|
||||
- c.with_body do
|
||||
%p= t('.export_description')
|
||||
|
||||
- if @exports.present?
|
||||
= render Dossiers::ExportLinkComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count, class_btn: 'fr-btn--tertiary', export_url: method(:download_export_instructeur_procedure_path))
|
||||
%div{ data: @exports.any?(&:pending?) ? { controller: "turbo-poll", turbo_poll_url_value: "", turbo_poll_interval_value: 10_000, turbo_poll_max_checks_value: 6 } : {} }
|
||||
= render Dossiers::ExportLinkComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count, class_btn: 'fr-btn--tertiary', export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
- else
|
||||
= t('.no_export_html', expiration_time: Export::MAX_DUREE_CONSERVATION_EXPORT.in_hours.to_i )
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
= turbo_stream.replace "exports-list" do
|
||||
- if @exports.present?
|
||||
= render Dossiers::ExportLinkComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count, class_btn: 'fr-btn--tertiary', export_url: method(:download_export_instructeur_procedure_path))
|
Loading…
Reference in a new issue