Skip to content

Commit

Permalink
warnings qenv (#191)
Browse files Browse the repository at this point in the history
Co-authored-by: Nikolas.Burkoff <nikolas.burkoff@roche.com>
  • Loading branch information
mhallal1 and Nikolas.Burkoff authored Oct 27, 2022
1 parent d9f14c7 commit fff01f0
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 15 deletions.
20 changes: 14 additions & 6 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -589,13 +592,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(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"
)
})
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -909,6 +912,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(teal.code::get_warnings(plot_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(plot_q())),
Expand Down
18 changes: 14 additions & 4 deletions R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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(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"
)
Expand Down
12 changes: 11 additions & 1 deletion R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -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(teal.code::get_warnings(plot_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(plot_q())),
Expand Down
12 changes: 11 additions & 1 deletion R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -425,6 +428,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(teal.code::get_warnings(plot_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(plot_q())),
Expand Down
12 changes: 11 additions & 1 deletion R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down Expand Up @@ -547,6 +550,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(teal.code::get_warnings(plot_q())))
)

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

0 comments on commit fff01f0

Please sign in to comment.