Skip to content

Commit 4fcaa41

Browse files
authored
Merge branch 'main' into teal_reporter@main
2 parents 5e081b4 + 89f9900 commit 4fcaa41

File tree

9 files changed

+27
-19
lines changed

9 files changed

+27
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: teal.modules.general
33
Title: General Modules for 'teal' Applications
4-
Version: 0.3.0.9071
4+
Version: 0.3.0.9072
55
Date: 2025-01-27
66
Authors@R: c(
77
person("Dawid", "Kaledkowski", , "[email protected]", role = c("aut", "cre")),

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# teal.modules.general 0.3.0.9071
1+
# teal.modules.general 0.3.0.9072
22

33
* Removed `Show Warnings` modals from modules.
44
* Soft deprecated `datasets_selected` argument of modules in favor of `datanames`.

R/tm_data_table.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ tm_data_table <- function(label = "Data Table",
136136
ui = ui_page_data_table,
137137
datanames = datanames,
138138
server_args = list(
139-
datanames = datanames,
139+
datanames = if (is.null(datanames)) "all" else datanames,
140140
variables_selected = variables_selected,
141141
dt_args = dt_args,
142142
dt_options = dt_options,
@@ -201,7 +201,8 @@ srv_page_data_table <- function(id,
201201

202202
datanames <- Filter(function(name) {
203203
is.data.frame(isolate(data())[[name]])
204-
}, datanames)
204+
}, if (identical(datanames, "all")) names(isolate(data())) else datanames)
205+
205206

206207
output$dataset_table <- renderUI({
207208
do.call(

R/tm_front_page.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ tm_front_page <- function(label = "Front page",
7272
additional_tags = tagList(),
7373
footnotes = character(0),
7474
show_metadata = deprecated(),
75-
datanames = if (missing(show_metadata)) "all" else NULL) {
75+
datanames = if (missing(show_metadata)) NULL else "all") {
7676
message("Initializing tm_front_page")
7777

7878
# Start of assertions

R/tm_missing_data.R

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,18 @@ tm_missing_data <- function(label = "Missing data",
152152
assert_decorators(decorators, names = available_decorators)
153153
# End of assertions
154154

155+
datanames_module <- if (identical(datanames, "all") || is.null(datanames)) {
156+
datanames
157+
} else {
158+
union(datanames, parent_dataname)
159+
}
160+
155161
ans <- module(
156162
label,
157163
server = srv_page_missing_data,
158-
datanames = if (identical(datanames, "all")) union(datanames, parent_dataname) else "all",
164+
datanames = datanames_module,
159165
server_args = list(
166+
datanames = if (is.null(datanames)) "all" else datanames,
160167
parent_dataname = parent_dataname,
161168
plot_height = plot_height,
162169
plot_width = plot_width,
@@ -198,18 +205,17 @@ ui_page_missing_data <- function(id, pre_output = NULL, post_output = NULL) {
198205
}
199206

200207
# Server function for the missing data module (all datasets)
201-
srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_dataname,
208+
srv_page_missing_data <- function(id, data, reporter, filter_panel_api, datanames, parent_dataname,
202209
plot_height, plot_width, ggplot2_args, ggtheme, decorators) {
203210
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
204211
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
205212
moduleServer(id, function(input, output, session) {
206213
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")
207214

208-
datanames <- isolate(names(data()))
209-
datanames <- Filter(
210-
function(name) is.data.frame(isolate(data())[[name]]),
211-
datanames
212-
)
215+
datanames <- Filter(function(name) {
216+
is.data.frame(isolate(data())[[name]])
217+
}, if (identical(datanames, "all")) names(isolate(data())) else datanames)
218+
213219
if_subject_plot <- length(parent_dataname) > 0 && parent_dataname %in% datanames
214220

215221
ns <- session$ns

R/tm_variable_browser.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ tm_variable_browser <- function(label = "Variable Browser",
107107
checkmate::assert_class(ggplot2_args, "ggplot2_args")
108108
# End of assertions
109109

110-
datanames <- if (identical(datanames, "all")) {
111-
"all"
110+
datanames_module <- if (identical(datanames, "all") || is.null(datanames)) {
111+
datanames
112112
} else {
113113
union(datanames, parent_dataname)
114114
}
@@ -117,9 +117,9 @@ tm_variable_browser <- function(label = "Variable Browser",
117117
label,
118118
server = srv_variable_browser,
119119
ui = ui_variable_browser,
120-
datanames = datanames,
120+
datanames = datanames_module,
121121
server_args = list(
122-
datanames = datanames,
122+
datanames = if (is.null(datanames)) "all" else datanames,
123123
parent_dataname = parent_dataname,
124124
ggplot2_args = ggplot2_args
125125
),
@@ -228,7 +228,7 @@ srv_variable_browser <- function(id,
228228

229229
datanames <- Filter(function(name) {
230230
is.data.frame(isolate(data())[[name]])
231-
}, datanames)
231+
}, if (identical(datanames, "all")) names(isolate(data())) else datanames)
232232

233233
output$ui_variable_browser <- renderUI({
234234
ns <- session$ns

man/tm_front_page.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-shinytest2-tm_front_page.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ app_driver_tm_front_page <- function() {
88
data = data,
99
modules = tm_front_page(
1010
label = "Front page",
11+
datanames = "all",
1112
header_text = c(
1213
"Important information" = "It can go here.",
1314
"Other information" = "Can go here."

tests/testthat/test-shinytest2-tm_misssing_data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ app_driver_tm_missing_data <- function() {
1919
label = "Missing data",
2020
plot_height = c(600, 400, 5000),
2121
plot_width = NULL,
22-
datanames = "mtcars",
22+
datanames = "all",
2323
ggtheme = "gray",
2424
ggplot2_args = list(
2525
"Combinations Hist" = teal.widgets::ggplot2_args(

0 commit comments

Comments
 (0)