From 203baa73574c2af6167e8bf8d3243fe50695b6d5 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski <114988527+chlebowa@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:27:42 +0100 Subject: [PATCH] 204 Add "rendering in progress" info (#253) Closes #204. Added blocking of download buttons with `shinybusy::block`. --- .pre-commit-config.yaml | 1 + DESCRIPTION | 10 ++++++---- NEWS.md | 4 ++++ R/DownloadModule.R | 2 ++ R/Previewer.R | 2 ++ inst/css/Previewer.css | 5 +++++ 6 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3b16eb4c..b206a2f8 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,7 @@ repos: - R6 - rmarkdown - shiny + - shinybusy - shinyWidgets - yaml - zip diff --git a/DESCRIPTION b/DESCRIPTION index d4c9e694..9d404f04 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -32,6 +32,7 @@ Imports: R6, rmarkdown (>= 2.19), shiny (>= 1.6.0), + shinybusy, shinyWidgets (>= 0.5.1), yaml (>= 1.1.0), zip (>= 1.1.0) @@ -50,10 +51,11 @@ RdMacros: lifecycle Config/Needs/verdepcheck: rstudio/bslib, mllg/checkmate, rstudio/htmltools, yihui/knitr, r-lib/lifecycle, r-lib/R6, - rstudio/rmarkdown, rstudio/shiny, dreamRs/shinyWidgets, - yaml=vubiostat/r-yaml, r-lib/zip, davidgohel/flextable, rstudio/DT, - yihui/formatR, tidyverse/ggplot2, deepayan/lattice, cran/png, - insightsengineering/rtables, r-lib/testthat, rstudio/tinytex + rstudio/rmarkdown, rstudio/shiny, dreamRs/shinybusy, + dreamRs/shinyWidgets, yaml=vubiostat/r-yaml, r-lib/zip, + davidgohel/flextable, rstudio/DT, yihui/formatR, tidyverse/ggplot2, + deepayan/lattice, cran/png, insightsengineering/rtables, + r-lib/testthat, rstudio/tinytex Config/Needs/website: insightsengineering/nesttemplate Encoding: UTF-8 Language: en-US diff --git a/NEWS.md b/NEWS.md index 445b2dfb..77cd14b4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,9 @@ # teal.reporter 0.3.0.9004 +### Enhancements + +* Added blocking of "Download" buttons while report is rendering, using the `shinybusy` package. + # teal.reporter 0.3.0 ### Enhancements diff --git a/R/DownloadModule.R b/R/DownloadModule.R index 3fcca7c2..c0e8f3b3 100644 --- a/R/DownloadModule.R +++ b/R/DownloadModule.R @@ -141,10 +141,12 @@ download_report_button_srv <- function(id, }, content = function(file) { shiny::showNotification("Rendering and Downloading the document.") + shinybusy::block(id = ns("download_data"), text = "", type = "dots") input_list <- lapply(names(rmd_yaml_args), function(x) input[[x]]) names(input_list) <- names(rmd_yaml_args) if (is.logical(input$showrcode)) global_knitr[["echo"]] <- input$showrcode report_render_and_compress(reporter, input_list, global_knitr, file) + shinybusy::unblock(id = ns("download_data")) }, contentType = "application/zip" ) diff --git a/R/Previewer.R b/R/Previewer.R index 1a01f224..883ad02f 100644 --- a/R/Previewer.R +++ b/R/Previewer.R @@ -193,10 +193,12 @@ reporter_previewer_srv <- function(id, }, content = function(file) { shiny::showNotification("Rendering and Downloading the document.") + shinybusy::block(id = ns("download_data_prev"), text = "", type = "dots") input_list <- lapply(names(rmd_yaml_args), function(x) input[[x]]) names(input_list) <- names(rmd_yaml_args) if (is.logical(input$showrcode)) global_knitr[["echo"]] <- input$showrcode report_render_and_compress(reporter, input_list, global_knitr, file) + shinybusy::unblock(id = ns("download_data_prev")) }, contentType = "application/zip" ) diff --git a/inst/css/Previewer.css b/inst/css/Previewer.css index 6f348e61..dc491249 100644 --- a/inst/css/Previewer.css +++ b/inst/css/Previewer.css @@ -29,3 +29,8 @@ a[id$=download_data_prev].disabled { margin-top:10px; color:#337ab7; } + +/* prevents oversizing elements covered by shinybusy::block */ +.nx-block-temporary-position { + min-height: 0 !important; +}