-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
904 teal_data in teal_module #924
Conversation
…gineering/teal into 904_tdata_in_modules@refactor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example_module
doesn't need downgraded data. .tdata_downgrade
isn't needed at all - why would someone downgrade module which works with teal_data
?
If you apply my comments and fix example_module to be as follows - everything should work (tested already on my side)
example_module
example_module <- function(label = "example teal module", datanames = "all") {
checkmate::assert_string(label)
module(
label,
ui = function(id) {
ns <- NS(id)
teal.widgets::standard_layout(
output = dataTableOutput(ns("table")),
encoding = div(
selectInput(ns("dataname"), "Choose a dataset", choices = NULL),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
)
)
},
server = function(id, data) {
checkmate::assert_class(data, "reactive")
moduleServer(id, function(input, output, session) {
observeEvent(data(), {
updateSelectInput(session, "dataname", choices = teal.data::datanames(data()))
})
output$table <- renderDataTable(data()[[input$dataname]])
teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(data())),
title = "Association Plot"
)
})
},
datanames = datanames
)
}
Code Coverage Summary
Diff against main
Results for commit: 959eddd Minimum allowed coverage is ♻️ This comment has been updated with latest results |
As previously discussed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean!
Closes #904
Added
as_tdata
function to convert the data object received by modules fromteal_data
totdata
class.Modified
srv_nested_tabs.teal_module
now returns ateal_data
.To make a module handle a
teal_data
object without (much) modification, the incomingdata
argument should be downgraded to the old class.Also modified
example_module
to handleteal_data
objects.