From ab6a433bf53959498d36a560615aa0e5a4fa4cac Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 18 Mar 2024 10:53:53 +0100 Subject: [PATCH 01/18] namespace funciton in every module server --- R/tm_g_ae_oview.R | 2 ++ R/tm_g_ae_sub.R | 2 ++ R/tm_g_butterfly.R | 2 ++ R/tm_g_events_term_id.R | 2 ++ R/tm_g_heat_bygrade.R | 2 ++ R/tm_g_patient_profile.R | 3 +++ R/tm_g_swimlane.R | 4 ++-- 7 files changed, 15 insertions(+), 2 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 9bd0508c..35471db2 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -209,6 +209,8 @@ srv_g_ae_oview <- function(id, checkmate::assert_class(isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ ANL <- data()[[dataname]] diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index e0e6f53a..227baf9c 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -186,6 +186,8 @@ srv_g_ae_sub <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ ANL <- data()[[dataname]] ADSL <- data()[["ADSL"]] diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 06392139..65806ac2 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -270,6 +270,8 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ ADSL <- data()[["ADSL"]] ANL <- data()[[dataname]] diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 60da36db..02c64d77 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -214,6 +214,8 @@ srv_g_events_term_id <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ iv <- shinyvalidate::InputValidator$new() iv$add_rule("term", shinyvalidate::sv_required( diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 19e68271..889e5a97 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -297,6 +297,8 @@ srv_g_heatmap_bygrade <- function(id, if (!is.na(cm_dataname)) checkmate::assert_names(cm_dataname, subset.of = names(data)) moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ ADSL <- data()[[sl_dataname]] ADEX <- data()[[ex_dataname]] diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index dd3ba667..d649d09d 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -362,7 +362,10 @@ srv_g_patient_profile <- function(id, if (!is.na(lb_dataname)) checkmate::assert_names(lb_dataname, subset.of = names(data)) if (!is.na(cm_dataname)) checkmate::assert_names(cm_dataname, subset.of = names(data)) checkboxes <- c(ex_dataname, ae_dataname, rs_dataname, lb_dataname, cm_dataname) + moduleServer(id, function(input, output, session) { + ns <- session$ns + select_plot <- reactive( vapply(checkboxes, function(x) x %in% input$select_ADaM, logical(1L)) ) diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index c9527551..e0420cbc 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -280,6 +280,8 @@ srv_g_swimlane <- function(id, checkmate::assert_class(shiny::isolate(data()), "teal_data") moduleServer(id, function(input, output, session) { + ns <- session$ns + iv <- reactive({ iv <- shinyvalidate::InputValidator$new() iv$add_rule("bar_var", shinyvalidate::sv_required( @@ -298,7 +300,6 @@ srv_g_swimlane <- function(id, if (dataname == "ADSL" || is.null(marker_shape_var) || is.null(input$marker_pos_var)) { NULL } else { - ns <- session$ns teal.widgets::optionalSelectInput( ns("marker_shape_var"), "Marker Shape", choices = marker_shape_var$choices, @@ -311,7 +312,6 @@ srv_g_swimlane <- function(id, if (dataname == "ADSL" || is.null(marker_color_var) || is.null(input$marker_pos_var)) { NULL } else { - ns <- session$ns teal.widgets::optionalSelectInput( ns("marker_color_var"), "Marker Color", choices = marker_color_var$choices, From e8979a27486efacc19fd47ee08dc4308b777e71a Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 18 Mar 2024 10:55:15 +0100 Subject: [PATCH 02/18] restoreInput in update functions and req in renderUI --- R/tm_g_ae_oview.R | 27 +++++++++++---------- R/tm_g_ae_sub.R | 52 +++++++++++++++++++--------------------- R/tm_g_butterfly.R | 19 +++++++++------ R/tm_g_events_term_id.R | 50 +++++++++++++++++++------------------- R/tm_g_heat_bygrade.R | 7 +++--- R/tm_g_patient_profile.R | 7 +++--- 6 files changed, 83 insertions(+), 79 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 35471db2..e8916081 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -247,12 +247,15 @@ srv_g_ae_oview <- function(id, req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method conf_level <- input$conf_level - updateTextAreaInput(session, - "foot", - value = sprintf( - "Note: %d%% CI is calculated using %s", - round(conf_level * 100), - name_ci(diff_ci_method) + updateTextAreaInput( + inputId = "foot", + value = restoreInput( + ns(foot), + sprintf( + "Note: %d%% CI is calculated using %s", + round(conf_level * 100), + name_ci(diff_ci_method) + ) ) ) }) @@ -270,15 +273,13 @@ srv_g_ae_oview <- function(id, } updateSelectInput( - session, - "arm_ref", - selected = choices[1], - choices = choices + inputId = "arm_ref", + choices = choices, + selected = restoreInput(ns("arm_ref", choices[1L])) ) updateSelectInput( - session, - "arm_trt", - selected = choices[trt_index], + inputId = "arm_trt", + selected = restoreInput(ns("arm_trt", choices[trt_index])), choices = choices ) }) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 227baf9c..191435a2 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -239,16 +239,14 @@ srv_g_ae_sub <- function(id, } updateSelectInput( - session, - "arm_trt", - selected = choices[1], - choices = choices + inputId = "arm_trt", + choices = choices, + selected = restoreInput(ns("arm_trt", choices[1L])) ) updateSelectInput( - session, - "arm_ref", - selected = choices[ref_index], - choices = choices + inputId = "arm_ref", + choices = choices, + selected = restoreInput(ns("arm_ref", choices[ref_index])) ) }) @@ -258,14 +256,16 @@ srv_g_ae_sub <- function(id, trt <- input$arm_trt ref <- input$arm_ref updateTextAreaInput( - session, - "foot", - value = sprintf( - "Note: %d%% CI is calculated using %s\nTRT: %s; CONT: %s", - round(conf_level * 100), - name_ci(diff_ci_method), - trt, - ref + inputId = "foot", + value = restoreInput( + ns("foot"), + sprintf( + "Note: %d%% CI is calculated using %s\nTRT: %s; CONT: %s", + round(conf_level * 100), + name_ci(diff_ci_method), + trt, + ref + ) ) ) }) @@ -273,34 +273,32 @@ srv_g_ae_sub <- function(id, observeEvent(input$groups, { ANL <- data()[[dataname]] output$grouplabel_output <- renderUI({ - grps <- input$groups + grps <- req(input$groups) lo <- lapply(seq_along(grps), function(index) { grp <- grps[index] choices <- levels(ANL[[grp]]) sel <- teal.widgets::optionalSelectInput( - session$ns(sprintf("groups__%s", index)), + ns(sprintf("groups__%s", index)), grp, choices, multiple = TRUE, selected = choices ) textname <- sprintf("text_%s_out", index) - txt <- uiOutput(session$ns(textname)) + txt <- uiOutput(ns(textname)) observeEvent( eventExpr = input[[sprintf("groups__%s", index)]], handlerExpr = { output[[textname]] <- renderUI({ - if (!is.null(input[[sprintf("groups__%s", index)]])) { - l <- input[[sprintf("groups__%s", index)]] - l2 <- lapply(seq_along(l), function(i) { + grps <- req(input[[sprintf("groups__%s", index)]]) + if (!is.null(grps)) { + l2 <- lapply(seq_along(grps), function(i) { nm <- sprintf("groups__%s__level__%s", index, i) - label <- sprintf("Label for %s, Level %s", grp, l[i]) - textInput(session$ns(nm), label, l[i]) + label <- sprintf("Label for %s, Level %s", grp, grps[i]) + textInput(ns(nm), label, grps[i]) }) tagList(textInput( - session$ns( - sprintf("groups__%s__level__%s", index, "all") - ), + ns(sprintf("groups__%s__level__%s", index, "all")), sprintf("Label for %s", grp), grp ), l2) } diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 65806ac2..1e3cdb5c 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -316,7 +316,7 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe session, "right_val", choices = character(0), - selected = character(0) + selected = restoreInput(ns("right_val"), character(0)) ) } else { options$r <- if (right_var %in% names(data()[["ADSL"]])) { @@ -336,8 +336,10 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe options$r[1] } teal.widgets::updateOptionalSelectInput( - session, "right_val", - choices = as.character(options$r), selected = selected, label = "Choose Up To 2:" + inputId = "right_val", + label = "Choose Up To 2:", + choices = as.character(options$r), + selected = restoreInput(ns("right_val"), selected) ) } vars$r <- right_var @@ -352,8 +354,9 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe current_l_var <- isolate(vars$l) if (is.null(left_var)) { teal.widgets::updateOptionalSelectInput( - session, "left_val", - choices = character(0), selected = character(0) + inputId = "left_val", + choices = character(0), + selected = restoreInput(ns("left_val"), character(0)) ) } else { options$l <- if (left_var %in% names(data()[["ADSL"]])) { @@ -374,8 +377,10 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe } teal.widgets::updateOptionalSelectInput( - session, "left_val", - choices = as.character(options$l), selected = selected, label = "Choose Up To 2:" + inputId = "left_val", + label = "Choose Up To 2:", + choices = as.character(options$l), + selected = restoreInput(ns("left_val"), selected) ) } vars$l <- left_var diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 02c64d77..9aeae016 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -244,12 +244,14 @@ srv_g_events_term_id <- function(id, diff_ci_method <- input$diff_ci_method conf_level <- input$conf_level updateTextAreaInput( - session, - "foot", - value = sprintf( - "Note: %d%% CI is calculated using %s", - round(conf_level * 100), - name_ci(diff_ci_method) + inputId = "foot", + value = restoreInput( + ns("foot"), + sprintf( + "Note: %d%% CI is calculated using %s", + round(conf_level * 100), + name_ci(diff_ci_method) + ) ) ) }) @@ -259,16 +261,18 @@ srv_g_events_term_id <- function(id, { sort <- if (is.null(input$sort)) " " else input$sort updateTextInput( - session, - "title", - value = sprintf( - "Common AE Table %s", - c( - "term" = "Sorted by Term", - "riskdiff" = "Sorted by Risk Difference", - "meanrisk" = "Sorted by Mean Risk", - " " = "" - )[sort] + inputId = "title", + value = restoreInput( + ns("title"), + sprintf( + "Common AE Table %s", + c( + "term" = "Sorted by Term", + "riskdiff" = "Sorted by Risk Difference", + "meanrisk" = "Sorted by Mean Risk", + " " = "" + )[sort] + ) ) ) }, @@ -289,16 +293,14 @@ srv_g_events_term_id <- function(id, } updateSelectInput( - session, - "arm_ref", - selected = choices[1], - choices = choices + inputId = "arm_ref", + choices = choices, + selected = restoreInput(ns("arm_ref"), choices[1]) ) updateSelectInput( - session, - "arm_trt", - selected = choices[trt_index], - choices = choices + inputId = "arm_trt", + choices = choices, + selected = restoreInput(ns("arm_trt"), choices[trt_index]) ) }, ignoreNULL = TRUE diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 889e5a97..839a7a07 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -388,10 +388,9 @@ srv_g_heatmap_bygrade <- function(id, choices <- levels(ADCM[[input$conmed_var]]) updateSelectInput( - session, - "conmed_level", - selected = choices[1:3], - choices = choices + inputId = "conmed_level", + choices = choices, + selected = restoreInput(ns("conmed_level"), choices[1:3]) ) }) } diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index d649d09d..dc6d9354 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -377,10 +377,9 @@ srv_g_patient_profile <- function(id, choices_selected <- if (length(choices) > 5) choices[1:5] else choices updateSelectInput( - session, - "lb_var_show", - selected = choices_selected, - choices = choices + inputId = "lb_var_show", + choices = choices, + selected = restoreInput(ns("lb_var_show"), choices_selected) ) }) } From 582478f9b008012951b77aa78d526a364722a177 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 18 Mar 2024 11:10:39 +0100 Subject: [PATCH 03/18] fix check --- R/tm_g_ae_oview.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index e8916081..b2c89de2 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -250,7 +250,7 @@ srv_g_ae_oview <- function(id, updateTextAreaInput( inputId = "foot", value = restoreInput( - ns(foot), + ns("foot"), sprintf( "Note: %d%% CI is calculated using %s", round(conf_level * 100), From 63d7279620323334505cfb1db3c997cb507e70a0 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 16:39:21 +0100 Subject: [PATCH 04/18] syntactic error fix --- R/tm_g_ae_oview.R | 6 +++--- R/tm_g_ae_sub.R | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index ef5fb827..55be5688 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -275,12 +275,12 @@ srv_g_ae_oview <- function(id, updateSelectInput( inputId = "arm_ref", choices = choices, - selected = restoreInput(ns("arm_ref", choices[1L])) + selected = restoreInput(ns("arm_ref"), choices[1L]) ) updateSelectInput( inputId = "arm_trt", - selected = restoreInput(ns("arm_trt", choices[trt_index])), - choices = choices + choices = choices, + selected = restoreInput(ns("arm_trt"), choices[trt_index]) ) }) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 50cd0eae..9660c001 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -241,12 +241,12 @@ srv_g_ae_sub <- function(id, updateSelectInput( inputId = "arm_trt", choices = choices, - selected = restoreInput(ns("arm_trt", choices[1L])) + selected = restoreInput(ns("arm_trt"), choices[1L]) ) updateSelectInput( inputId = "arm_ref", choices = choices, - selected = restoreInput(ns("arm_ref", choices[ref_index])) + selected = restoreInput(ns("arm_ref"), choices[ref_index]) ) }) From 7855e7cd43962c403bc1d7752e7bbe3c778779b9 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 17:14:53 +0100 Subject: [PATCH 05/18] add teal_bookmarkable attributes to all modules --- R/tm_g_ae_oview.R | 4 +++- R/tm_g_ae_sub.R | 4 +++- R/tm_g_butterfly.R | 4 +++- R/tm_g_events_term_id.R | 4 +++- R/tm_g_heat_bygrade.R | 4 +++- R/tm_g_patient_profile.R | 4 +++- R/tm_g_spiderplot.R | 4 +++- R/tm_g_swimlane.R | 4 +++- R/tm_g_waterfall.R | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 55be5688..4e46bb0a 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -105,7 +105,7 @@ tm_g_ae_oview <- function(label, args <- as.list(environment()) - module( + ans <- module( label = label, server = srv_g_ae_oview, server_args = list( @@ -118,6 +118,8 @@ tm_g_ae_oview <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_ae_oview <- function(id, ...) { diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 9660c001..0741a385 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -76,7 +76,7 @@ tm_g_ae_sub <- function(label, lower = plot_width[2], upper = plot_width[3], null.ok = TRUE, .var.name = "plot_width" ) - module( + ans <- module( label = label, server = srv_g_ae_sub, server_args = list( @@ -93,6 +93,8 @@ tm_g_ae_sub <- function(label, ), datanames = c("ADSL", dataname) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_ae_sub <- function(id, ...) { diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 958352fd..50fe61d5 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -146,7 +146,7 @@ tm_g_butterfly <- function(label, args <- as.list(environment()) - module( + ans <- module( label = label, datanames = c("ADSL", dataname), server = srv_g_butterfly, @@ -154,6 +154,8 @@ tm_g_butterfly <- function(label, ui = ui_g_butterfly, ui_args = args ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_butterfly <- function(id, ...) { diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 3b473431..7351c182 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -86,7 +86,7 @@ tm_g_events_term_id <- function(label, args <- as.list(environment()) - module( + ans <- module( label = label, server = srv_g_events_term_id, server_args = list(label = label, dataname = dataname, plot_height = plot_height, plot_width = plot_width), @@ -94,6 +94,8 @@ tm_g_events_term_id <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_events_term_id <- function(id, ...) { diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 9b38060a..1c3f5f3c 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -166,7 +166,7 @@ tm_g_heat_bygrade <- function(label, .var.name = "plot_width" ) - module( + ans <- module( label = label, server = srv_g_heatmap_bygrade, server_args = list( @@ -182,6 +182,8 @@ tm_g_heat_bygrade <- function(label, ui_args = args, datanames = "all" ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_heatmap_bygrade <- function(id, ...) { diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index dc6d9354..47cfc11c 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -185,7 +185,7 @@ tm_g_patient_profile <- function(label = "Patient Profile Plot", .var.name = "plot_width" ) - module( + ans <- module( label = label, ui = ui_g_patient_profile, ui_args = args, @@ -204,6 +204,8 @@ tm_g_patient_profile <- function(label = "Patient Profile Plot", ), datanames = "all" ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_patient_profile <- function(id, ...) { diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 6f917fea..1f9eca8a 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -120,7 +120,7 @@ tm_g_spiderplot <- function(label, ) args <- as.list(environment()) - module( + ans <- module( label = label, datanames = c("ADSL", dataname), server = srv_g_spider, @@ -128,6 +128,8 @@ tm_g_spiderplot <- function(label, ui = ui_g_spider, ui_args = args ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_spider <- function(id, ...) { diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 513f64a2..ec60b1ea 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -148,7 +148,7 @@ tm_g_swimlane <- function(label, checkmate::assert_string(x_label) - module( + ans <- module( label = label, ui = ui_g_swimlane, ui_args = args, @@ -167,6 +167,8 @@ tm_g_swimlane <- function(label, ), datanames = c("ADSL", dataname) ) + attr(ans, "teal_bookmarkable") <- NULL + ans } diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 1ab5d15d..08b0cef8 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -131,7 +131,7 @@ tm_g_waterfall <- function(label, args <- as.list(environment()) - module( + ans <- module( label = label, ui = ui_g_waterfall, ui_args = args, @@ -146,6 +146,8 @@ tm_g_waterfall <- function(label, ), datanames = "all" ) + attr(ans, "teal_bookmarkable") <- NULL + ans } ui_g_waterfall <- function(id, ...) { From aaf6ec313d250c791f5c85d2325c088c66275271 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 17:15:43 +0100 Subject: [PATCH 06/18] teal_bookmarkable: tm_g_ae_sub --- R/tm_g_ae_sub.R | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 0741a385..90e58456 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -93,7 +93,7 @@ tm_g_ae_sub <- function(label, ), datanames = c("ADSL", dataname) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -116,18 +116,7 @@ ui_g_ae_sub <- function(id, ...) { choices = args$arm_var$choices, selected = args$arm_var$selected ), - selectInput( - ns("arm_trt"), - "Treatment", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), - selectInput( - ns("arm_ref"), - "Control", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), + uiOutput(ns("arm_container")), checkboxInput( ns("arm_n"), "Show N in each arm", @@ -227,7 +216,8 @@ srv_g_ae_sub <- function(id, font_size <- decorate_output$font_size pws <- decorate_output$pws - observeEvent(input$arm_var, ignoreNULL = TRUE, { + output$arm_container <- renderUI({ + req(input$arm_var) arm_var <- input$arm_var ANL <- data()[[dataname]] @@ -240,15 +230,9 @@ srv_g_ae_sub <- function(id, ref_index <- 2 } - updateSelectInput( - inputId = "arm_trt", - choices = choices, - selected = restoreInput(ns("arm_trt"), choices[1L]) - ) - updateSelectInput( - inputId = "arm_ref", - choices = choices, - selected = restoreInput(ns("arm_ref"), choices[ref_index]) + tagList( + selectInput(ns("arm_trt"), "Treatment", choices = choices, selected = choices[1L]), + selectInput(ns("arm_ref"), "Control", choices = choices, selected = choices[ref_index]) ) }) From 4ed9006b715c8a55004032c02579bbdedade4be0 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 17:43:11 +0100 Subject: [PATCH 07/18] teal_bookmarkable: tm_g_butterfly --- R/tm_g_butterfly.R | 173 ++++++++++++++++++++++----------------------- 1 file changed, 83 insertions(+), 90 deletions(-) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 50fe61d5..aba14443 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -154,7 +154,7 @@ tm_g_butterfly <- function(label, ui = ui_g_butterfly, ui_args = args ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -189,16 +189,7 @@ ui_g_butterfly <- function(id, ...) { a$right_var$selected, multiple = FALSE ), - teal.widgets::optionalSelectInput( - ns("right_val"), - "Choose Up To 2:", - multiple = TRUE, - options = list( - `max-options` = 2L, - `max-options-text` = "no more than 2", - `actions-box` = FALSE - ) - ), + uiOutput(ns("right_val_container")), teal.widgets::optionalSelectInput( ns("left_var"), "Left Dichotomization Variable", @@ -206,16 +197,7 @@ ui_g_butterfly <- function(id, ...) { a$left_var$selected, multiple = FALSE ), - teal.widgets::optionalSelectInput( - ns("left_val"), - "Choose Up To 2:", - multiple = TRUE, - options = list( - `max-options` = 2L, - `max-options-text` = "no more than 2", - `actions-box` = FALSE - ) - ), + uiOutput(ns("left_val_container")), teal.widgets::optionalSelectInput( ns("category_var"), "Category Variable", @@ -307,88 +289,99 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe options <- reactiveValues(r = NULL, l = NULL) vars <- reactiveValues(r = NULL, l = NULL) - # dynamic options for dichotomization variable - observeEvent(input$right_var, - handlerExpr = { - right_var <- input$right_var - right_val <- isolate(input$right_val) - current_r_var <- isolate(vars$r) - if (is.null(right_var)) { - teal.widgets::updateOptionalSelectInput( - session, - "right_val", - choices = character(0), - selected = restoreInput(ns("right_val"), character(0)) - ) + # Dynamic UI for dichotomization variables. + output$right_val_container <- renderUI({ + req(input$right_var) + + right_var <- input$right_var + right_val <- isolate(input$right_val) + current_r_var <- isolate(vars$r) + + if (is.null(right_var)) { + choices <- character(0L) + selected <- character(0L) + } else { + options$r <- if (right_var %in% names(data()[["ADSL"]])) { + levels(data()[["ADSL"]][[right_var]]) } else { - options$r <- if (right_var %in% names(data()[["ADSL"]])) { - levels(data()[["ADSL"]][[right_var]]) - } else { - levels(data()[[dataname]][[right_var]]) - } + levels(data()[[dataname]][[right_var]]) + } + choices <- options$r - selected <- if (length(right_val) > 0) { - left_over <- right_val[right_val %in% options$r] - if (length(left_over) > 0 && !is.null(current_r_var) && current_r_var == right_var) { - left_over - } else { - options$r[1] - } + selected <- if (length(right_val) > 0) { + left_over <- right_val[right_val %in% options$r] + if (length(left_over) > 0 && !is.null(current_r_var) && current_r_var == right_var) { + left_over } else { options$r[1] } - teal.widgets::updateOptionalSelectInput( - inputId = "right_val", - label = "Choose Up To 2:", - choices = as.character(options$r), - selected = restoreInput(ns("right_val"), selected) - ) + } else { + options$r[1] } - vars$r <- right_var - }, - ignoreNULL = FALSE - ) + } - observeEvent(input$left_var, - handlerExpr = { - left_var <- input$left_var - left_val <- isolate(input$left_val) - current_l_var <- isolate(vars$l) - if (is.null(left_var)) { - teal.widgets::updateOptionalSelectInput( - inputId = "left_val", - choices = character(0), - selected = restoreInput(ns("left_val"), character(0)) - ) + vars$r <- right_var + + teal.widgets::optionalSelectInput( + inputId = ns("right_val"), + label = "Choose Up To 2:", + choices = choices, + selected = selected, + multiple = TRUE, + options = list( + `max-options` = 2L, + `max-options-text` = "no more than 2", + `actions-box` = FALSE + ) + ) + }) + + + output$left_val_container <- renderUI({ + req(input$left_var) + + left_var <- input$left_var + left_val <- isolate(input$left_val) + current_l_var <- isolate(vars$l) + + if (is.null(left_var)) { + choices <- character(0L) + selected <- character(0L) + } else { + options$l <- if (left_var %in% names(data()[["ADSL"]])) { + levels(data()[["ADSL"]][[left_var]]) } else { - options$l <- if (left_var %in% names(data()[["ADSL"]])) { - levels(data()[["ADSL"]][[left_var]]) - } else { - levels(data()[[dataname]][[left_var]]) - } + levels(data()[[dataname]][[left_var]]) + } + choices <- options$l - selected <- if (length(left_val) > 0) { - left_over <- left_val[left_val %in% options$l] - if (length(left_over) > 0 && !is.null(current_l_var) && current_l_var == left_var) { - left_over - } else { - options$l[1] - } + selected <- if (length(left_val) > 0) { + left_over <- left_val[left_val %in% options$l] + if (length(left_over) > 0 && !is.null(current_l_var) && current_l_var == left_var) { + left_over } else { options$l[1] } - - teal.widgets::updateOptionalSelectInput( - inputId = "left_val", - label = "Choose Up To 2:", - choices = as.character(options$l), - selected = restoreInput(ns("left_val"), selected) - ) + } else { + options$l[1] } - vars$l <- left_var - }, - ignoreNULL = FALSE - ) + } + + vars$l <- left_var + + teal.widgets::optionalSelectInput( + ns("left_val"), + "Choose Up To 2:", + choices = choices, + selected = selected, + multiple = TRUE, + options = list( + `max-options` = 2L, + `max-options-text` = "no more than 2", + `actions-box` = FALSE + ) + ) + }) output_q <- shiny::debounce( millis = 200, From b54832f6c714e2844a81a3e18f95f7a4162da958 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:08:31 +0100 Subject: [PATCH 08/18] teal_bookmarkable: tm_g_heat_bygrade --- R/tm_g_heat_bygrade.R | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 1c3f5f3c..2e2cfa31 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -182,7 +182,7 @@ tm_g_heat_bygrade <- function(label, ui_args = args, datanames = "all" ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -255,13 +255,7 @@ ui_g_heatmap_bygrade <- function(id, ...) { selected = args$conmed_var$selected, multiple = FALSE ), - selectInput( - ns("conmed_level"), - "Conmed Levels", - choices = args$conmed_var$choices, - selected = args$conmed_var$selected, - multiple = TRUE - ) + uiOutput(ns("container_conmed_level")) ), ui_g_decorate( ns(NULL), @@ -384,18 +378,21 @@ srv_g_heatmap_bygrade <- function(id, font_size <- decorate_output$font_size pws <- decorate_output$pws - if (!is.na(cm_dataname)) { - observeEvent(input$conmed_var, { - ADCM <- data()[[cm_dataname]] - choices <- levels(ADCM[[input$conmed_var]]) + output$container_conmed_level <- renderUI({ + req(!is.na(cm_dataname)) + req(input$conmed_var) - updateSelectInput( - inputId = "conmed_level", - choices = choices, - selected = restoreInput(ns("conmed_level"), choices[1:3]) - ) - }) - } + ADCM <- data()[[cm_dataname]] + choices <- levels(ADCM[[input$conmed_var]]) + + selectInput( + ns("conmed_level"), + "Conmed Levels", + choices = choices, + selected = choices[1:3], + multiple = TRUE + ) + }) output_q <- shiny::debounce( millis = 200, From f25759ad3767936969f1c0f91ae24b6ed7b084ff Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:16:35 +0100 Subject: [PATCH 09/18] teal_bookmarkable: tm_g_patient_profile --- R/tm_g_patient_profile.R | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 47cfc11c..42d98136 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -204,7 +204,7 @@ tm_g_patient_profile <- function(label = "Patient Profile Plot", ), datanames = "all" ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } @@ -312,13 +312,7 @@ ui_g_patient_profile <- function(id, ...) { selected = a$lb_var$selected, multiple = FALSE ), - selectInput( - ns("lb_var_show"), - "Lab values", - choices = a$lb_var$choices, - selected = a$lb_var$selected, - multiple = TRUE - ) + uiOutput(ns("container_lb_var_show")), ), textInput( ns("x_limit"), @@ -372,19 +366,22 @@ srv_g_patient_profile <- function(id, vapply(checkboxes, function(x) x %in% input$select_ADaM, logical(1L)) ) - if (!is.na(lb_dataname)) { - observeEvent(input$lb_var, ignoreNULL = TRUE, { - ADLB <- data()[[lb_dataname]] - choices <- unique(ADLB[[input$lb_var]]) - choices_selected <- if (length(choices) > 5) choices[1:5] else choices - updateSelectInput( - inputId = "lb_var_show", - choices = choices, - selected = restoreInput(ns("lb_var_show"), choices_selected) - ) - }) - } + output$container_lb_var_show <- renderUI({ + req(!is.na(lb_dataname)) + req(input$lb_var) + + ADLB <- data()[[lb_dataname]] + choices <- unique(ADLB[[input$lb_var]]) + + selectInput( + ns("lb_var_show"), + "Lab values", + choices = choices, + selected = choices[1:5], + multiple = TRUE + ) + }) iv <- reactive({ iv <- shinyvalidate::InputValidator$new() From 4bd79db1633c365a7fe90e5adb6d56a73758674f Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:19:05 +0100 Subject: [PATCH 10/18] teal_bookmarkable: tm_g_spiderplot --- R/tm_g_spiderplot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 1f9eca8a..092806e5 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -128,7 +128,7 @@ tm_g_spiderplot <- function(label, ui = ui_g_spider, ui_args = args ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 2beb641060e891d243b0e1e734d8deacb052e193 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:21:28 +0100 Subject: [PATCH 11/18] teal_bookmarkable: tm_g_swimlane --- R/tm_g_swimlane.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index ec60b1ea..bad1d7ef 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -167,7 +167,7 @@ tm_g_swimlane <- function(label, ), datanames = c("ADSL", dataname) ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From 786591e15dc1ac543de4e5bc0f86a77ae8807db8 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:24:03 +0100 Subject: [PATCH 12/18] teal_bookmarkable: tm_g_waterfall --- R/tm_g_waterfall.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 08b0cef8..2cbde96c 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -146,7 +146,7 @@ tm_g_waterfall <- function(label, ), datanames = "all" ) - attr(ans, "teal_bookmarkable") <- NULL + attr(ans, "teal_bookmarkable") <- TRUE ans } From be0e914ffb6741c39c3ad481b8eabb55bd7f725d Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Mon, 25 Mar 2024 18:24:25 +0100 Subject: [PATCH 13/18] teal_bookmarkable: tm_g_ae_overview and tm_g_events_term_id --- R/tm_g_ae_oview.R | 1 + R/tm_g_events_term_id.R | 1 + 2 files changed, 2 insertions(+) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 4e46bb0a..12259765 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -118,6 +118,7 @@ tm_g_ae_oview <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) + # blocked by https://github.com/insightsengineering/teal.osprey/issues/263 attr(ans, "teal_bookmarkable") <- NULL ans } diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 7351c182..557fd73b 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -94,6 +94,7 @@ tm_g_events_term_id <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) + # blocked by https://github.com/insightsengineering/teal.osprey/issues/263 attr(ans, "teal_bookmarkable") <- NULL ans } From a4b39a400f962a9f61f71012bba127e7b5093fa1 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 26 Mar 2024 12:09:15 +0100 Subject: [PATCH 14/18] teal_bookmarkable: tm_g_ae_overview --- R/tm_g_ae_oview.R | 79 ++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 46 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 12259765..57a7b888 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -118,8 +118,8 @@ tm_g_ae_oview <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) - # blocked by https://github.com/insightsengineering/teal.osprey/issues/263 - attr(ans, "teal_bookmarkable") <- NULL + # not bookmarkable: ui_g_decorate cannot be moved to server b/c of args$fontsize + attr(ans, "teal_bookmarkable") <- FALSE ans } @@ -141,18 +141,7 @@ ui_g_ae_oview <- function(id, ...) { selected = args$arm_var$selected, multiple = FALSE ), - selectInput( - ns("arm_ref"), - "Control", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), - selectInput( - ns("arm_trt"), - "Treatment", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), + uiOutput(ns("container_arm")), selectInput( ns("flag_var_anl"), "Flags", @@ -246,47 +235,45 @@ srv_g_ae_oview <- function(id, font_size <- decorate_output$font_size pws <- decorate_output$pws + output$container_arm <- renderUI({ + req(input$arm_var) + + ANL <- data()[[dataname]] + choices <- levels(ANL[[input$arm_var]]) + + trt_index <- if (length(choices) == 1) 1 else 2 + + tagList( + selectInput( + ns("arm_ref"), + "Control", + choices = choices, + selected = choices[1L] + ), + selectInput( + ns("arm_trt"), + "Treatment", + choices = choices, + selected = choices[trt_index] + ) + ) + }) + observeEvent(list(input$diff_ci_method, input$conf_level), { req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method conf_level <- input$conf_level updateTextAreaInput( - inputId = "foot", - value = restoreInput( - ns("foot"), - sprintf( - "Note: %d%% CI is calculated using %s", - round(conf_level * 100), - name_ci(diff_ci_method) - ) + session, + "foot", + value = sprintf( + "Note: %d%% CI is calculated using %s", + round(conf_level * 100), + name_ci(diff_ci_method) ) ) }) - observeEvent(input$arm_var, ignoreNULL = TRUE, { - ANL <- data()[[dataname]] - arm_var <- input$arm_var - arm_val <- ANL[[arm_var]] - choices <- levels(arm_val) - - if (length(choices) == 1) { - trt_index <- 1 - } else { - trt_index <- 2 - } - - updateSelectInput( - inputId = "arm_ref", - choices = choices, - selected = restoreInput(ns("arm_ref"), choices[1L]) - ) - updateSelectInput( - inputId = "arm_trt", - choices = choices, - selected = restoreInput(ns("arm_trt"), choices[trt_index]) - ) - }) - output_q <- shiny::debounce( millis = 200, r = reactive({ From 4f53417b68cd47bd1a8325b79600b60b3b2c1f2b Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 26 Mar 2024 12:09:42 +0100 Subject: [PATCH 15/18] teal_bookmarkable: tm_g_events_term_id --- R/tm_g_events_term_id.R | 101 ++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 61 deletions(-) diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 557fd73b..5c147a67 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -94,8 +94,8 @@ tm_g_events_term_id <- function(label, ui_args = args, datanames = c("ADSL", dataname) ) - # blocked by https://github.com/insightsengineering/teal.osprey/issues/263 - attr(ans, "teal_bookmarkable") <- NULL + # not bookmarkable: ui_g_decorate cannot be moved to server b/c of args$fontsize + attr(ans, "teal_bookmarkable") <- FALSE ans } @@ -122,18 +122,7 @@ ui_g_events_term_id <- function(id, ...) { choices = args$arm_var$choices, selected = args$arm_var$selected ), - selectInput( - ns("arm_ref"), - "Control", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), - selectInput( - ns("arm_trt"), - "Treatment", - choices = args$arm_var$choices, - selected = args$arm_var$selected - ), + uiOutput(ns("container_arm")), teal.widgets::optionalSelectInput( ns("sort"), "Sort By", @@ -247,67 +236,57 @@ srv_g_events_term_id <- function(id, diff_ci_method <- input$diff_ci_method conf_level <- input$conf_level updateTextAreaInput( - inputId = "foot", - value = restoreInput( - ns("foot"), - sprintf( - "Note: %d%% CI is calculated using %s", - round(conf_level * 100), - name_ci(diff_ci_method) - ) + session, + "foot", + value = sprintf( + "Note: %d%% CI is calculated using %s", + round(conf_level * 100), + name_ci(diff_ci_method) ) ) }) - - observeEvent(input$sort, - { - sort <- if (is.null(input$sort)) " " else input$sort - updateTextInput( - inputId = "title", - value = restoreInput( - ns("title"), - sprintf( - "Common AE Table %s", - c( - "term" = "Sorted by Term", - "riskdiff" = "Sorted by Risk Difference", - "meanrisk" = "Sorted by Mean Risk", - " " = "" - )[sort] - ) - ) + observeEvent(input$sort, { + sort <- if (is.null(input$sort)) " " else input$sort + updateTextInput( + session, + "title", + value = sprintf( + "Common AE Table %s", + c( + "term" = "Sorted by Term", + "riskdiff" = "Sorted by Risk Difference", + "meanrisk" = "Sorted by Mean Risk", + " " = "" + )[sort] ) - }, + )}, ignoreNULL = FALSE ) - observeEvent(input$arm_var, - { - arm_var <- input$arm_var - ANL <- data()[[dataname]] + output$container_arm <- renderUI({ + req(input$arm_var) - choices <- levels(ANL[[arm_var]]) + ANL <- data()[[dataname]] + choices <- levels(ANL[[input$arm_var]]) - if (length(choices) == 1) { - trt_index <- 1 - } else { - trt_index <- 2 - } + trt_index <- if (length(choices) == 1) 1 else 2 - updateSelectInput( - inputId = "arm_ref", + tagList( + selectInput( + ns("arm_ref"), + "Control", choices = choices, - selected = restoreInput(ns("arm_ref"), choices[1]) - ) - updateSelectInput( - inputId = "arm_trt", + selected = choices[1L] + ), + selectInput( + ns("arm_trt"), + "Treatment", choices = choices, - selected = restoreInput(ns("arm_trt"), choices[trt_index]) + selected = choices[trt_index] ) - }, - ignoreNULL = TRUE - ) + ) + }) output_q <- reactive({ ANL <- data()[[dataname]] From 0555cc826f7bcc7d049665e188a51c8c429bfb0a Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 26 Mar 2024 12:09:53 +0100 Subject: [PATCH 16/18] teal_bookmarkable: tm_g_ae_sub --- R/tm_g_ae_sub.R | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 90e58456..2a403dd9 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -93,7 +93,8 @@ tm_g_ae_sub <- function(label, ), datanames = c("ADSL", dataname) ) - attr(ans, "teal_bookmarkable") <- TRUE + # not bookmarkable: ui_g_decorate cannot be moved to server b/c of args$fontsize + attr(ans, "teal_bookmarkable") <- FALSE ans } @@ -242,16 +243,14 @@ srv_g_ae_sub <- function(id, trt <- input$arm_trt ref <- input$arm_ref updateTextAreaInput( - inputId = "foot", - value = restoreInput( - ns("foot"), - sprintf( - "Note: %d%% CI is calculated using %s\nTRT: %s; CONT: %s", - round(conf_level * 100), - name_ci(diff_ci_method), - trt, - ref - ) + session, + "foot", + value = sprintf( + "Note: %d%% CI is calculated using %s\nTRT: %s; CONT: %s", + round(conf_level * 100), + name_ci(diff_ci_method), + trt, + ref ) ) }) From 49b73bd7d618200f8a9cb7e1e581b3c353b20663 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:12:52 +0000 Subject: [PATCH 17/18] [skip style] [skip vbump] Restyle files --- R/tm_g_events_term_id.R | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 5c147a67..609b80af 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -246,21 +246,23 @@ srv_g_events_term_id <- function(id, ) }) - observeEvent(input$sort, { - sort <- if (is.null(input$sort)) " " else input$sort - updateTextInput( - session, - "title", - value = sprintf( - "Common AE Table %s", - c( - "term" = "Sorted by Term", - "riskdiff" = "Sorted by Risk Difference", - "meanrisk" = "Sorted by Mean Risk", - " " = "" - )[sort] + observeEvent(input$sort, + { + sort <- if (is.null(input$sort)) " " else input$sort + updateTextInput( + session, + "title", + value = sprintf( + "Common AE Table %s", + c( + "term" = "Sorted by Term", + "riskdiff" = "Sorted by Risk Difference", + "meanrisk" = "Sorted by Mean Risk", + " " = "" + )[sort] + ) ) - )}, + }, ignoreNULL = FALSE ) From db4b5f6b4ff2ee732a94356d53b8613de8ebfa34 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Tue, 26 Mar 2024 12:14:14 +0100 Subject: [PATCH 18/18] trigger