From 99f5b39dbbc72c007c63637425866997a966c9b1 Mon Sep 17 00:00:00 2001 From: Colin Darie Date: Wed, 13 Sep 2023 13:06:50 +0200 Subject: [PATCH] fix(exports): force regenerate export with same statut filter Co-Authored-By: Lisa Durand --- app/components/dossiers/export_link_component.rb | 6 +++--- .../export_link_component/export_link_component.html.haml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/dossiers/export_link_component.rb b/app/components/dossiers/export_link_component.rb index 95f0b04a9..52a872ef3 100644 --- a/app/components/dossiers/export_link_component.rb +++ b/app/components/dossiers/export_link_component.rb @@ -14,11 +14,11 @@ class Dossiers::ExportLinkComponent < ApplicationComponent item.fetch(:format) != :json || @procedure.active_revision.carte? end - def download_export_path(export_format:, force_export: false, no_progress_notification: nil) + def download_export_path(export_format:, statut:, force_export: false, no_progress_notification: nil) @export_url.call(@procedure, export_format: export_format, - statut: @statut, force_export: force_export, + statut: statut, no_progress_notification: no_progress_notification) end @@ -54,7 +54,7 @@ class Dossiers::ExportLinkComponent < ApplicationComponent def poll_controller_options(export) { controller: 'turbo-poll', - turbo_poll_url_value: download_export_path(export_format: export.format, no_progress_notification: true), + turbo_poll_url_value: download_export_path(export_format: export.format, statut: export.statut, no_progress_notification: true), turbo_poll_interval_value: 6000, turbo_poll_max_checks_value: 10 } diff --git a/app/components/dossiers/export_link_component/export_link_component.html.haml b/app/components/dossiers/export_link_component/export_link_component.html.haml index eddcc9298..15e8d171e 100644 --- a/app/components/dossiers/export_link_component/export_link_component.html.haml +++ b/app/components/dossiers/export_link_component/export_link_component.html.haml @@ -5,11 +5,11 @@ = link_to ready_link_label(export), export.file.url, target: "_blank", rel: "noopener", role: 'menuitem' %span= ready_link_label_extra_infos(export) - if export.old? - = button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, force_export: true), refresh_button_options(export).merge(role: 'menuitem') + = button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, statut: export.statut, force_export: true), refresh_button_options(export).merge(role: 'menuitem') - elsif export.failed? %li.fr-mb-2w = failed_label(export) - = button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, force_export: true), refresh_button_options(export).merge(role: 'menuitem') + = button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, statut: export.statut, force_export: true), refresh_button_options(export).merge(role: 'menuitem') - else %li.fr-mb-2w %span{ data: poll_controller_options(export) }