Skip to contents

This module is used to generate UI for options to load harp verification files for display in a shiny app. It requires the following shinyOptions:

  • "app_start_dir" - the directory start the app in

  • "full_dir_navigation" - TRUE/FALSE - whether to make full file navigation available via selection modal.

Usage

options_barUI(id)

options_bar(input, output, session)

Arguments

id

An ID string for the module's UI

input

input reactive

output

output reactive

session

Session from which to make a child scope (the default should almost always be used).

Value

A reactive list containing the loaded harp verification object

Examples

library(shiny)

# With directory navigation modal
shinyOptions(
  app_start_dir = system.file("verification", package = "harpVis"),
  full_dir_navigation = TRUE
)

ui <- fluidPage(
  fluidRow(
    column(12,
      options_barUI("opts"),
    )
  ),
  fluidRow(
    column(12,
      verbatimTextOutput("str")
    )
  )
)

server <- function(input, output, session) {
  my_data <- callModule(options_bar, "opts")
  output$str <- renderPrint({
    str(my_data())
  })
}

if (interactive()) {
  shinyApp(ui, server)
}

# Directory navigation from dropdown
shinyOptions(full_dir_navigation = FALSE)

# need to remake the UI with new options
ui <- fluidPage(
  fluidRow(
    column(12,
      options_barUI("opts"),
    )
  ),
  fluidRow(
    column(12,
      verbatimTextOutput("str")
    )
  )
)

if (interactive()) {
  shinyApp(ui, server)
}