teal main app module
module_teal.RdThis is the main teal app that puts everything together.
Usage
ui_teal(
id,
splash_ui = tags$h2("Starting the Teal App"),
title = NULL,
header = tags$p(""),
footer = tags$p("")
)
srv_teal(id, modules, raw_data, filter = teal_slices())Arguments
- id
(
character(1))
module id- splash_ui
(
shiny.tag)
UI to display initially, can be a splash screen or a Shiny module UI. For the latter, seeinit()about how to call the corresponding server function.- title
(
NULLorcharacter)
The browser window title (defaults to the host URL of the page).- header
(
shiny.tagorcharacter)
the header of the app. Note shiny code placed here (and in the footer argument) will be placed in the app'suifunction so code which needs to be placed in theuifunction (such as loadingCSSviahtmltools::htmlDependency()) should be included here.- footer
(
shiny.tagorcharacter)
the footer of the app- raw_data
(
reactive)
returns theTealData, only evaluated once,NULLvalue is ignored
Value
ui_teal returns HTML for Shiny module UI.
srv_teal returns reactive which returns the currently active module.
Details
It displays the splash UI which is used to fetch the data, possibly
prompting for a password input to fetch the data. Once the data is ready,
the splash screen is replaced by the actual teal UI that is tabsetted and
has a filter panel with datanames that are relevant for the current tab.
Nested tabs are possible, but we limit it to two nesting levels for reasons
of clarity of the UI.
The splash screen functionality can also be used for non-delayed data which takes time to load into memory, avoiding Shiny session timeouts.
Server evaluates the raw_data (delayed data mechanism) and creates the
datasets object that is shared across modules.
Once it is ready and non-NULL, the splash screen is replaced by the
main teal UI that depends on the data.
The currently active tab is tracked and the right filter panel
updates the displayed datasets to filter for according to the active datanames
of the tab.
It is written as a Shiny module so it can be added into other apps as well.
Examples
mods <- teal:::example_modules()
raw_data <- reactive(teal:::example_cdisc_data())
app <- shinyApp(
ui = function() {
teal:::ui_teal("dummy")
},
server = function(input, output, session) {
active_module <- teal:::srv_teal(id = "dummy", modules = mods, raw_data = raw_data)
}
)
if (interactive()) {
runApp(app)
}