diff --git a/DESCRIPTION b/DESCRIPTION index 576ecc605..8650c861e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,6 +35,7 @@ Imports: DT (>= 0.13), forcats (>= 1.0.0), grid, + logger (>= 0.3.0), scales, shinyjs, shinyTree (>= 0.2.8), @@ -65,7 +66,6 @@ Suggests: jsonlite, knitr (>= 1.42), lattice (>= 0.18-4), - logger (>= 0.2.0), MASS, nestcolor (>= 0.1.0), pkgload, @@ -81,7 +81,7 @@ VignetteBuilder: Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, - rstudio/DT, tidyverse/forcats, r-lib/scales, daattali/shinyjs, + rstudio/DT, tidyverse/forcats, daroczig/logger, r-lib/scales, daattali/shinyjs, shinyTree/shinyTree, rstudio/shinyvalidate, dreamRs/shinyWidgets, tidyverse/stringr, insightsengineering/teal.code, insightsengineering/teal.data, insightsengineering/teal.logger, @@ -90,8 +90,7 @@ 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, + deepayan/lattice, MASS, insightsengineering/nestcolor, r-lib/rlang, insightsengineering/rtables, tidyverse/rvest, sparkline, rstudio/shinytest2, insightsengineering/teal.data, r-lib/testthat, r-lib/withr diff --git a/NEWS.md b/NEWS.md index 3a5076e1b..5f5d5b9ad 100644 --- a/NEWS.md +++ b/NEWS.md @@ -2,6 +2,9 @@ * Removed `Show Warnings` modals from modules. +### Enhancements +* Added `logger` functionality for logging changes in shiny inputs in all modules. `logger` was added to Imports. + # teal.modules.general 0.3.0 ### Enhancements diff --git a/R/tm_a_pca.R b/R/tm_a_pca.R index f1f5344f0..2c7f53045 100644 --- a/R/tm_a_pca.R +++ b/R/tm_a_pca.R @@ -297,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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + response <- dat for (i in seq_along(response)) { diff --git a/R/tm_a_regression.R b/R/tm_a_regression.R index 653b9bc66..7ee905466 100644 --- a/R/tm_a_regression.R +++ b/R/tm_a_regression.R @@ -371,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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + ns <- session$ns rule_rvr1 <- function(value) { diff --git a/R/tm_data_table.R b/R/tm_data_table.R index 7ef52606f..9ffb96207 100644 --- a/R/tm_data_table.R +++ b/R/tm_data_table.R @@ -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) { + if (shiny::isRunning()) 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)) diff --git a/R/tm_file_viewer.R b/R/tm_file_viewer.R index 8564cf6ab..48b755ad5 100644 --- a/R/tm_file_viewer.R +++ b/R/tm_file_viewer.R @@ -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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + temp_dir <- tempfile() if (!dir.exists(temp_dir)) { dir.create(temp_dir, recursive = TRUE) diff --git a/R/tm_front_page.R b/R/tm_front_page.R index 45bde2fe7..250f46433 100644 --- a/R/tm_front_page.R +++ b/R/tm_front_page.R @@ -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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + ns <- session$ns setBookmarkExclude("metadata_button") diff --git a/R/tm_g_association.R b/R/tm_g_association.R index 5c64f6b6e..e9c6d7a19 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -285,6 +285,8 @@ srv_tm_g_association <- function(id, checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) 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, diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index 81aa8799f..4c14af171 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -459,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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + ns <- session$ns data_extract <- list( diff --git a/R/tm_g_distribution.R b/R/tm_g_distribution.R index cec2584af..42f65f4ff 100644 --- a/R/tm_g_distribution.R +++ b/R/tm_g_distribution.R @@ -356,6 +356,8 @@ srv_distribution <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + setBookmarkExclude("params_reset") ns <- session$ns diff --git a/R/tm_g_response.R b/R/tm_g_response.R index d4d00cad1..9abe0c78f 100644 --- a/R/tm_g_response.R +++ b/R/tm_g_response.R @@ -313,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) { + if (shiny::isRunning()) 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) { diff --git a/R/tm_g_scatterplot.R b/R/tm_g_scatterplot.R index 554c2f80f..525d18f68 100644 --- a/R/tm_g_scatterplot.R +++ b/R/tm_g_scatterplot.R @@ -494,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) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + data_extract <- list( x = x, y = y, diff --git a/R/tm_g_scatterplotmatrix.R b/R/tm_g_scatterplotmatrix.R index 58547ff6c..9b872d81e 100644 --- a/R/tm_g_scatterplotmatrix.R +++ b/R/tm_g_scatterplotmatrix.R @@ -266,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) { + if (shiny::isRunning()) 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, diff --git a/R/tm_missing_data.R b/R/tm_missing_data.R index a5ad2af9f..baa7f257f 100644 --- a/R/tm_missing_data.R +++ b/R/tm_missing_data.R @@ -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) { + if (shiny::isRunning()) 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]]) diff --git a/R/tm_outliers.R b/R/tm_outliers.R index 1089c6ade..c7c1f8440 100644 --- a/R/tm_outliers.R +++ b/R/tm_outliers.R @@ -332,6 +332,8 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + ns <- session$ns vars <- list(outlier_var = outlier_var, categorical_var = categorical_var) diff --git a/R/tm_t_crosstable.R b/R/tm_t_crosstable.R index 8ba55ff0b..7e91da5fb 100644 --- a/R/tm_t_crosstable.R +++ b/R/tm_t_crosstable.R @@ -241,6 +241,8 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + selector_list <- teal.transform::data_extract_multiple_srv( data_extract = list(x = x, y = y), datasets = data, diff --git a/R/tm_variable_browser.R b/R/tm_variable_browser.R index 00bb91e99..233616d43 100644 --- a/R/tm_variable_browser.R +++ b/R/tm_variable_browser.R @@ -201,6 +201,8 @@ srv_variable_browser <- function(id, checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.general") + # if there are < this number of unique records then a numeric # variable can be treated as a factor and all factors with < this groups # have their values plotted