insightsengineering / teal.reporter

Create and preview reports with Shiny modules
https://insightsengineering.github.io/teal.reporter/
Other
8 stars 8 forks source link

204 Add "rendering in progress" info #253

Closed chlebowa closed 4 months ago

chlebowa commented 4 months ago

Closes #204.

Added blocking of download buttons with shinybusy::block.

TESTING APP

devtools::load_all()
library(teal.modules.general)

data <- teal_data()
data <- within(data, {
  library(nestcolor)
  ADSL <- teal.modules.general::rADSL
})
datanames <- c("ADSL")
datanames(data) <- datanames
join_keys(data) <- default_cdisc_join_keys[datanames]

app <- teal::init(
  data = data,
  modules = teal::modules(
    teal.modules.general::tm_a_regression(
      label = "Regression",
      response = teal.transform::data_extract_spec(
        dataname = "ADSL",
        select = teal.transform::select_spec(
          label = "Select variable:",
          choices = "BMRKR1",
          selected = "BMRKR1",
          multiple = FALSE,
          fixed = TRUE
        )
      ),
      regressor = teal.transform::data_extract_spec(
        dataname = "ADSL",
        select = teal.transform::select_spec(
          label = "Select variables:",
          choices = teal.transform::variable_choices(data[["ADSL"]], c("AGE", "SEX", "RACE")),
          selected = "AGE",
          multiple = TRUE,
          fixed = FALSE
        )
      ),
      ggplot2_args = teal.widgets::ggplot2_args(
        labs = list(subtitle = "Plot generated by Regression Module")
      )
    )
  )
)
runApp(app, launch.browser = TRUE)
Polkas commented 4 months ago

Nice solution; an advantage is that the solution does not add other dependencies than shinybusy to the package.

> tools::package_dependencies("shinybusy")
$shinybusy
[1] "htmltools"   "shiny"       "jsonlite"    "htmlwidgets"
chlebowa commented 4 months ago

Thanks @Polkas. It is rather light. 3/4 of its dependencies are already used in teal.reporter and htmlwidgets brings no new ones. :slightly_smiling_face:

pawelru commented 4 months ago

Thanks. I like this. Details to be sorted out but functional wise I feel this is exactly what we need.

chlebowa commented 4 months ago

This is what it looks like now: image

Note that the Cancel button merely closes the modal and does not in fact cancel the rendering. If that can be done, it would be a separate issue.

pawelru commented 4 months ago

Pls add news entry

github-actions[bot] commented 4 months ago

badge

Code Coverage Summary

Filename              Stmts    Miss  Cover    Missing
------------------  -------  ------  -------  -----------------------------------------------------------------------------------
R/AddCardModule.R       144       2  98.61%   165, 202
R/Archiver.R             25       0  100.00%
R/ContentBlock.R         18       2  88.89%   57-63
R/DownloadModule.R      209      49  76.56%   98-104, 147, 179-184, 193-197, 200-204, 212-216, 219-223, 230-234, 237-241, 280-284
R/FileBlock.R            13       0  100.00%
R/NewpageBlock.R          2       0  100.00%
R/PictureBlock.R         30       2  93.33%   20, 118
R/Previewer.R           297      56  81.14%   199, 215, 217-220, 223, 226-234, 348-392
R/RcodeBlock.R           15       0  100.00%
R/Renderer.R            113      37  67.26%   97-112, 216, 224, 233, 235-256
R/ReportCard.R           77       4  94.81%   192, 233, 238, 259
R/Reporter.R             94       1  98.94%   270
R/ResetModule.R          55       0  100.00%
R/SimpleReporter.R       30       0  100.00%
R/TableBlock.R            9       0  100.00%
R/TextBlock.R            13       0  100.00%
R/utils.R               171      80  53.22%   7, 38-97, 99, 102-109, 167, 179-181, 285-294
R/yaml_utils.R           81       2  97.53%   79, 290
R/zzz.R                  14      10  28.57%   2-13, 19
TOTAL                  1410     245  82.62%

Diff against main

Filename              Stmts    Miss  Cover
------------------  -------  ------  -------
R/DownloadModule.R       +2       0  +0.23%
R/Previewer.R            +2       0  +0.13%
TOTAL                    +4       0  +0.05%

Results for commit: 09f7d655a027c1423b968fec4d5763ab803548d3

Minimum allowed coverage is 80%

:recycle: This comment has been updated with latest results

github-actions[bot] commented 4 months ago

Unit Tests Summary

  1 files   18 suites   10s :stopwatch: 204 tests 204 :white_check_mark: 0 :zzz: 0 :x: 346 runs  346 :white_check_mark: 0 :zzz: 0 :x:

Results for commit 09f7d655.

:recycle: This comment has been updated with latest results.

github-actions[bot] commented 4 months ago

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
DownloadReportModule 💔 $1.23$ $+3.02$ $0$ $0$ $0$ $0$
PreviewerReportModule 💔 $1.01$ $+3.00$ $0$ $0$ $0$ $0$
SimpleReporter 💔 $0.55$ $+3.01$ $0$ $0$ $0$ $0$
Additional test case details | Test Suite | $Status$ | Time on `main` | $±Time$ | Test Case | |:-----|:----:|:----:|:----:|:-----| | DownloadReportModule | 💔 | $0.57$ | $+3.00$ | download_report_button_srv_render_and_downlaod_a_document | | PreviewerReportModule | 💔 | $0.36$ | $+3.00$ | reporter_previewer_srv_render_and_downlaod_a_document | | SimpleReporter | 💔 | $0.31$ | $+3.01$ | simple_reporter_srv_render_and_downlaod_a_document |

Results for commit eb2adbd7ff2b5050c3148f6571923c5363482c8e

♻️ This comment has been updated with latest results.

chlebowa commented 4 months ago

@pawelru Anything else needed here?

pawelru commented 4 months ago

Thanks. It's good now. Please remove sys wait and I will be happy to approve.