R/module_directorySelect.R

Defines functions selectDirectory_Server selectDirectory_UI

Documented in selectDirectory_Server selectDirectory_UI

#' selectDirectory_UI
#'
#' @param id namespace
#' @param label label of the directory action button
#'
#' @return NA
#' @export
#'
selectDirectory_UI <- function(id, label){
  
  ns <- NS(id)
  
  actionButton(ns("rawFileDirectory"),
               label = label)
  
  
}


#' selectDirectory_Server
#'
#' @param input shiny
#' @param output shiny
#' @param session shiny
#' @param sqlDirectory sqlDirectory
#'
#' @return NA
#' @export
#'

selectDirectory_Server <- function(input,
                                   output,
                                   session,
                                   sqlDirectory){
  
  
  observeEvent(input$rawFileDirectory, {
    loc <- tempRepo::choose_dir()
    
    if (!is.na(loc)) {
      sqlDirectory$sqlDirectory <- loc
    } else {
      sqlDirectory$sqlDirectory <- sqlDirectory$sqlDirectory
    }
    
    
  })
  
  
}

#----
chasemc/tempRepo documentation built on April 8, 2019, 10:22 p.m.