Wraps your own module composition in the isoexplorer navbar shell (theme
picker, dark-mode toggle, about popup) and, by default, runs it. Build your
layout from the package's modules, instantiate the ie_file_server() and wire
the modules in setup_modules. Supply EITHER main (a single content area) OR
nav_panels (a centered navbar tabset).
Usage
ie_run_app(
isofiles,
main = NULL,
setup_modules,
timezone = Sys.timezone(),
default_theme = app_themes(),
nav_panels = NULL,
selected = NULL,
initial_selection = TRUE,
upload_folder = NULL,
monitoring_folders = NULL,
examples_folder = NULL,
temporary_storage = FALSE,
max_upload_size = NULL,
options = list(),
uiPattern = "/",
enableBookmarking = "url",
detached = FALSE,
launch = TRUE,
stop_on_close = detached,
log_level = c("WARN", "INFO", "DEBUG", "TRACE", "ERROR", "FATAL")
)Arguments
- isofiles
the
ir_isofilesto explore (handed to theie_file_server())- main
a single UI content area (use this OR
nav_panels)- setup_modules
function(file, code)that wires the app's server modules, given theie_file_server()handle and theie_code_server()handle (register each module'sget_codewithcode$register()). A one-argumentfunction(file)is still accepted (the code server is then not populated).- timezone
timezone for datetime display
- default_theme
default bslib Bootstrap 5 theme preset
a list of
bslib::nav_panel()s shown as a centered navbar tabset (use this ORmain)- selected
the value/title of the
nav_panelstab to open initially (NULL= the first tab)- initial_selection
initial file selection, see
ie_file_server()- upload_folder
upload directory for the navbar upload button;
NULL(the default) means no upload button, seeie_file_server()- monitoring_folders
folders to watch for new isofiles (
NULL= off), seeie_file_server()- examples_folder
directory for the "Load examples" navbar button (
NULL= off), seeie_file_server()- temporary_storage
note in the upload dialog that uploads are session-only (informational; default
FALSE), seeie_file_server()- max_upload_size
maximum per-file upload size in MB; sets the
shiny.maxRequestSizeoption for the running app.NULL(the default) leaves Shiny's ~5 MB default (or a value you set yourself) untouched. Raw isofiles are often larger than 5 MB, so raise this when enabling uploads.- options
Named options that should be passed to the
runAppcall (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode"). You can also specifywidthandheightparameters which provide a hint to the embedding environment about the ideal height/width for the app.- uiPattern
A regular expression that will be applied to each
GETrequest to determine whether theuishould be used to handle the request. Note that the entire request path must match the regular expression in order for the match to be considered successful.- enableBookmarking
Can be one of
"url","server", or"disable". The default value,NULL, will respect the setting from any previous calls toenableBookmarking(). SeeenableBookmarking()for more information on bookmarking your app.- detached
if
TRUE, the app is launched in a separate R process (viacallr::r_bg(), the app handed over in a temporary.rds) and opened in your default browser, leaving the calling session free; closing the browser tab stops the app and the process (which is also killed if the calling session exits). DefaultFALSE.- launch
only relevant when
detached = FALSE: ifTRUE(the default) the app is run in the current session (blocking) withshiny::runApp(); ifFALSEtheshiny::shinyApp()object is returned unrun (for server deployment or manual launching). Ignored whendetached = TRUE(a detached app is always run).- stop_on_close
if
TRUE, the app stops itself when the browser disconnects (session$onSessionEnded()); set automatically for the detached process so it exits when the tab is closed. Defaults to the same asdetached.- log_level
how verbosely the app logs, one of
"WARN"(the default – only warnings and errors),"INFO","DEBUG","TRACE"(everything),"ERROR", or"FATAL". Sets theLOG_LEVELenvironment variable that rlog reads (also applied in the detached process).
Value
When detached = TRUE, the callr::r_bg() process (invisibly, with the
app URL attached as an attribute); when detached = FALSE and launch = TRUE,
the result of shiny::runApp() (after the app stops); when detached = FALSE
and launch = FALSE, the shiny::shinyApp() object.
Details
The detached / launch arguments control how it runs: detached = TRUE
launches it in a separate R process (leaving this session free);
detached = FALSE, launch = TRUE (the default) runs it in the current session
(blocking) with shiny::runApp(); detached = FALSE, launch = FALSE returns
the shiny::shinyApp() object unrun (for deployment or manual launching). The
focused explorers (ie_explore_continuous_flow() etc.) and
ie_create_isofiles_server() are wrappers that call this with the appropriate
detached / launch.
Examples
if (interactive()) {
# read the bundled isoreader2 examples (a mixed set of all types)
iso <-
isoreader2::ir_examples_folder() |>
isoreader2::ir_find_isofiles() |>
isoreader2::ir_read_isofiles()
# a minimal custom app: a scans selector next to a scans plot
ie_run_app(
isofiles = iso,
main = ie_type_explorer_ui("meta", ie_scans_plot_ui("scan")),
setup_modules = function(file, code) {
ie_scans_metadata_server("meta", file)
ie_scans_plot_server("scan", file)
}
)
}
