Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New methods for TealAppDriver: get_active_module_*ws_output #1208

Merged
merged 6 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions R/TealAppDriver.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,44 @@ TealAppDriver <- R6::R6Class( # nolint: object_name.
self$get_value(output = sprintf("%s-%s", self$active_module_ns(), output_id))
},
#' @description
#' Get the output from the module's `teal.widgets::table_with_settings` in the `teal` app.
#' This function will only access outputs from the name space of the current active teal module.
#'
#' @param tws (`character(1)`) `table_with_settings` namespace name.
#' @param which (integer) If there is more than one table, which should be extracted.
#'
#' @return The data.frame with table contents.
get_active_module_tws_output = function(tws, which = 1) {
checkmate::check_number(which, lower = 1)
checkmate::check_string(tws)
table <-
rvest::html_table(
self$get_html_rvest(
self$active_module_element(sprintf("%s-table-with-settings", tws))
),
fill = TRUE
)
if (length(table) == 0) {
data.frame()
} else {
table[[which]]
}
},
#' @description
#' Get the output from the module's `teal.widgets::plot_with_settings` in the `teal` app.
#' This function will only access plots from the name space of the current active teal module.
#'
#' @param pws (`character(1)`) `plot_with_settings` namespace name.
#'
#' @return The `src` attribute as `character(1)` vector.
get_active_module_pws_output = function(pws) {
checkmate::check_string(pws)
self$get_attr(
self$active_module_element(sprintf("%s-plot_main > img", pws)),
"src"
)
},
#' @description
#' Set the input in the module in the `teal` app.
#' This function will only set inputs in the name space of the current active teal module.
#'
Expand Down
46 changes: 46 additions & 0 deletions man/TealAppDriver.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading