From 0e7500f00cbadc41312f71f1690aa1b93293fefb Mon Sep 17 00:00:00 2001 From: Mahmoud Hallal Date: Thu, 29 Sep 2022 12:38:34 +0200 Subject: [PATCH 1/2] update --- R/tm_g_gh_boxplot.R | 20 ++++++++++++++------ R/tm_g_gh_correlationplot.R | 14 ++++++++++++-- R/tm_g_gh_density_distribution_plot.R | 18 ++++++++++++++---- R/tm_g_gh_lineplot.R | 12 +++++++++++- R/tm_g_gh_scatterplot.R | 12 +++++++++++- R/tm_g_gh_spaghettiplot.R | 12 +++++++++++- 6 files changed, 73 insertions(+), 15 deletions(-) diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index d2914672..8f762038 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -347,7 +347,10 @@ ui_g_boxplot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -586,13 +589,18 @@ srv_g_boxplot <- function(id, DT::formatRound(numeric_cols, 4) }) + joined_qenvs <- reactive(teal.code::join(create_plot(), create_table())) + + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(joined_qenvs())), + title = "Warning", + disabled = reactive(is.null(create_plot()) || is.null(teal.code::get_warnings(joined_qenvs()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", - verbatim_content = reactive( - teal.code::get_code( - teal.code::join(create_plot(), create_table()) - ) - ), + verbatim_content = reactive(teal.code::get_code(joined_qenvs())), title = "Show R Code for Boxplot" ) }) diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index 74ac4d90..75873db1 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -414,7 +414,10 @@ ui_g_correlationplot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -540,7 +543,7 @@ srv_g_correlationplot <- function(id, ) # analysis - private_qenv <- teal.code::new_qenv(tdata2env(data), code = get_code(data)) %>% + private_qenv <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)) %>% teal.code::eval_code( code = bquote({ ANL <- .(as.name(dataset_var)) %>% # nolint @@ -906,6 +909,13 @@ srv_g_correlationplot <- function(id, DT::formatRound(numeric_cols, 4) }) + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(plot_q())), + title = "Warning", + disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", verbatim_content = reactive(teal.code::get_code(plot_q())), diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index 799a3659..98d5ddca 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -272,7 +272,10 @@ ui_g_density_distribution_plot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -414,12 +417,19 @@ srv_g_density_distribution_plot <- function(id, # nolint DT::formatRound(numeric_cols, 2) }) + joined_qenvs <- reactive(teal.code::join(create_plot(), create_table())) + + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(joined_qenvs())), + title = "Warning", + disabled = reactive(is.null(create_plot()) || is.null(teal.code::get_warnings(joined_qenvs()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", verbatim_content = reactive( - teal.code::get_code( - teal.code::join(create_plot(), create_table()) - ) + teal.code::get_code(joined_qenvs()) ), title = "Show R Code for Density Distribution Plot" ) diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index 82a26755..a34f07b2 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -329,7 +329,10 @@ ui_lineplot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -809,6 +812,13 @@ srv_lineplot <- function(id, } ### + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(plot_q)), + title = "Warning", + disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", verbatim_content = reactive(teal.code::get_code(plot_q())), diff --git a/R/tm_g_gh_scatterplot.R b/R/tm_g_gh_scatterplot.R index 0b7508cc..45a3cccc 100644 --- a/R/tm_g_gh_scatterplot.R +++ b/R/tm_g_gh_scatterplot.R @@ -259,7 +259,10 @@ ui_g_scatterplot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -422,6 +425,13 @@ srv_g_scatterplot <- function(id, DT::formatRound(numeric_cols, 4) }) + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(plot_q)), + title = "Warning", + disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", verbatim_content = reactive(teal.code::get_code(plot_q())), diff --git a/R/tm_g_gh_spaghettiplot.R b/R/tm_g_gh_spaghettiplot.R index 39611972..209cd9a2 100644 --- a/R/tm_g_gh_spaghettiplot.R +++ b/R/tm_g_gh_spaghettiplot.R @@ -346,7 +346,10 @@ g_ui_spaghettiplot <- function(id, ...) { ) ) ), - forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"), + forms = tagList( + teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"), + teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") + ), pre_output = a$pre_output, post_output = a$post_output ) @@ -544,6 +547,13 @@ srv_g_spaghettiplot <- function(id, DT::formatRound(numeric_cols, 4) }) + teal.widgets::verbatim_popup_srv( + id = "warning", + verbatim_content = reactive(teal.code::get_warnings(plot_q)), + title = "Warning", + disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + ) + teal.widgets::verbatim_popup_srv( id = "rcode", verbatim_content = reactive(teal.code::get_code(plot_q())), From 46fbb9906c698b2f735433a7192dafe5b612a8a3 Mon Sep 17 00:00:00 2001 From: "Nikolas.Burkoff" Date: Tue, 25 Oct 2022 15:15:36 +0100 Subject: [PATCH 2/2] Simplify warning code --- R/tm_g_gh_boxplot.R | 2 +- R/tm_g_gh_correlationplot.R | 2 +- R/tm_g_gh_density_distribution_plot.R | 2 +- R/tm_g_gh_lineplot.R | 2 +- R/tm_g_gh_scatterplot.R | 2 +- R/tm_g_gh_spaghettiplot.R | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index 45395ed7..bdd979e5 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -598,7 +598,7 @@ srv_g_boxplot <- function(id, id = "warning", verbatim_content = reactive(teal.code::get_warnings(joined_qenvs())), title = "Warning", - disabled = reactive(is.null(create_plot()) || is.null(teal.code::get_warnings(joined_qenvs()))) + disabled = reactive(is.null(teal.code::get_warnings(joined_qenvs()))) ) teal.widgets::verbatim_popup_srv( diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index b916054c..cfbc5587 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -916,7 +916,7 @@ srv_g_correlationplot <- function(id, id = "warning", verbatim_content = reactive(teal.code::get_warnings(plot_q())), title = "Warning", - disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + disabled = reactive(is.null(teal.code::get_warnings(plot_q()))) ) teal.widgets::verbatim_popup_srv( diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index 98d5ddca..3500d2bc 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -423,7 +423,7 @@ srv_g_density_distribution_plot <- function(id, # nolint id = "warning", verbatim_content = reactive(teal.code::get_warnings(joined_qenvs())), title = "Warning", - disabled = reactive(is.null(create_plot()) || is.null(teal.code::get_warnings(joined_qenvs()))) + disabled = reactive(is.null(teal.code::get_warnings(joined_qenvs()))) ) teal.widgets::verbatim_popup_srv( diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index a34f07b2..f5ff80da 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -816,7 +816,7 @@ srv_lineplot <- function(id, id = "warning", verbatim_content = reactive(teal.code::get_warnings(plot_q)), title = "Warning", - disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + disabled = reactive(is.null(teal.code::get_warnings(plot_q()))) ) teal.widgets::verbatim_popup_srv( diff --git a/R/tm_g_gh_scatterplot.R b/R/tm_g_gh_scatterplot.R index 70e728c0..b8dafffb 100644 --- a/R/tm_g_gh_scatterplot.R +++ b/R/tm_g_gh_scatterplot.R @@ -432,7 +432,7 @@ srv_g_scatterplot <- function(id, id = "warning", verbatim_content = reactive(teal.code::get_warnings(plot_q)), title = "Warning", - disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + disabled = reactive(is.null(teal.code::get_warnings(plot_q()))) ) teal.widgets::verbatim_popup_srv( diff --git a/R/tm_g_gh_spaghettiplot.R b/R/tm_g_gh_spaghettiplot.R index 192df749..76e75af1 100644 --- a/R/tm_g_gh_spaghettiplot.R +++ b/R/tm_g_gh_spaghettiplot.R @@ -554,7 +554,7 @@ srv_g_spaghettiplot <- function(id, id = "warning", verbatim_content = reactive(teal.code::get_warnings(plot_q)), title = "Warning", - disabled = reactive(is.null(plot_q()) || is.null(teal.code::get_warnings(plot_q()))) + disabled = reactive(is.null(teal.code::get_warnings(plot_q()))) ) teal.widgets::verbatim_popup_srv(