Skip to content

Commit

Permalink
Merge branch 'main' into in_teal.reporter@custom_card_functions@main
Browse files Browse the repository at this point in the history
Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com>
  • Loading branch information
m7pr authored Jul 10, 2024
2 parents fc11907 + 54cd391 commit 052265f
Show file tree
Hide file tree
Showing 26 changed files with 56 additions and 108 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ repos:
- dplyr
- DT
- forcats
- ggrepel
- grid
- logger
- scales
Expand Down
17 changes: 9 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.general
Title: General Modules for 'teal' Applications
Version: 0.3.0.9029
Date: 2024-04-29
Version: 0.3.0.9038
Date: 2024-06-27
Authors@R: c(
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"),
Expand Down Expand Up @@ -45,10 +45,10 @@ Imports:
stringr (>= 1.4.1),
teal.code (>= 0.5.0),
teal.data (>= 0.5.0),
teal.logger (>= 0.1.3.9013),
teal.logger (>= 0.2.0.9004),
teal.reporter (>= 0.3.0),
teal.widgets (>= 0.4.0),
tern (>= 0.9.3),
tern (>= 0.9.5),
tibble (>= 2.0.0),
tidyr (>= 0.8.3),
tools,
Expand All @@ -70,11 +70,12 @@ Suggests:
MASS,
nestcolor (>= 0.1.0),
pkgload,
rtables (>= 0.6.6),
rmarkdown (>= 2.23),
rtables (>= 0.6.8),
rvest,
shinytest2,
sparkline,
testthat (>= 3.0.4),
testthat (>= 3.1.9),
withr (>= 2.0.0)
VignetteBuilder:
knitr
Expand All @@ -90,8 +91,8 @@ Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
tidymodels/broom, daattali/colourpicker, daattali/ggExtra,
aphalo/ggpmisc, aphalo/ggpp, slowkow/ggrepel, baddstats/goftest,
gridExtra, ramnathv/htmlwidgets, jeroen/jsonlite, yihui/knitr,
deepayan/lattice, daroczig/logger, MASS,
insightsengineering/nestcolor, r-lib/rlang,
daroczig/logger, deepayan/lattice, MASS,
insightsengineering/nestcolor, r-lib/rlang, rstudio/rmarkdown,
insightsengineering/rtables, tidyverse/rvest, sparkline,
rstudio/shinytest2, insightsengineering/teal.data, r-lib/testthat,
r-lib/withr
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# teal.modules.general 0.3.0.9029
# teal.modules.general 0.3.0.9038

* Removed `Show Warnings` modals from modules.

### Enhancements
* Added `teal.logger` functionality for logging changes in shiny inputs in all modules.

* Users can now provide their own card functions to specify the content that modules send to reports.

Expand Down Expand Up @@ -38,6 +43,7 @@
* Removed `scda` package dependency from examples.
* Replaced deprecated `ggplot2` functions `..count..`, `..density..` and `..prop..`.
* Version bump on `forcats` dependency.
* Replaced `scda` data generation functions with `random.cdisc.data`

# teal.modules.general 0.2.15

Expand Down
10 changes: 2 additions & 8 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ ui_a_pca <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -298,6 +297,8 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

response <- dat

for (i in seq_along(response)) {
Expand Down Expand Up @@ -1033,13 +1034,6 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl
)
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ ui_a_regression <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -372,6 +371,8 @@ srv_a_regression <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

rule_rvr1 <- function(value) {
Expand Down Expand Up @@ -1000,13 +1001,6 @@ srv_a_regression <- function(id,
)
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
2 changes: 2 additions & 0 deletions R/tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ srv_page_data_table <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

if_filtered <- reactive(as.logical(input$if_filtered))
if_distinct <- reactive(as.logical(input$if_distinct))

Expand Down
2 changes: 2 additions & 0 deletions R/tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ ui_viewer <- function(id, ...) {
# Server function for the file viewer module
srv_viewer <- function(id, input_path) {
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

temp_dir <- tempfile()
if (!dir.exists(temp_dir)) {
dir.create(temp_dir, recursive = TRUE)
Expand Down
2 changes: 2 additions & 0 deletions R/tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ srv_front_page <- function(id, data, tables, show_metadata) {
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

setBookmarkExclude("metadata_button")
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ ui_tm_g_association <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -286,6 +285,8 @@ srv_tm_g_association <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(ref = ref, vars = vars),
datasets = data,
Expand Down Expand Up @@ -506,13 +507,6 @@ srv_tm_g_association <- function(id,
teal.code::dev_suppress(output_q()[["title"]])
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,6 @@ ui_g_bivariate <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand Down Expand Up @@ -460,6 +459,8 @@ srv_g_bivariate <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

ns <- session$ns

data_extract <- list(
Expand Down Expand Up @@ -689,13 +690,6 @@ srv_g_bivariate <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,6 @@ ui_distribution <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -365,6 +364,8 @@ srv_distribution <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

setBookmarkExclude("params_reset")

ns <- session$ns
Expand Down Expand Up @@ -1275,13 +1276,6 @@ srv_distribution <- function(id,
rownames = FALSE
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ ui_g_response <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -314,6 +313,8 @@ srv_g_response <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(response = response, x = x, row_facet = row_facet, col_facet = col_facet)

rule_diff <- function(other) {
Expand Down Expand Up @@ -547,13 +548,6 @@ srv_g_response <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ ui_g_scatterplot <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand Down Expand Up @@ -495,6 +494,8 @@ srv_g_scatterplot <- function(id,
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

data_extract <- list(
x = x,
y = y,
Expand Down Expand Up @@ -1022,13 +1023,6 @@ srv_g_scatterplot <- function(id,
}
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ ui_g_scatterplotmatrix <- function(id, ...) {
)
),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
Expand All @@ -267,6 +266,8 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(variables = variables),
datasets = data,
Expand Down Expand Up @@ -441,13 +442,6 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab
}
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
10 changes: 2 additions & 8 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
moduleServer(id, function(input, output, session) {
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.general")

datanames <- isolate(teal.data::datanames(data()))
datanames <- Filter(function(name) {
is.data.frame(isolate(data())[[name]])
Expand Down Expand Up @@ -228,7 +230,6 @@ srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_d
conditionalPanel(
is_tab_active_js(ns("dataname_tab"), x),
tagList(
teal.widgets::verbatim_popup_ui(dataname_ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(dataname_ns("rcode"), "Show R code")
)
)
Expand Down Expand Up @@ -1269,13 +1270,6 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
}
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(final_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(final_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(final_q())),
Expand Down
Loading

0 comments on commit 052265f

Please sign in to comment.