Skip to content

Commit d44a257

Browse files
committed
initial test for tm_a_regression
1 parent f1403d6 commit d44a257

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

R/tm_a_regression.R

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,6 @@ ui_a_regression <- function(id, ...) {
282282
tags$div(verbatimTextOutput(ns("text")))
283283
)),
284284
encoding = tags$div(
285-
### Reporter
286-
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
287-
###
288285
tags$label("Encodings", class = "text-primary"),
289286
teal.transform::datanames_input(args[c("response", "regressor")]),
290287
teal.transform::data_extract_ui(
@@ -384,7 +381,6 @@ ui_a_regression <- function(id, ...) {
384381
# Server function for the regression module
385382
srv_a_regression <- function(id,
386383
data,
387-
reporter,
388384
filter_panel_api,
389385
response,
390386
regressor,
@@ -393,7 +389,6 @@ srv_a_regression <- function(id,
393389
ggplot2_args,
394390
default_outlier_label,
395391
decorators) {
396-
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
397392
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
398393
checkmate::assert_class(data, "reactive")
399394
checkmate::assert_class(isolate(data()), "teal_data")
@@ -1034,25 +1029,20 @@ srv_a_regression <- function(id,
10341029
)
10351030

10361031
### REPORTER
1037-
if (with_reporter) {
1038-
card_fun <- function(comment, label) {
1039-
card <- teal::report_card_template(
1040-
title = "Linear Regression Plot",
1041-
label = label,
1042-
with_filter = with_filter,
1043-
filter_panel_api = filter_panel_api
1044-
)
1045-
card$append_text("Plot", "header3")
1046-
card$append_plot(plot_r(), dim = pws$dim())
1047-
if (!comment == "") {
1048-
card$append_text("Comment", "header3")
1049-
card$append_text(comment)
1050-
}
1051-
card$append_src(source_code_r())
1052-
card
1032+
card_fun <- reactive({
1033+
req(plot_r(), source_code_r())
1034+
function() {
1035+
card <- teal.reporter::report_document()
1036+
card <- c(card, c(list("## Plot")))
1037+
# card <- c(card, c(list("## Plot"), list(plot_r())))
1038+
# card <- c(card, list(source_code_r()))
1039+
card
10531040
}
1054-
teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun)
1055-
}
1041+
})
10561042
###
1043+
1044+
list(
1045+
report_card = card_fun
1046+
)
10571047
})
10581048
}

0 commit comments

Comments
 (0)