Skip to content

Commit

Permalink
fix notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
gogonzo committed Nov 6, 2023
1 parent d6b8d2f commit 0ce0eb5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/data-transform_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#' [teal::init()]. This helps in case when app developer wants to use `teal` app
#' where `data` can be influenced by app user. For example, app developer can create
#' `teal` app which allows user to connect to database and then use data from this database.
#' @param ... (`any`) arguments passed to `server` function.
#' @param ui (`function(id)`) function to create UI
#' @param server (`function(id)`) `shiny` server which returns `teal_data` object wrapped in
#' @param ... (`any`) arguments passed to `server` function.
#' `reactive`. `server` should have `id` argument and exactly the same formals as specified in `...`.
#' @export
delayed_data <- function(ui, server, ...) {
Expand Down
13 changes: 10 additions & 3 deletions R/module_teal_with_splash.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,30 @@ srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) {
data <- raw_data()
if (inherits(data, "qenv.error")) {
#
showNotification(sprintf("Error: %s", data$message))
showNotification(sprintf("Error: %s", data$message), type = "error")
logger::log_error(data$message)
return(NULL)
}
if (!inherits(data, "teal_data")) {
msg <- "Error: server must return 'teal_data' object"
showNotification(msg, type = "error")
logger::log_error(msg)
return(NULL)
}


is_modules_ok <- check_modules_datanames(modules, teal.data::datanames(data))
is_filter_ok <- check_filter_datanames(filter, teal.data::datanames(data))

if (!isTRUE(is_modules_ok)) {
showNotification(is_modules_ok)
showNotification(is_modules_ok, type = "error")
logger::log_error(is_modules_ok)
# NULL won't trigger observe which waits for raw_data()
# we will need to consider validate process for filtered data and modules!
return(NULL)
}
if (!isTRUE(is_filter_ok)) {
showNotification(is_filter_ok)
showNotification(is_filter_ok, type = "warning")
logger::log_warn(is_filter_ok)
# we allow app to continue if applied filters are outside
# of possible data range
Expand Down

0 comments on commit 0ce0eb5

Please sign in to comment.