From 702f3b77848fc4702df956f08e1eb506d0dd63f3 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 12 Oct 2023 16:31:13 +1100 Subject: [PATCH] Notify user about errors raised in reports --- app/jobs/report_job.rb | 9 +++++++++ config/locales/en.yml | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/app/jobs/report_job.rb b/app/jobs/report_job.rb index 38b7358c1f..9d1e081433 100644 --- a/app/jobs/report_job.rb +++ b/app/jobs/report_job.rb @@ -27,6 +27,8 @@ class ReportJob < ApplicationJob report_class:, user:, params:, format: } end + + broadcast_error(channel) end def email_result(user, blob) @@ -43,6 +45,13 @@ class ReportJob < ApplicationJob ).broadcast end + def broadcast_error(channel) + cable_ready[channel].inner_html( + selector: "#report-table", + html: I18n.t("report_job.report_failed") + ).broadcast + end + def actioncable_content(format, blob) return blob.result if format.to_sym == :html diff --git a/config/locales/en.yml b/config/locales/en.yml index 95ea7a2e0a..62ecbce5ba 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -335,6 +335,10 @@ en: not_array_error: "must be an array" invalid_element_error: "must contain only valid integers" + report_job: + report_failed: | + This report failed. It may be too big to process. + We will look into it but please let us know if the problem persists. enterprise_mailer: confirmation_instructions: subject: "Please confirm the email address for %{enterprise}"