From 24678ffa3da664c3f1c06e0bfff3a1694ab9b3f5 Mon Sep 17 00:00:00 2001 From: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:49:23 +0200 Subject: [PATCH] Config/Needs/verdepcheck cleanup; init() cleanup (#1313) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pawel Rucki <12943682+pawelru@users.noreply.github.com> Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Dawid Kałędkowski <6959016+gogonzo@users.noreply.github.com> --- DESCRIPTION | 9 +++--- R/init.R | 55 +++++++++++++++++----------------- man/init.Rd | 44 +++++++++++++-------------- man/module_bookmark_manager.Rd | 6 ++-- man/module_filter_data.Rd | 6 ++-- man/module_init_data.Rd | 10 +++---- man/module_teal.Rd | 22 +++++++------- man/module_teal_module.Rd | 6 ++-- man/module_teal_with_splash.Rd | 22 +++++++------- man/modules_depth.Rd | 2 +- 10 files changed, 88 insertions(+), 94 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 48f3071be5..6ed8623eb8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -75,13 +75,12 @@ RdMacros: Config/Needs/verdepcheck: rstudio/shiny, insightsengineering/teal.data, insightsengineering/teal.slice, mllg/checkmate, HenrikBengtsson/future, jeroen/jsonlite, r-lib/lifecycle, - daroczig/logger, tidyverse/magrittr, rstudio/promises, rstudio/renv, - r-lib/rlang, daattali/shinyjs, insightsengineering/teal.logger, + daroczig/logger, rstudio/promises, rstudio/renv, + r-lib/rlang, daattali/shinyjs, insightsengineering/teal.code, insightsengineering/teal.logger, insightsengineering/teal.reporter, insightsengineering/teal.widgets, rstudio/bslib, yihui/knitr, bioc::MultiAssayExperiment, r-lib/R6, - rstudio/rmarkdown, rstudio/shinyvalidate, - insightsengineering/teal.code, r-lib/testthat, r-lib/withr, - yaml=vubiostat/r-yaml + rstudio/rmarkdown, tidyverse/rvest, rstudio/shinytest2, rstudio/shinyvalidate, + r-lib/testthat, r-lib/withr, yaml=vubiostat/r-yaml Config/Needs/website: insightsengineering/nesttemplate Encoding: UTF-8 Language: en-US diff --git a/R/init.R b/R/init.R index 092c263dd5..baf8ffcd90 100644 --- a/R/init.R +++ b/R/init.R @@ -10,32 +10,29 @@ #' End-users: This is the most important function for you to start a #' `teal` app that is composed of `teal` modules. #' -#' @details -#' When initializing the `teal` app, if `datanames` are not set for the `teal_data` object, -#' defaults from the `teal_data` environment will be used. -#' #' @param data (`teal_data` or `teal_data_module`) -#' For constructing the data object, refer to [teal_data()] and [teal_data_module()]. +#' For constructing the data object, refer to [teal_data()] and [teal_data_module()]. +#' If `datanames` are not set for the `teal_data` object, defaults from the `teal_data` environment will be used. #' @param modules (`list` or `teal_modules` or `teal_module`) -#' nested list of `teal_modules` or `teal_module` objects or a single +#' Nested list of `teal_modules` or `teal_module` objects or a single #' `teal_modules` or `teal_module` object. These are the specific output modules which #' will be displayed in the `teal` application. See [modules()] and [module()] for #' more details. -#' @param filter (`teal_slices`) -#' Specifies the initial filter using [teal_slices()]. -#' @param title (`shiny.tag` or `character(1)`) -#' The browser window title. Defaults to a title "teal app" with the icon of NEST. +#' @param filter (`teal_slices`) Optionally, +#' specifies the initial filter using [teal_slices()]. +#' @param title (`shiny.tag` or `character(1)`) Optionally, +#' the browser window title. Defaults to a title "teal app" with the icon of NEST. #' Can be created using the `build_app_title()` or #' by passing a valid `shiny.tag` which is a head tag with title and link tag. -#' @param header (`shiny.tag` or `character(1)`) -#' The header of the app. -#' @param footer (`shiny.tag` or `character(1)`) -#' The footer of the app. -#' @param id (`character`) optional -#' string specifying the `shiny` module id in cases it is used as a `shiny` module +#' @param header (`shiny.tag` or `character(1)`) Optionally, +#' the header of the app. +#' @param footer (`shiny.tag` or `character(1)`) Optionally, +#' the footer of the app. +#' @param id (`character`) Optionally, +#' a string specifying the `shiny` module id in cases it is used as a `shiny` module #' rather than a standalone `shiny` app. This is a legacy feature. -#' @param landing_popup (`teal_module`) optional -#' A `landing_popup_module` to show up as soon as the teal app is initialized. +#' @param landing_popup (`teal_module_landing`) Optionally, +#' a `landing_popup_module` to show up as soon as the teal app is initialized. #' #' @return Named list containing server and UI functions. #' @@ -45,13 +42,12 @@ #' #' @examples #' app <- init( -#' data = teal_data( -#' new_iris = transform(iris, id = seq_len(nrow(iris))), -#' new_mtcars = transform(mtcars, id = seq_len(nrow(mtcars))), -#' code = " +#' data = within( +#' teal_data(), +#' { #' new_iris <- transform(iris, id = seq_len(nrow(iris))) #' new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars))) -#' " +#' } #' ), #' modules = modules( #' module( @@ -89,7 +85,7 @@ #' ), #' title = "App title", #' header = tags$h1("Sample App"), -#' footer = tags$p("Copyright 2017 - 2023") +#' footer = tags$p("Sample footer") #' ) #' if (interactive()) { #' shinyApp(app$ui, app$server) @@ -166,9 +162,8 @@ init <- function(data, if (length(landing) == 1L) { landing_popup <- landing[[1L]] modules <- drop_module(modules, "teal_module_landing") - # TODO: verify the version before release. lifecycle::deprecate_soft( - when = "0.16", + when = "0.15.3", what = "landing_popup_module()", details = paste( "Pass `landing_popup_module` to the `landing_popup` argument of the `init` ", @@ -249,8 +244,12 @@ init <- function(data, res <- list( ui = function(request) { ui_teal( - id = ns("teal"), data = if (inherits(data, "teal_data_module")) data, - modules = modules, title = title, header = header, footer = footer + id = ns("teal"), + data = if (inherits(data, "teal_data_module")) data, + modules = modules, + title = title, + header = header, + footer = footer ) }, server = function(input, output, session) { diff --git a/man/init.Rd b/man/init.Rd index 974dd9801a..328c0b9179 100644 --- a/man/init.Rd +++ b/man/init.Rd @@ -17,34 +17,35 @@ init( } \arguments{ \item{data}{(\code{teal_data} or \code{teal_data_module}) -For constructing the data object, refer to \code{\link[=teal_data]{teal_data()}} and \code{\link[=teal_data_module]{teal_data_module()}}.} +For constructing the data object, refer to \code{\link[=teal_data]{teal_data()}} and \code{\link[=teal_data_module]{teal_data_module()}}. +If \code{datanames} are not set for the \code{teal_data} object, defaults from the \code{teal_data} environment will be used.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} -\item{filter}{(\code{teal_slices}) -Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} +\item{filter}{(\code{teal_slices}) Optionally, +specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} -\item{title}{(\code{shiny.tag} or \code{character(1)}) -The browser window title. Defaults to a title "teal app" with the icon of NEST. +\item{title}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the browser window title. Defaults to a title "teal app" with the icon of NEST. Can be created using the \code{build_app_title()} or by passing a valid \code{shiny.tag} which is a head tag with title and link tag.} -\item{header}{(\code{shiny.tag} or \code{character(1)}) -The header of the app.} +\item{header}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the header of the app.} -\item{footer}{(\code{shiny.tag} or \code{character(1)}) -The footer of the app.} +\item{footer}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the footer of the app.} -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} -\item{landing_popup}{(\code{teal_module}) optional -A \code{landing_popup_module} to show up as soon as the teal app is initialized.} +\item{landing_popup}{(\code{teal_module_landing}) Optionally, +a \code{landing_popup_module} to show up as soon as the teal app is initialized.} } \value{ Named list containing server and UI functions. @@ -55,19 +56,14 @@ Named list containing server and UI functions. End-users: This is the most important function for you to start a \code{teal} app that is composed of \code{teal} modules. } -\details{ -When initializing the \code{teal} app, if \code{datanames} are not set for the \code{teal_data} object, -defaults from the \code{teal_data} environment will be used. -} \examples{ app <- init( - data = teal_data( - new_iris = transform(iris, id = seq_len(nrow(iris))), - new_mtcars = transform(mtcars, id = seq_len(nrow(mtcars))), - code = " + data = within( + teal_data(), + { new_iris <- transform(iris, id = seq_len(nrow(iris))) new_mtcars <- transform(mtcars, id = seq_len(nrow(mtcars))) - " + } ), modules = modules( module( @@ -105,7 +101,7 @@ app <- init( ), title = "App title", header = tags$h1("Sample App"), - footer = tags$p("Copyright 2017 - 2023") + footer = tags$p("Sample footer") ) if (interactive()) { shinyApp(app$ui, app$server) diff --git a/man/module_bookmark_manager.Rd b/man/module_bookmark_manager.Rd index 1a6a1e1d8b..abfdcffcfc 100644 --- a/man/module_bookmark_manager.Rd +++ b/man/module_bookmark_manager.Rd @@ -20,12 +20,12 @@ get_bookmarking_option() need_bookmarking(modules) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} diff --git a/man/module_filter_data.Rd b/man/module_filter_data.Rd index a7c6915e9c..e2dfe310f4 100644 --- a/man/module_filter_data.Rd +++ b/man/module_filter_data.Rd @@ -17,8 +17,8 @@ srv_filter_data(id, datasets, active_datanames, data_rv, is_active) .observe_active_filter_changed(datasets, is_active, active_datanames, data_rv) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{datasets}{(\code{reactive} returning \code{FilteredData} or \code{NULL}) @@ -30,7 +30,7 @@ which implies in filter-panel to be "global". When \code{NULL} then filter-panel \item{data_rv}{(\code{reactive} returning \code{teal_data})} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} diff --git a/man/module_init_data.Rd b/man/module_init_data.Rd index 8370aefcd0..d61bb48e7a 100644 --- a/man/module_init_data.Rd +++ b/man/module_init_data.Rd @@ -11,8 +11,8 @@ ui_init_data(id, data) srv_init_data(id, data, modules, filter = teal_slices()) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{data}{(\code{teal_data}, \code{teal_data_module}, or \code{reactive} returning \code{teal_data}) @@ -22,13 +22,13 @@ The \code{data} argument in the \code{ui} is included solely for the \verb{$ui} the reactive data of the enclosing application.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} -\item{filter}{(\code{teal_slices}) -Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} +\item{filter}{(\code{teal_slices}) Optionally, +specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} } \value{ A \code{reactive} object that returns: diff --git a/man/module_teal.Rd b/man/module_teal.Rd index bbe43e80b0..29cab0645c 100644 --- a/man/module_teal.Rd +++ b/man/module_teal.Rd @@ -18,12 +18,12 @@ ui_teal( srv_teal(id, data, modules, filter = teal_slices()) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} @@ -34,19 +34,19 @@ The \code{data} argument in the \code{ui} is included solely for the \verb{$ui} \code{teal_data_module}. Otherwise, it can be disregarded, ensuring that \code{ui_teal} does not depend on the reactive data of the enclosing application.} -\item{title}{(\code{shiny.tag} or \code{character(1)}) -The browser window title. Defaults to a title "teal app" with the icon of NEST. +\item{title}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the browser window title. Defaults to a title "teal app" with the icon of NEST. Can be created using the \code{build_app_title()} or by passing a valid \code{shiny.tag} which is a head tag with title and link tag.} -\item{header}{(\code{shiny.tag} or \code{character(1)}) -The header of the app.} +\item{header}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the header of the app.} -\item{footer}{(\code{shiny.tag} or \code{character(1)}) -The footer of the app.} +\item{footer}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the footer of the app.} -\item{filter}{(\code{teal_slices}) -Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} +\item{filter}{(\code{teal_slices}) Optionally, +specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} } \value{ \code{NULL} invisibly diff --git a/man/module_teal_module.Rd b/man/module_teal_module.Rd index 01ad3f947d..b5bb015f81 100644 --- a/man/module_teal_module.Rd +++ b/man/module_teal_module.Rd @@ -64,12 +64,12 @@ srv_teal_module( ) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} diff --git a/man/module_teal_with_splash.Rd b/man/module_teal_with_splash.Rd index 5d75a51b89..4fa6ba3e3e 100644 --- a/man/module_teal_with_splash.Rd +++ b/man/module_teal_with_splash.Rd @@ -17,8 +17,8 @@ ui_teal_with_splash( srv_teal_with_splash(id, data, modules, filter = teal_slices()) } \arguments{ -\item{id}{(\code{character}) optional -string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module +\item{id}{(\code{character}) Optionally, +a string specifying the \code{shiny} module id in cases it is used as a \code{shiny} module rather than a standalone \code{shiny} app. This is a legacy feature.} \item{data}{(\code{teal_data}, \code{teal_data_module}, or \code{reactive} returning \code{teal_data}) @@ -27,25 +27,25 @@ The \code{data} argument in the \code{ui} is included solely for the \verb{$ui} \code{teal_data_module}. Otherwise, it can be disregarded, ensuring that \code{ui_teal} does not depend on the reactive data of the enclosing application.} -\item{title}{(\code{shiny.tag} or \code{character(1)}) -The browser window title. Defaults to a title "teal app" with the icon of NEST. +\item{title}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the browser window title. Defaults to a title "teal app" with the icon of NEST. Can be created using the \code{build_app_title()} or by passing a valid \code{shiny.tag} which is a head tag with title and link tag.} -\item{header}{(\code{shiny.tag} or \code{character(1)}) -The header of the app.} +\item{header}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the header of the app.} -\item{footer}{(\code{shiny.tag} or \code{character(1)}) -The footer of the app.} +\item{footer}{(\code{shiny.tag} or \code{character(1)}) Optionally, +the footer of the app.} \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} -\item{filter}{(\code{teal_slices}) -Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} +\item{filter}{(\code{teal_slices}) Optionally, +specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} } \value{ Returns a \code{reactive} expression containing a \code{teal_data} object when data is loaded or \code{NULL} when it is not. diff --git a/man/modules_depth.Rd b/man/modules_depth.Rd index 4501141cb2..f3b9e057c1 100644 --- a/man/modules_depth.Rd +++ b/man/modules_depth.Rd @@ -8,7 +8,7 @@ modules_depth(modules, depth = 0L) } \arguments{ \item{modules}{(\code{list} or \code{teal_modules} or \code{teal_module}) -nested list of \code{teal_modules} or \code{teal_module} objects or a single +Nested list of \code{teal_modules} or \code{teal_module} objects or a single \code{teal_modules} or \code{teal_module} object. These are the specific output modules which will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.}