@@ -53,8 +53,9 @@ ui_teal <- function(id, modules) {
5353 mod <- extract_module(modules , class = " teal_module_previewer" )
5454 reporter_opts <- if (length(mod )) .get_reporter_options(mod [[1 ]]$ server_args )
5555 modules <- drop_module(modules , " teal_module_landing" )
56- modules <- drop_module(modules , " teal_module_previewer" )
5756
57+ # show busy icon when `shiny` session is busy computing stuff
58+ # based on https://stackoverflow.com/questions/17325521/r-shiny-display-loading-message-while-function-is-running/22475216#22475216 # nolint: line_length.
5859 shiny_busy_message_panel <- conditionalPanel(
5960 condition = " (($('html').hasClass('shiny-busy')) && (document.getElementById('shiny-notification-panel') == null))" , # nolint: line_length.
6061 tags $ div(
@@ -108,6 +109,7 @@ ui_teal <- function(id, modules) {
108109 theme = get_teal_bs_theme(),
109110 include_teal_css_js(),
110111 shinyjs :: useShinyjs(),
112+ shiny :: includeScript(system.file(" js/extendShinyJs.js" , package = " teal.reporter" )),
111113 shiny_busy_message_panel ,
112114 tags $ div(id = ns(" tabpanel_wrapper" ), class = " teal-body" , navbar ),
113115 tags $ hr(style = " margin: 1rem 0 0.5rem 0;" )
@@ -116,14 +118,13 @@ ui_teal <- function(id, modules) {
116118
117119# ' @rdname module_teal
118120# ' @export
119- srv_teal <- function (id , data , modules , filter = teal_slices()) {
121+ srv_teal <- function (id , data , modules , filter = teal_slices(), reporter = teal.reporter :: Reporter $ new() ) {
120122 checkmate :: assert_character(id , max.len = 1 , any.missing = FALSE )
121123 checkmate :: assert_multi_class(data , c(" teal_data" , " teal_data_module" , " reactive" ))
122124 checkmate :: assert_class(modules , " teal_modules" )
123125 checkmate :: assert_class(filter , " teal_slices" )
124126
125127 modules <- drop_module(modules , " teal_module_landing" )
126- modules <- drop_module(modules , " teal_module_previewer" )
127128
128129 moduleServer(id , function (input , output , session ) {
129130 logger :: log_debug(" srv_teal initializing." )
@@ -159,7 +160,6 @@ srv_teal <- function(id, data, modules, filter = teal_slices()) {
159160 srv_check_module_datanames(" datanames_warning" , data_handled , modules )
160161
161162 data_validated <- .trigger_on_success(data_handled )
162-
163163 data_signatured <- reactive({
164164 req(inherits(data_validated(), " teal_data" ))
165165 is_filter_ok <- check_filter_datanames(filter , names(data_validated()))
@@ -239,17 +239,16 @@ srv_teal <- function(id, data, modules, filter = teal_slices()) {
239239 ui = tags $ div(validate_ui )
240240 )
241241 }
242-
243- if (is_arg_used(modules , " reporter" )) {
242+ if (! is.null(reporter )) {
244243 shinyjs :: show(" reporter_menu_container" )
244+ reporter $ set_id(attr(filter , " app_id" ))
245+ teal.reporter :: preview_report_button_srv(" preview_report" , reporter )
246+ teal.reporter :: report_load_srv(" load_report" , reporter )
247+ teal.reporter :: download_report_button_srv(id = " download_report" , reporter = reporter )
248+ teal.reporter :: reset_report_button_srv(" reset_reports" , reporter )
245249 } else {
246250 removeUI(selector = sprintf(" #%s" , session $ ns(" reporter_menu_container" )))
247251 }
248- reporter <- teal.reporter :: Reporter $ new()$ set_id(attr(filter , " app_id" ))
249- teal.reporter :: preview_report_button_srv(" preview_report" , reporter )
250- teal.reporter :: report_load_srv(" load_report" , reporter )
251- teal.reporter :: download_report_button_srv(id = " download_report" , reporter = reporter )
252- teal.reporter :: reset_report_button_srv(" reset_reports" , reporter )
253252
254253 datasets_rv <- if (! isTRUE(attr(filter , " module_specific" ))) {
255254 eventReactive(data_signatured(), {
0 commit comments