Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork51
Fix decorator problems after a good first run#1515
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
1d41fcf10ac47932c1cd436be93d44c41435f7d1b3a86ef14cc80daec4c9fe3121c468bf65ecc9225ed08ebbb4c929f72a925f581d7f553cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -438,33 +438,26 @@ srv_teal_module <- function(id, | ||||||||
| data = data, | ||||||||
| is_active = is_active | ||||||||
| ) | ||||||||
| transformed_teal_data <- srv_transform_teal_data( | ||||||||
| "data_transform", | ||||||||
| data = filtered_teal_data, | ||||||||
| transformators = modules$transformators, | ||||||||
| modules = modules | ||||||||
| ) | ||||||||
| any_transform_failed <- reactive({ | ||||||||
| !inherits(try(transformed_teal_data(), silent = TRUE), "teal_data") && | ||||||||
| inherits(filtered_teal_data(), "teal_data") | ||||||||
Comment on lines +448 to +449 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. As Suggested change
| ||||||||
| }) | ||||||||
| observeEvent(any_transform_failed(), { | ||||||||
| shinyjs::toggleElement("transform_failure_info", condition = any_transform_failed()) | ||||||||
| }) | ||||||||
| summary_data <-reactiveVal(NULL) | ||||||||
| module_teal_data <- eventReactive(transformed_teal_data(),{ | ||||||||
| module_datanames <-.resolve_module_datanames(data =transformed_teal_data(), modules = modules) | ||||||||
| summary_data(transformed_teal_data()[c(module_datanames, ".raw_data")]) | ||||||||
| summary_data() | ||||||||
| }) | ||||||||
| srv_check_module_datanames( | ||||||||
| @@ -473,7 +466,7 @@ srv_teal_module <- function(id, | ||||||||
| modules = modules | ||||||||
| ) | ||||||||
| summary_table <- srv_data_summary("data_summary",summary_data) # Only updates on success | ||||||||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I like that there is not data summary as it cannot be provided, but maybe it was hidden because this makes the different order pop up the error message more for the users. But I prefer to not have hidding elements messing with the layout of the app and leave the section even if empty. | ||||||||
| observeEvent(input$data_summary_toggle, { | ||||||||
| bslib::toggle_sidebar(id = "teal_module_sidebar", open = TRUE) | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -37,9 +37,19 @@ ui_transform_teal_data <- function(id, transformators, class = "well") { | ||
| display_fun( | ||
| bslib::accordion( | ||
| id = ns("wrapper"), | ||
| class = "validation-wrapper", | ||
| bslib::accordion_panel( | ||
| id = ns("wrapper_panel"), | ||
| class = "validation-panel", | ||
| attr(data_mod, "label"), | ||
| icon = bsicons::bs_icon("palette-fill"), | ||
| tags$div( | ||
| class = "disabled-info", | ||
| title = "Disabled until data becomes valid", | ||
| bsicons::bs_icon("info-circle"), | ||
| "Disabled until data becomes valid. Check your inputs." | ||
| ), | ||
| tags$div( | ||
| id = transform_wrapper_id, | ||
| if (is.null(data_mod$ui)) { | ||
| @@ -62,7 +72,7 @@ ui_transform_teal_data <- function(id, transformators, class = "well") { | ||
| #' @export | ||
| #' @rdname module_transform_data | ||
| srv_transform_teal_data <- function(id, data, transformators, modules = NULL) { | ||
| checkmate::assert_string(id) | ||
| assert_reactive(data) | ||
| checkmate::assert_class(modules, "teal_module", null.ok = TRUE) | ||
| @@ -76,39 +86,47 @@ srv_transform_teal_data <- function(id, data, transformators, modules = NULL, is | ||
| names(transformators) <- sprintf("transform_%d", seq_len(length(transformators))) | ||
| moduleServer(id, function(input, output, session) { | ||
| data_original_handled <- reactive(tryCatch(data(), error = function(e) e)) | ||
| module_output <- Reduce( | ||
| function(data_previous, name) { | ||
| moduleServer(name, function(input, output, session) { | ||
| logger::log_debug("srv_transform_teal_data@1 initializing module for { name }.") | ||
| data_out <- reactiveVal() | ||
| # Disable all elements if original data is not yet a teal_data | ||
| observeEvent(data_original_handled(), { | ||
| shinyjs::toggleState( | ||
| "wrapper_panel", | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I think there is a div with id = "wrapper" for modules tabs, but where does this | ||
| condition = inherits(data_original_handled(), "teal_data") | ||
| ) | ||
| }) | ||
| .call_once_when(inherits(data_previous(), "teal_data"), { | ||
| logger::log_debug("srv_teal_transform_teal_data@2 triggering a transform module call for { name }.") | ||
| data_unhandled <- transformators[[name]]$server("transform", data = data_previous) | ||
| data_handled <- reactive(tryCatch(data_unhandled(), error = function(e) e)) | ||
| observeEvent( | ||
| { | ||
| data_handled() | ||
| data_original_handled() | ||
Comment on lines +111 to +112 Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Nice trick, never thought about adding two expressions as a single event. Would be the same as to have only | ||
| }, | ||
| { | ||
| if (inherits(data_original_handled(), "condition")) { | ||
| data_out(data_original_handled()) | ||
| } else if (inherits(data_handled(), "teal_data")) { | ||
| if (!identical(data_handled(), data_out())) { | ||
| data_out(data_handled()) | ||
| } | ||
| } else { | ||
| data_out(data_handled()) | ||
| } | ||
| } | ||
| ) | ||
| is_previous_failed <- reactive({ | ||
| inherits(data_original_handled(), "teal_data") && | ||
| !inherits(try(data_previous(), silent = TRUE), "teal_data") | ||
| }) | ||
| srv_validate_error("silent_error", data_handled, validate_shiny_silent_error = FALSE) | ||
| @@ -118,6 +136,7 @@ srv_transform_teal_data <- function(id, data, transformators, modules = NULL, is | ||
| } | ||
| # When there is no UI (`ui = NULL`) it should still show the errors | ||
| # It is a 1-way operation as there is no UI to correct the state | ||
| observe({ | ||
| if (!inherits(data_handled(), "teal_data") && !is_previous_failed()) { | ||
| shinyjs::show("wrapper") | ||
| @@ -132,7 +151,7 @@ srv_transform_teal_data <- function(id, data, transformators, modules = NULL, is | ||
| "One of previous transformators failed. Please check its inputs.", | ||
| class = "teal-output-warning" | ||
| ) | ||
| } elseif (inherits(data_original_handled(), "teal_data")){ | ||
| shinyjs::enable(transform_wrapper_id) | ||
| shiny::tagList( | ||
| ui_validate_error(session$ns("silent_error")), | ||
| @@ -145,7 +164,8 @@ srv_transform_teal_data <- function(id, data, transformators, modules = NULL, is | ||
| # Ignoring unwanted reactivity breaks during initialization | ||
| reactive({ | ||
| validate(need(!inherits(data_out(), "condition"), message = data_out()$message)) # rethrow message | ||
| data_out() | ||
| }) | ||
| }) | ||
| }, | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| Version: 1.0 | ||
| ProjectId: fa9b6a6c-a470-42a8-bc1a-165563e5ac01 | ||
llrs-roche marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| RestoreWorkspace: Default | ||
| SaveWorkspace: Default | ||
Uh oh!
There was an error while loading.Please reload this page.
