diff options
| author | Mason Reed <mason@vector35.com> | 2025-08-26 23:48:47 -0400 |
|---|---|---|
| committer | Mason Reed <35282038+emesare@users.noreply.github.com> | 2025-09-03 21:19:03 +0000 |
| commit | 90ab00d9319b803cf48fc2a7ce8a9f145d43dc13 (patch) | |
| tree | 3874a7f7b683b632e0ddb765c5dc28320cf8c26d /plugins/warp/src/plugin | |
| parent | a41c63a12aada701f64328c9e243d3a84ee5c7b1 (diff) | |
[WARP] Do not show the report in the UI if file is very large
It will just end up freezing the UI for an unreasonable time, just open the generated report in a real web browser or text editor, QTextBrowser falls over and fixing it would be more effort than its worth.
Diffstat (limited to 'plugins/warp/src/plugin')
| -rw-r--r-- | plugins/warp/src/plugin/create.rs | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index a74310a5..c9bd32ce 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -209,16 +209,25 @@ impl CreateFromCurrentView { let _ = std::fs::write(report_path, &report_string); } - match report_kind { - ReportKindField::None => {} - ReportKindField::Html => { - view.show_html_report("Generated WARP File", report_string.as_str(), ""); - } - ReportKindField::Markdown => { - view.show_markdown_report("Generated WARP File", report_string.as_str(), ""); - } - ReportKindField::Json => { - view.show_plaintext_report("Generated WARP File", report_string.as_str()); + // The ReportWidget uses a QTextBrowser, which cannot render large files very well. + if file_size > 10000000 { + log::warn!("WARP report file is too large to show in the UI. Please see the report file on disk."); + } else { + match report_kind { + ReportKindField::None => {} + ReportKindField::Html => { + view.show_html_report("Generated WARP File", report_string.as_str(), ""); + } + ReportKindField::Markdown => { + view.show_markdown_report( + "Generated WARP File", + report_string.as_str(), + "", + ); + } + ReportKindField::Json => { + view.show_plaintext_report("Generated WARP File", report_string.as_str()); + } } } } |
