Skip to content
Merged
Show file tree
Hide file tree
Changes from 141 commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
96e3945
push local changes
vedhav Sep 17, 2024
7f56567
Merge branch 'main' into test@bslib@main
vedhav Sep 24, 2024
20bb0f0
feat: add additional sidebar toggle buttons
vedhav Sep 26, 2024
2c36c7b
feat: show three different tabs types for different module depths
vedhav Sep 26, 2024
45d0f1e
chore: add bslib package ns
vedhav Sep 26, 2024
52b7fc7
Merge branch 'main' into test@bslib@main
vedhav Sep 27, 2024
85622df
push local style changes
vedhav Oct 3, 2024
4881050
Merge remote-tracking branch 'origin/main' into test@bslib@main
vedhav Oct 3, 2024
8a12408
reposition the validated message div
vedhav Oct 3, 2024
910c26d
bold accordion titles
vedhav Oct 3, 2024
3279b6e
fix unwanted padding created by hidden validation message div
vedhav Oct 3, 2024
e7346fd
make sidebar width customizable using options
vedhav Oct 4, 2024
a616392
icon changes
vedhav Oct 7, 2024
0716caf
fix: make the filter mapping popup concise
vedhav Oct 17, 2024
813d5b5
Merge branch 'main' into test@bslib@main
vedhav Oct 17, 2024
e705f36
improve the sidebar distinction
vedhav Oct 18, 2024
21e3955
user feedback changes
vedhav Oct 22, 2024
486b565
Merge branch 'main' into test@bslib@main
vedhav Dec 11, 2024
3a1b5d6
Merge branch 'main' into test@bslib@main
vedhav Feb 13, 2025
36c2561
fix: remove unused component
vedhav Feb 13, 2025
2d5d3a6
report card handled by teal
gogonzo Feb 24, 2025
fe0545e
simplify
gogonzo Feb 24, 2025
333a87c
Merge main to test@bslib@main (#1497)
m7pr Feb 24, 2025
86391e4
feat: add remote dependencies
vedhav Feb 25, 2025
454d49e
revert teal.reporter redesign changes
m7pr Feb 26, 2025
620e5ba
bring back teal.reporter redesign changes
m7pr Feb 26, 2025
17f5a4a
update Remotes branch names
m7pr Feb 26, 2025
df3a62a
change add_card_button_srv -> add_document_button_srv
m7pr Feb 26, 2025
9f91260
add dev versions to teal dev dependencies
m7pr Feb 26, 2025
2bf6481
add dev versions to dependencies
m7pr Feb 26, 2025
06f2898
fix: bslib changes
vedhav Mar 3, 2025
59b3a15
bring add_document_button_srv to teal
m7pr Mar 4, 2025
c2388eb
make it a named list
m7pr Mar 4, 2025
466f0e7
Merge branch 'test@bslib@main' into redesign@main
vedhav Mar 4, 2025
9990dca
attempt on S3 class directly in teal
m7pr Mar 4, 2025
c3538e5
Merge branch 'redesign@main' of https://github.com/insightsengineerin…
m7pr Mar 4, 2025
c5301ff
compact to_markdown
m7pr Mar 4, 2025
ec60f50
bring back load button to reporter previewer
m7pr Mar 9, 2025
eb9abf3
change knitr to lenght1
m7pr Mar 9, 2025
72456fc
Merge branch 'main' into redesign@main
m7pr Mar 13, 2025
366def0
Update DESCRIPTION
m7pr Mar 13, 2025
35d4101
unify remotes
m7pr Mar 13, 2025
2667426
element to markdown not needed in teal
m7pr Mar 24, 2025
8729daa
cleanup NAMESPACE
m7pr Mar 25, 2025
7a5e099
extend example_module to handle report_card
m7pr Mar 25, 2025
0022f0d
extend shinytest2 tests for new teal reporter previewer
m7pr Mar 25, 2025
c0b9836
prototype of modify_teal_module_report
m7pr Apr 2, 2025
795a246
workout modify_teal_module_output
m7pr Apr 9, 2025
30118ec
introduce reporter parameter, so that you can disable it globally, or…
m7pr Apr 10, 2025
5829d61
Merge branch 'main' into redesign@main
m7pr Apr 25, 2025
4daffe4
bring back comments to addcard modal
m7pr Apr 30, 2025
ec5141a
clone reporter
gogonzo May 2, 2025
ea2c7e5
fix error when report is NULL (no method NULL$clone)
gogonzo May 5, 2025
2fad140
- always add report_previewer_module
gogonzo May 5, 2025
a8201af
disable_report instead of nullify_teal_module_report_card
gogonzo May 5, 2025
0201c7a
- rename modifiers
gogonzo May 6, 2025
4bf6e99
reload docs
gogonzo May 6, 2025
6cf260d
feat: move the reporter button
vedhav May 6, 2025
8be8963
prevent adding a card with the existing name
m7pr May 7, 2025
ef03a5b
fix reactivity
gogonzo May 8, 2025
4ae9720
Merge remote-tracking branch 'origin/main' into redesign@main
gogonzo May 8, 2025
35d3ae2
restart add card modal becuase the save button gets disabled after a …
m7pr May 8, 2025
0396d61
Merge branch 'redesign@main' of https://github.com/insightsengineerin…
m7pr May 8, 2025
ab96d22
enable add_card button after unsuccessful card addition
m7pr May 8, 2025
0372479
documentation and checks for modify_reactive_output
m7pr May 8, 2025
18b524e
[skip style] [skip vbump] Restyle files
github-actions[bot] May 11, 2025
6c92309
feat: move the reporter button outside the teal module
vedhav May 13, 2025
d1360e5
Minor changes from PR review
averissimo May 15, 2025
93cd49c
feat: use common structure for js autofocus input and enter to submit
averissimo May 15, 2025
a47a24a
chore: simplification of code into moduleServers
averissimo May 15, 2025
a6d3a8c
Merge branch 'pr@redesign@main' into redesign@main
averissimo May 15, 2025
0857eb2
chore: code trimming
averissimo May 15, 2025
8330ddb
fix: use trimmed named to store card
averissimo May 15, 2025
e90a5d5
revert: back to @ instead of %40 due to pak error
averissimo May 16, 2025
835cf0f
collapse subsequent chunks
gogonzo May 20, 2025
05c2255
Improves `ReportDocument` editor (#1536)
averissimo May 27, 2025
a803de7
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] May 27, 2025
bacf4cc
Merge branch 'teal_data_report' into teal_reportable
gogonzo May 27, 2025
21e400a
typo
gogonzo May 27, 2025
6c62626
convert teal_data to reportable
gogonzo May 27, 2025
40d5147
fix modify_reactive_output
gogonzo May 27, 2025
daa23ad
rename classes
gogonzo May 27, 2025
693c8e5
rename missing
gogonzo May 27, 2025
9f6965a
fix srv_reporter_previewer_tab to work with reactive output
gogonzo May 28, 2025
3ca11ab
reload docs
gogonzo May 28, 2025
45da1b4
after function
gogonzo May 28, 2025
bcab748
remove docs of modify_reactive_output
gogonzo May 28, 2025
8a1e9d3
Don't append filter panel code if no filters applied
gogonzo May 28, 2025
a19a367
chore: last of consisent naming
averissimo May 28, 2025
78ad8b2
fix: revert temporary fix that shouldn't have been pushed
averissimo May 28, 2025
b7cba1a
fix: revert temporary fix that shouldn't have been pushed
averissimo May 28, 2025
329f728
fix: use teal_report object instead of teal_data in signature
averissimo May 28, 2025
a66fa15
Merge remote-tracking branch 'origin/main' into teal_reportable
gogonzo Jun 2, 2025
a31fdaa
Remove unnecessary methods
gogonzo Jun 3, 2025
860edf1
Add "Code preparation" heading
gogonzo Jun 3, 2025
9047461
Merge branch 'main' into redesign@main
averissimo Jun 4, 2025
7c3b571
Merge remote-tracking branch 'origin/redesign@main' into teal_reportable
averissimo Jun 4, 2025
a7f76e9
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jun 5, 2025
33c0ff3
chore: add remotes
averissimo Jun 5, 2025
f01ad09
chore: bump deps versions
averissimo Jun 6, 2025
8b48ac0
tests: update test to new method of disabling reporter globaly
averissimo Jun 6, 2025
1516f8f
tests: fix previewer was inserted in teal_slices
averissimo Jun 6, 2025
8b37b72
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jun 6, 2025
d356591
Naming (#1542)
m7pr Jun 6, 2025
473b987
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jun 6, 2025
8d2477e
chore: linter errors
averissimo Jun 6, 2025
60d5707
docs: fix spelling
averissimo Jun 6, 2025
82fd605
chore: cleanup for CI
averissimo Jun 6, 2025
f4ac12f
chore: rcmdcheck with 0 erros and warnings
averissimo Jun 6, 2025
4f2e06a
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jun 6, 2025
65e6e04
empty: trigger ci
averissimo Jun 6, 2025
93071a3
chore: fix docs ci
averissimo Jun 6, 2025
abb2307
Disable report when error (#1547)
gogonzo Jun 12, 2025
290cbb9
changing sections to h2 as h1 is dedicated to the title
gogonzo Jun 19, 2025
cf9c3b4
adding an attribute to start a new chunk for following (no .collapse_…
gogonzo Jun 19, 2025
52e71b1
Merge remote-tracking branch 'origin/main' into teal_reportable
gogonzo Jun 26, 2025
b8549a6
don't add a label to teal_card's code_chunk - avoid duplicated label…
gogonzo Jul 1, 2025
4727133
unwrap reactive sooner
gogonzo Jul 1, 2025
16939fe
fix: revert back to main
averissimo Jun 30, 2025
0283942
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jul 1, 2025
02d3ba6
remotes
gogonzo Jul 2, 2025
29a4cec
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jul 2, 2025
9307ed7
Update R/module_teal.R
averissimo Jul 2, 2025
23f3d03
cleanup: remove function
averissimo Jul 4, 2025
93074e0
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Jul 7, 2025
dbb46cd
Block removal@teal reportable (#1552)
averissimo Jul 8, 2025
0079d91
Merge remote-tracking branch 'origin/main' into teal_reportable
averissimo Aug 19, 2025
2905443
fix: no longer inserting reporter and remove use of get_var
averissimo Aug 20, 2025
240279f
fix: htmldependency not working
averissimo Aug 25, 2025
0676b08
fix: minor cleanup of todos
averissimo Aug 25, 2025
442a4f3
Merge remote-tracking branch 'origin/main' into teal_reportable
averissimo Aug 26, 2025
3bd290c
fix regression: show reporter buttons unless init is null
averissimo Aug 28, 2025
7d9d80c
extend add_card_button_ui + with Add to Report text
m7pr Sep 1, 2025
4c03222
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 1, 2025
adb99d4
If reporter was provided, reuse it in srv_teal (#1586)
m7pr Sep 2, 2025
04b7951
If reporter is globally disabled, do not show a + sign to add a card …
m7pr Sep 2, 2025
00a7311
chore: move to single if clause
averissimo Sep 2, 2025
2720333
Update R/after.R
m7pr Sep 2, 2025
40c124f
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 2, 2025
fbf8e15
Update NEWS.md
averissimo Sep 3, 2025
cbb778b
Update DESCRIPTION
averissimo Sep 3, 2025
aa32ff5
team TealSlicesBlock tests
m7pr Sep 3, 2025
a6cd26e
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 3, 2025
48a9d8a
fix tests for teal_reporter
m7pr Sep 3, 2025
8f41cc6
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr Sep 3, 2025
91e9a06
fix rest of the tests
m7pr Sep 3, 2025
0feee26
Merge branch 'main' into teal_reportable
m7pr Sep 3, 2025
80b3892
fix rcmd check note
m7pr Sep 3, 2025
f8e6c0f
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr Sep 3, 2025
daaaaf3
fix pkgdown
m7pr Sep 3, 2025
823b008
remove dispatch_block from TealReportCard afte TealSliceBlock was rem…
m7pr Sep 3, 2025
6b55725
Update DESCRIPTION
m7pr Sep 3, 2025
25f2a0f
Merge branch 'main' into teal_reportable
averissimo Sep 4, 2025
554029f
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 4, 2025
2d15f81
chore: bump teal.reporter dependency
averissimo Sep 4, 2025
073f977
chore: change remotes to main
averissimo Sep 4, 2025
f69a898
docs: correct NEWS.md
averissimo Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Suggests:
VignetteBuilder:
knitr,
rmarkdown
RdMacros:
lifecycle
Remotes:
insightsengineering/teal.reporter@teal_reportable
Config/Needs/verdepcheck: rstudio/shiny, insightsengineering/teal.data,
insightsengineering/teal.slice, mllg/checkmate, jeroen/jsonlite,
r-lib/lifecycle, daroczig/logger, r-lib/mirai, r-lib/cli,
Expand All @@ -98,6 +98,7 @@ Roxygen: list(markdown = TRUE, packages = c("roxy.shinylive"))
RoxygenNote: 7.3.2
Collate:
'TealAppDriver.R'
'after.R'
'checkmate.R'
'dummy_functions.R'
'include_css_js.R'
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ S3method(print,teal_modules)
S3method(within,teal_data_module)
export(TealReportCard)
export(add_landing_modal)
export(after)
export(as.teal_slices)
export(as_tdata)
export(build_app_title)
export(disable_report)
export(example_module)
export(get_code_tdata)
export(get_metadata)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
- Reporter: The Report previewer is no longer displayed as yet another teal module, it is placed inside a "Report" drop-down right next to the "Module" drop-down. The Report previewer is a modal that displays the added report cards. The "Report" drop-down also contains other global report options like download/load/reset the Report.
- Teal Data Module: The UI created by the `teal_data_module()` is now placed inside a modal that can only be closed when it returns `teal_data`.

### New features

* `init` and `srv_teal` have new `reporter` parameter, that allows to pre-define `teal.reporter::Reporter` object to be
used for storing the content of the report. You can also globally disable reporting by setting `reporter = NULL`
(and `disable = TRUE` in `ui_teal` for cases when `ui_teal` is used as shiny module).

# teal 0.16.0

### New features
Expand Down
91 changes: 91 additions & 0 deletions R/after.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#' Executes modifications to the result of a module
#'
#' Primarily used to modify the output object of module to change the containing
#' report.
#' @param x (`teal_module`)
#' @param ui (`function(id, elem, ...)`) function to receive output (`shiny.tag`) from `x$ui`
#' @param server (`function(input, output, session, data, ...)`) function to receive output data from `x$server`
#' @param ... additional argument passed to `ui` and `server` by matching their formals names.
#' @return A `teal_report` object with the result of the server function.
#' @export
after <- function(x,
ui = function(id, elem) elem,
server = function(input, output, session, data) data,
...) {
# todo: make a method for teal_app and remove teal_extend_server?
checkmate::assert_multi_class(x, "teal_module")
if (!is.function(ui) || !all(names(formals(ui)) %in% c("id", "elem"))) {
stop("ui should be a function of id and elem")
}
if (!is.function(server) || !all(names(formals(server)) %in% c("input", "output", "session", "data"))) {
stop("server should be a function of `input` and `output`, `session`, `data`")
}

additional_args <- list(...)
new_x <- x # because overwriting x$ui/server will cause infinite recursion
new_x$ui <- .after_ui(x$ui, ui, additional_args)
new_x$server <- .after_server(x$server, server, additional_args)
new_x
}

.after_ui <- function(x, y, additional_args) {
# add `_`-prefix to make sure objects are not masked in the wrapper functions
`_x` <- x # nolint: object_name.
`_y` <- y # nolint: object_name.
new_x <- function(id, ...) {
original_args <- as.list(environment())
if ("..." %in% names(formals(`_x`))) {
original_args <- c(original_args, list(...))
}
ns <- NS(id)
original_args$id <- ns("wrapped")
original_out <- do.call(`_x`, original_args, quote = TRUE)

wrapper_args <- c(
additional_args,
list(id = ns("wrapper"), elem = original_out)
)
do.call(`_y`, args = wrapper_args[names(formals(`_y`))])
}
formals(new_x) <- formals(x)
new_x
}

.after_server <- function(x, y, additional_args) {
# add `_`-prefix to make sure objects are not masked in the wrapper functions
`_x` <- x # nolint: object_name.
`_y` <- y # nolint: object_name.
new_x <- function(id, ...) {
original_args <- as.list(environment())
original_args$id <- "wrapped"
if ("..." %in% names(formals(`_x`))) {
original_args <- c(original_args, list(...))
}
moduleServer(id, function(input, output, session) {
original_out <- if (all(c("input", "output", "session") %in% names(formals(`_x`)))) {
original_args$module <- `_x`
do.call(shiny::callModule, args = original_args)
} else {
do.call(`_x`, original_args)
}
original_out_r <- reactive(
if (is.reactive(original_out)) {
original_out()
} else {
original_out
}
)
wrapper_args <- utils::modifyList(
additional_args,
list(id = "wrapper", input = input, output = output, session = session)
)
reactive({
req(original_out_r())
wrapper_args$data <- original_out()
do.call(`_y`, wrapper_args[names(formals(`_y`))], quote = TRUE)
})
})
}
formals(new_x) <- formals(x)
new_x
}
13 changes: 10 additions & 3 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#' a string specifying the `shiny` module id in cases it is used as a `shiny` module
#' rather than a standalone `shiny` app.
#' This parameter is no longer supported. Use [ui_teal()] and [srv_teal()] instead.
#' @param reporter (`Reporter`) object used to store report contents. Set to `NULL` to globally disable reporting.
#'
#' @return Named list containing server and UI functions.
#'
Expand Down Expand Up @@ -99,7 +100,8 @@ init <- function(data,
title = lifecycle::deprecated(),
header = lifecycle::deprecated(),
footer = lifecycle::deprecated(),
id = lifecycle::deprecated()) {
id = lifecycle::deprecated(),
reporter = teal.reporter::Reporter$new()) {
logger::log_debug("init initializing teal app with: data ('{ class(data) }').")

# argument checking (independent)
Expand Down Expand Up @@ -183,7 +185,6 @@ init <- function(data,
landing <- extract_module(modules, "teal_module_landing")
modules <- drop_module(modules, "teal_module_landing")


if (lifecycle::is_present(id)) {
lifecycle::deprecate_soft(
when = "0.16.0",
Expand Down Expand Up @@ -235,7 +236,13 @@ init <- function(data,
)
},
server = function(input, output, session) {
srv_teal(id = "teal", data = data, modules = modules, filter = deep_copy_filter(filter))
srv_teal(
id = "teal",
data = data,
modules = modules,
filter = deep_copy_filter(filter),
reporter = if (!is.null(reporter)) reporter$clone(deep = TRUE)
)
srv_session_info("teal-footer-session_info")
}
),
Expand Down
26 changes: 21 additions & 5 deletions R/module_init_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,31 @@ srv_init_data <- function(id, data) {
#' @keywords internal
.add_signature_to_data <- function(data) {
hashes <- .get_hashes_code(data)
data_teal_report <- as(data, "teal_report")
if (!inherits(data, "teal_report")) {
teal.reporter::teal_card(data_teal_report) <- c(
teal.reporter::teal_card(),
"## Code preparation",
teal.reporter::teal_card(data_teal_report)
)
}
tdata <- do.call(
teal.data::teal_data,
teal.reporter::teal_report,
c(
list(code = trimws(c(teal.code::get_code(data), hashes), which = "right")),
list(join_keys = teal.data::join_keys(data)),
as.list(data, all.names = TRUE)
list(
code = trimws(c(teal.code::get_code(data_teal_report), hashes), which = "right"),
join_keys = teal.data::join_keys(data_teal_report),
teal_card = teal.reporter::teal_card(data_teal_report)
),
sapply(
names(data_teal_report),
base::get,
envir = data_teal_report,
simplify = FALSE
)
)
)
tdata@verified <- data@verified
tdata@verified <- data_teal_report@verified
tdata
}

Expand Down
28 changes: 12 additions & 16 deletions R/module_nested_tabs.R
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ srv_teal_module <- function(id,
tab_pane <- div(
id = container_id,
class = c("tab-pane", "teal_module", if (identical(module_id, active_module_id)) "active"),
ui_add_reporter(ns("add_reporter_wrapper")),
tagList(
.modules_breadcrumb(modules),
if (!is.null(modules$datanames)) {
Expand Down Expand Up @@ -334,7 +335,7 @@ srv_teal_module <- function(id,
checkmate::assert_multi_class(modules, c("teal_modules", "teal_module"))
assert_reactive(datasets, null.ok = TRUE)
checkmate::assert_class(slices_global, ".slicesGlobal")
checkmate::assert_class(reporter, "Reporter")
checkmate::assert_class(reporter, "Reporter", null.ok = TRUE)
assert_reactive(data_load_status)
UseMethod(".srv_teal_module", modules)
}
Expand Down Expand Up @@ -488,21 +489,16 @@ srv_teal_module <- function(id,
})

# Call modules.
if (!inherits(modules, "teal_module_previewer")) {
obs_module <- .call_once_when(
!is.null(module_teal_data()),
ignoreNULL = TRUE,
handlerExpr = {
module_out(.call_teal_module(modules, datasets, module_teal_data, reporter))
}
)
} else {
# Report previewer must be initiated on app start for report cards to be included in bookmarks.
# When previewer is delayed, cards are bookmarked only if previewer has been initiated (visited).
module_out(.call_teal_module(modules, datasets, module_teal_data, reporter))
}
obs_module <- .call_once_when(
!is.null(module_teal_data()),
ignoreNULL = TRUE,
handlerExpr = {
out <- .call_teal_module(modules, datasets, module_teal_data, reporter)
srv_add_reporter("add_reporter_wrapper", out, reporter)
module_out(out)
}
)
})

module_out
})
}
Expand All @@ -513,7 +509,7 @@ srv_teal_module <- function(id,

# collect arguments to run teal_module
args <- c(list(id = "module"), modules$server_args)
if (is_arg_used(modules$server, "reporter")) {
if (is_arg_used(modules$server, "reporter") && !is.null(reporter)) {
args <- c(args, list(reporter = reporter))
}

Expand Down
6 changes: 6 additions & 0 deletions R/module_snapshot_manager.R
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ srv_snapshot_manager <- function(id, slices_global) {
modalDialog(
easyClose = TRUE,
textInput(ns("snapshot_name"), "Name the snapshot", width = "100%", placeholder = "Meaningful, unique name"),
tags$script(
shiny::HTML(
sprintf("shinyjs.autoFocusModal('%s');", ns("snapshot_name")),
sprintf("shinyjs.enterToSubmit('%s', '%s');", ns("snapshot_name"), ns("snapshot_name_accept"))
)
),
footer = shiny::div(
shiny::tags$button(
type = "button",
Expand Down
21 changes: 10 additions & 11 deletions R/module_teal.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ ui_teal <- function(id, modules) {
mod <- extract_module(modules, class = "teal_module_previewer")
reporter_opts <- if (length(mod)) .get_reporter_options(mod[[1]]$server_args)
modules <- drop_module(modules, "teal_module_landing")
modules <- drop_module(modules, "teal_module_previewer")

# show busy icon when `shiny` session is busy computing stuff
# based on https://stackoverflow.com/questions/17325521/r-shiny-display-loading-message-while-function-is-running/22475216#22475216 # nolint: line_length.
shiny_busy_message_panel <- conditionalPanel(
condition = "(($('html').hasClass('shiny-busy')) && (document.getElementById('shiny-notification-panel') == null))", # nolint: line_length.
tags$div(
Expand Down Expand Up @@ -108,6 +109,7 @@ ui_teal <- function(id, modules) {
theme = get_teal_bs_theme(),
include_teal_css_js(),
shinyjs::useShinyjs(),
shiny::includeScript(system.file("js/extendShinyJs.js", package = "teal.reporter")),
shiny_busy_message_panel,
tags$div(id = ns("tabpanel_wrapper"), class = "teal-body", navbar),
tags$hr(style = "margin: 1rem 0 0.5rem 0;")
Expand All @@ -116,14 +118,13 @@ ui_teal <- function(id, modules) {

#' @rdname module_teal
#' @export
srv_teal <- function(id, data, modules, filter = teal_slices()) {
srv_teal <- function(id, data, modules, filter = teal_slices(), reporter = teal.reporter::Reporter$new()) {
checkmate::assert_character(id, max.len = 1, any.missing = FALSE)
checkmate::assert_multi_class(data, c("teal_data", "teal_data_module", "reactive"))
checkmate::assert_class(modules, "teal_modules")
checkmate::assert_class(filter, "teal_slices")

modules <- drop_module(modules, "teal_module_landing")
modules <- drop_module(modules, "teal_module_previewer")

moduleServer(id, function(input, output, session) {
logger::log_debug("srv_teal initializing.")
Expand Down Expand Up @@ -159,7 +160,6 @@ srv_teal <- function(id, data, modules, filter = teal_slices()) {
srv_check_module_datanames("datanames_warning", data_handled, modules)

data_validated <- .trigger_on_success(data_handled)

data_signatured <- reactive({
req(inherits(data_validated(), "teal_data"))
is_filter_ok <- check_filter_datanames(filter, names(data_validated()))
Expand Down Expand Up @@ -239,17 +239,16 @@ srv_teal <- function(id, data, modules, filter = teal_slices()) {
ui = tags$div(validate_ui)
)
}

if (is_arg_used(modules, "reporter")) {
if (!is.null(reporter)) {
shinyjs::show("reporter_menu_container")
reporter$set_id(attr(filter, "app_id"))
teal.reporter::preview_report_button_srv("preview_report", reporter)
teal.reporter::report_load_srv("load_report", reporter)
teal.reporter::download_report_button_srv(id = "download_report", reporter = reporter)
teal.reporter::reset_report_button_srv("reset_reports", reporter)
} else {
removeUI(selector = sprintf("#%s", session$ns("reporter_menu_container")))
}
reporter <- teal.reporter::Reporter$new()$set_id(attr(filter, "app_id"))
teal.reporter::preview_report_button_srv("preview_report", reporter)
teal.reporter::report_load_srv("load_report", reporter)
teal.reporter::download_report_button_srv(id = "download_report", reporter = reporter)
teal.reporter::reset_report_button_srv("reset_reports", reporter)

datasets_rv <- if (!isTRUE(attr(filter, "module_specific"))) {
eventReactive(data_signatured(), {
Expand Down
15 changes: 3 additions & 12 deletions R/teal_data_module-eval_code.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ setOldClass("teal_data_module")
#' @include teal_data_module.R
#' @name eval_code
#' @rdname teal_data_module
#' @aliases eval_code,teal_data_module,character-method
#' @aliases eval_code,teal_data_module,language-method
#' @aliases eval_code,teal_data_module,expression-method
#' @aliases eval_code,teal_data_module
#' @aliases \S4method{eval_code}{teal_data_module}
#'
#' @importFrom methods setMethod
#' @importMethodsFrom teal.code eval_code
#'
setMethod("eval_code", signature = c("teal_data_module", "character"), function(object, code) {
setMethod("eval_code", signature = c(object = "teal_data_module"), function(object, code) {
teal_data_module(
ui = function(id) {
ns <- NS(id)
Expand All @@ -50,11 +49,3 @@ setMethod("eval_code", signature = c("teal_data_module", "character"), function(
once = attr(object, "once")
)
})

setMethod("eval_code", signature = c("teal_data_module", "language"), function(object, code) {
eval_code(object, code = paste(lang2calls(code), collapse = "\n"))
})

setMethod("eval_code", signature = c("teal_data_module", "expression"), function(object, code) {
eval_code(object, code = paste(lang2calls(code), collapse = "\n"))
})
Loading
Loading