Skip to content

Commit

Permalink
204 Add "rendering in progress" info (#253)
Browse files Browse the repository at this point in the history
Closes #204.

Added blocking of download buttons with `shinybusy::block`.
  • Loading branch information
chlebowa committed Feb 28, 2024
1 parent 685cc15 commit 203baa7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ repos:
- R6
- rmarkdown
- shiny
- shinybusy
- shinyWidgets
- yaml
- zip
Expand Down
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions R/DownloadModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
2 changes: 2 additions & 0 deletions R/Previewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
5 changes: 5 additions & 0 deletions inst/css/Previewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 203baa7

Please sign in to comment.