R/m_overview.R

Defines functions m_overview_server m_overview_ui

# Module UI
  
#' @title   m_overview_ui and mod_overview_server
#' @description  A shiny Module.
#'
#' @param id shiny id
#' @param input internal
#' @param output internal
#' @param session internal
#'
#' @rdname m_overview
#'
#' @keywords internal
#' @export 
#' @importFrom shiny NS tagList 
m_overview_ui <- function(id){
  ns <- NS(id)
 
  shinydashboard::tabItem(
    tabName = "OVERVIEW", 
    h1(paste0("Overview of Lopo for study ", "PASS_STUDY_NAME", "(", "PASS_STUDY_STATUS",")") ) ,    
    
    shinydashboard::valueBox(textOutput(ns("num_of_table")), 
                             "Tables", 
                             icon = icon("list"), 
                             color = "aqua", 
                             width = 3,
                             href = NULL),
    shinydashboard::valueBox(textOutput(ns("num_of_figure")), 
                             "Figures", 
                             icon = icon("chart-bar"), 
                             color = "aqua", 
                             width = 3,
                             href = NULL),
    shinydashboard::valueBox(textOutput(ns("num_of_listing")), 
                             "Listings", 
                             icon = icon("align-justify"), 
                             color = "aqua", 
                             width = 3,
                             href = NULL),
    shinydashboard::valueBox("12", "ADAMs", 
                             icon = icon("plus-square"), 
                             color = "aqua", 
                             width = 3,
                             href = NULL) 
    
  )
}
    
# Module Server
    
#' @rdname m_overview
#' @export
#' @keywords internal
    
m_overview_server <- function(input, output, session){
  ns <- session$ns
  
  s_path <- "inst/example_lopo/BP40657.sqlite"
  myLopo <- getLopo("BP40657", s_path)
  
  num_of_table <- nrow(dplyr::filter(myLopo, outType == "Table")) 
  num_of_figure <- nrow(dplyr::filter(myLopo, outType == "Figure")) 
  num_of_listing <- nrow(dplyr::filter(myLopo, outType == "Listing")) 
  
  output$num_of_table <- renderText({paste0(num_of_table, "")})
  output$num_of_figure <- renderText({paste0(num_of_figure, "")})
  output$num_of_listing <- renderText({ paste0(num_of_listing, "")})
}
    
## To be copied in the UI
# m_overview_ui("overview_ui_1")
    
## To be copied in the server
# callModule(m_overview_server, "overview_ui_1")
 
kismet303/lopo3000 documentation built on Dec. 5, 2019, 8:40 a.m.