R/mod_manage_dashboard_body.R

Defines functions mod_manage_dashboard_body_server mod_manage_dashboard_body_ui

#' manage_dashboard_body UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#'
#' @importFrom shiny NS

mod_manage_dashboard_body_ui <- function(id) {
  ns <- NS(id)
  uiOutput(ns("body_ui"))
}

#' manage_dashboard_body Server Function
#'
#' @noRd

mod_manage_dashboard_body_server <-
  function(input, output, session, conn) {
    ns <- session$ns
    
    # conn$state tells us what has been selected
    
    output$body_ui <- renderUI({
      if (identical(conn$state, "Database"))
        return(tabsetPanel(
          mod_manage_databases_ui("manage_databases"),
          mod_create_table_ui("create_table"),
          mod_import_table_ui("import_table"),
          mod_query_ui("query")
        ))
      else if (identical(conn$state, "Table"))
        return(tabsetPanel(
          mod_view_tables_ui("view_tables"),
          mod_table_structure_ui("table_structure")
        ))
      else
        return(p("No Database Selected"))
    })
  }

## To be copied in the UI
# mod_manage_dashboard_body_ui("manage_dashboard_body_ui_1")

## To be copied in the server
# callModule(mod_manage_dashboard_body_server, "manage_dashboard_body_ui_1")
divyansh997/rsqliteadmin_temp documentation built on July 31, 2020, 7:36 a.m.