Skip to content

Commit 0bd7835

Browse files
averissimom7prgithub-actions[bot]
authored
Remove source code button from modules' encoding panel (#1425)
# Pull Request - Part of insightsengineering/teal#1534 Companion to: - insightsengineering/teal#1592 - insightsengineering/teal.reporter#401 Other similar PRs in modules: - #1425 - insightsengineering/teal.modules.general#917 - insightsengineering/teal.goshawk#366 - insightsengineering/teal.osprey#319 --------- Signed-off-by: Marcin <[email protected]> Co-authored-by: m7pr <[email protected]> Co-authored-by: Marcin <[email protected]> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent fe473ce commit 0bd7835

37 files changed

+3
-414
lines changed

R/tm_a_gee.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,6 @@ ui_gee <- function(id, ...) {
390390
),
391391
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(a$decorators, "table"))
392392
),
393-
forms = tagList(
394-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
395-
),
396393
pre_output = a$pre_output,
397394
post_output = a$post_output
398395
)
@@ -604,14 +601,6 @@ srv_gee <- function(id,
604601
table_r = table_r
605602
)
606603

607-
# Render R code
608-
source_code_r <- reactive(teal.code::get_code(req(decorated_table_q())))
609-
teal.widgets::verbatim_popup_srv(
610-
id = "rcode",
611-
verbatim_content = source_code_r,
612-
title = label
613-
)
614-
615604
decorated_table_q
616605
})
617606
}

R/tm_a_mmrm.R

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -886,9 +886,6 @@ ui_mmrm <- function(id, ...) {
886886
)
887887
)
888888
)
889-
),
890-
forms = tagList(
891-
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
892889
)
893890
),
894891
pre_output = a$pre_output,
@@ -921,9 +918,6 @@ srv_mmrm <- function(id,
921918

922919
moduleServer(id, function(input, output, session) {
923920
teal.logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
924-
# Reactive responsible for sending a disable/enable signal
925-
# to show R code and debug info buttons
926-
disable_r_code <- reactiveVal(FALSE)
927921

928922
observeEvent(input[[extract_input("cov_var", dataname)]], {
929923
# update covariates as actual variables
@@ -1155,26 +1149,22 @@ srv_mmrm <- function(id,
11551149
})
11561150

11571151
# Event handler:
1158-
# When the "Fit Model" button is clicked, hide initial message, show title, disable model fit and enable
1159-
# show R code buttons.
1152+
# When the "Fit Model" button is clicked, hide initial message, show title, disable model fit button.
11601153
shinyjs::onclick("button_start", {
11611154
state$input <- mmrm_inputs_reactive()
11621155
shinyjs::hide("null_input_msg")
11631156
shinyjs::disable("button_start")
11641157
success <- try(mmrm_fit(), silent = TRUE)
11651158
if (!inherits(success, "try-error")) {
11661159
shinyjs::show("mmrm_title")
1167-
disable_r_code(FALSE)
11681160
} else {
11691161
shinyjs::hide("mmrm_title")
1170-
# show R code and debug info buttons will have already been hidden by disable_r_code
11711162
}
11721163
})
11731164

11741165
# all the inputs and data that can be out of sync with the fitted model
11751166
mmrm_inputs_reactive <- reactive({
11761167
shinyjs::disable("button_start")
1177-
disable_r_code(TRUE)
11781168
teal::validate_inputs(iv_r())
11791169
encoding_inputs <- lapply(
11801170
sync_inputs,
@@ -1243,9 +1233,7 @@ srv_mmrm <- function(id,
12431233
# disable the show R code button and show warning message
12441234
observeEvent(mmrm_inputs_reactive(), {
12451235
shinyjs::enable("button_start")
1246-
disable_r_code(TRUE)
12471236
if (!state_has_changed()) {
1248-
disable_r_code(FALSE)
12491237
shinyjs::disable("button_start")
12501238
}
12511239
})
@@ -1562,19 +1550,9 @@ srv_mmrm <- function(id,
15621550
show_hide_signal = reactive(!show_plot_rv())
15631551
)
15641552

1565-
# Show R code once button is pressed.
1566-
source_code_r <- reactive(
1567-
teal.code::get_code(req(decorated_objs_q[[obj_ix_r()]]()))
1568-
)
1569-
teal.widgets::verbatim_popup_srv(
1570-
id = "rcode",
1571-
verbatim_content = source_code_r,
1572-
disabled = disable_r_code,
1573-
title = label
1574-
)
1575-
15761553
set_chunk_dims(pws, reactive({
15771554
decorated_objs_q[[obj_ix_r()]]()
15781555
}))
1556+
15791557
})
15801558
}

R/tm_g_barchart_simple.R

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,6 @@ ui_g_barchart_simple <- function(id, ...) {
353353
)
354354
)
355355
),
356-
forms = tagList(
357-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
358-
),
359356
pre_output = args$pre_output,
360357
post_output = args$post_output
361358
)
@@ -594,15 +591,8 @@ srv_g_barchart_simple <- function(id,
594591
width = plot_width
595592
)
596593

597-
# Render R code
598-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q_code())))
599-
teal.widgets::verbatim_popup_srv(
600-
id = "rcode",
601-
verbatim_content = source_code_r,
602-
title = label
603-
)
604-
605594
set_chunk_dims(pws, decorated_all_q_code)
595+
###
606596
})
607597
}
608598

R/tm_g_ci.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,6 @@ ui_g_ci <- function(id, ...) {
397397
),
398398
ui_decorate_teal_data(ns("decorator"), decorators = select_decorators(args$decorators, "plot"))
399399
),
400-
forms = tagList(
401-
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
402-
),
403400
pre_output = args$pre_output,
404401
post_output = args$post_output
405402
)
@@ -520,14 +517,6 @@ srv_g_ci <- function(id,
520517
# Outputs to render.
521518
plot_r <- reactive(decorated_plot_q()[["plot"]])
522519

523-
# Render R code
524-
source_code_r <- reactive(teal.code::get_code(req(decorated_plot_q())))
525-
teal.widgets::verbatim_popup_srv(
526-
id = "rcode",
527-
verbatim_content = source_code_r,
528-
title = label
529-
)
530-
531520
pws <- teal.widgets::plot_with_settings_srv(
532521
id = "myplot",
533522
plot_r = plot_r,

R/tm_g_forest_rsp.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,6 @@ ui_g_forest_rsp <- function(id, ...) {
527527
)
528528
)
529529
),
530-
forms = tagList(
531-
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
532-
),
533530
pre_output = a$pre_output,
534531
post_output = a$post_output
535532
)
@@ -826,14 +823,6 @@ srv_g_forest_rsp <- function(id,
826823
width = plot_width
827824
)
828825

829-
# Render R code
830-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
831-
teal.widgets::verbatim_popup_srv(
832-
id = "rcode",
833-
verbatim_content = source_code_r,
834-
title = label
835-
)
836-
837826
set_chunk_dims(pws, decorated_all_q)
838827
})
839828
}

R/tm_g_forest_tte.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,6 @@ ui_g_forest_tte <- function(id, ...) {
528528
)
529529
)
530530
),
531-
forms = tagList(
532-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
533-
),
534531
pre_output = a$pre_output,
535532
post_output = a$post_output
536533
)
@@ -761,14 +758,6 @@ srv_g_forest_tte <- function(id,
761758
width = plot_width
762759
)
763760

764-
# Render R code
765-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
766-
teal.widgets::verbatim_popup_srv(
767-
id = "rcode",
768-
verbatim_content = source_code_r,
769-
title = label
770-
)
771-
772761
set_chunk_dims(pws, decorated_all_q)
773762
})
774763
}

R/tm_g_ipp.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ ui_g_ipp <- function(id, ...) {
475475
)
476476
)
477477
),
478-
forms = tagList(
479-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
480-
),
481478
pre_output = a$pre_output,
482479
post_output = a$post_output
483480
)
@@ -653,14 +650,6 @@ srv_g_ipp <- function(id,
653650
width = plot_width
654651
)
655652

656-
# Render R code
657-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
658-
teal.widgets::verbatim_popup_srv(
659-
id = "rcode",
660-
verbatim_content = source_code_r,
661-
title = label
662-
)
663-
664653
set_chunk_dims(pws, decorated_all_q)
665654
})
666655
}

R/tm_g_km.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -641,9 +641,6 @@ ui_g_km <- function(id, ...) {
641641
)
642642
)
643643
),
644-
forms = tagList(
645-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
646-
),
647644
pre_output = a$pre_output,
648645
post_output = a$post_output
649646
)
@@ -874,14 +871,6 @@ srv_g_km <- function(id,
874871
width = plot_width
875872
)
876873

877-
# Render R code
878-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
879-
teal.widgets::verbatim_popup_srv(
880-
id = "rcode",
881-
verbatim_content = source_code_r,
882-
title = label
883-
)
884-
885874
set_chunk_dims(pws, decorated_all_q)
886875
})
887876
}

R/tm_g_lineplot.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,6 @@ ui_g_lineplot <- function(id, ...) {
537537
)
538538
)
539539
),
540-
forms = tagList(
541-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
542-
),
543540
pre_output = a$pre_output,
544541
post_output = a$post_output
545542
)
@@ -697,14 +694,6 @@ srv_g_lineplot <- function(id,
697694
width = plot_width
698695
)
699696

700-
# Render R code
701-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
702-
teal.widgets::verbatim_popup_srv(
703-
id = "rcode",
704-
verbatim_content = source_code_r,
705-
title = label
706-
)
707-
708697
set_chunk_dims(pws, decorated_all_q)
709698
})
710699
}

R/tm_g_pp_adverse_events.R

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,6 @@ ui_g_adverse_events <- function(id, ...) {
439439
)
440440
)
441441
),
442-
forms = tagList(
443-
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
444-
),
445442
pre_output = ui_args$pre_output,
446443
post_output = ui_args$post_output
447444
)
@@ -638,14 +635,6 @@ srv_g_adverse_events <- function(id,
638635
c(table_q(), decorated_all_q_plot())
639636
)
640637

641-
# Render R code
642-
source_code_r <- reactive(teal.code::get_code(req(decorated_all_q())))
643-
teal.widgets::verbatim_popup_srv(
644-
id = "rcode",
645-
verbatim_content = source_code_r,
646-
title = label
647-
)
648-
649638
set_chunk_dims(pws, decorated_all_q)
650639
})
651640
}

0 commit comments

Comments
 (0)