Skip to content
Snippets Groups Projects
Commit 65cbb1b6 authored by arsenij.ustjanzew's avatar arsenij.ustjanzew
Browse files

removed default value and added warning if the package name could not be determined.

parent 890c8657
No related branches found
No related tags found
1 merge request!18Generic htm lwidget
Pipeline #129954 canceled
......@@ -5,7 +5,7 @@
#' @param package The name of the R package that defines the class(object).
#' @param page The name of the page to add the object to.
#' @param title An optional component title.
add_vis_object <- function(dashboard, object, package = NULL, page = "default", title = NULL, ...){
add_vis_object <- function(dashboard, object, package, page = "default", title = NULL, ...){
sanitised_page <- i2dash:::.create_page_name(page)
if (!(sanitised_page %in% names(dashboard@pages))) {
warning(sprintf("i2dashboard does not contain a page named '%s'", sanitised_page))
......@@ -17,8 +17,6 @@ add_vis_object <- function(dashboard, object, package = NULL, page = "default",
return(dashboard)
}
if(is.null(package)) package <- "unknown package name"
# Create random component for RDS filename
component_id <- paste0("obj_", stringi::stri_rand_strings(1, 6))
......@@ -71,5 +69,9 @@ setMethod("add_component",
return(dashboard)
}
package <- packageSlot(component)
if(is.null(package)) {
warning("The package name of this HTML widget could not be determined. The component was not added to the dashboard.")
return(dashboard)
}
add_vis_object(dashboard, component, package, page, title, ...)
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment