diff --git a/.dbeaver/.gitignore b/.dbeaver/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..2f59ec567c98a62e6244218688567cc48cdefa55 --- /dev/null +++ b/.dbeaver/.gitignore @@ -0,0 +1,2 @@ +/credentials-config.json +/data-sources.json diff --git a/.gitignore b/.gitignore index beaca2441416ac9dbe840845ee4c8e300262e9e9..237dffc6674815b792d87d909c9fc49119bb7717 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ .Ruserdata stacoshiny.Rproj /.project +.settings diff --git a/DESCRIPTION b/DESCRIPTION index 662b433bd7e071daaefee94775bb37e030fc392b..56f62269c81b55d5551fc31773847b1dc9959edd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,33 +1,36 @@ -Package: stacoshiny -Title: User interface for stacomi -Version: 0.0.0.9000 -Authors@R: person('AUTHOR_FIRST', 'AUTHOR_LAST', email = 'AUTHOR@MAIL.COM', role = c('cre', 'aut')) -Description: It is a part of the 'STACOMI' open source project developed in France by the French Agency for Biodiversity (OFB) institute, to centralize data obtained by fish pass monitoring. The objective of the stacomi project is to provide a common database for people monitoring <U+FB01>sh migration, so that data from watershed are shared, and stocks exchanging between di<U+FB00>erent basins are better managed. -License: MIT + file LICENSE -Imports: - config (>= 0.3.1), - golem (>= 0.3.1), - shiny (>= 1.6.0), - processx, - attempt, - DT, - glue, - htmltools, - stacomirtools (>= 0.5.4), - shinydashboard, - shinydashboardPlus, - shinyjs, - shinyBS, - stacomiR (>= 0.5.4.5) -Encoding: UTF-8 -LazyData: true -RoxygenNote: 7.1.1 -Suggests: - testthat, - spelling -Language: en-US -URL: https://forgemia.inra.fr/stacomi/stacoshiny -BugReports: https://forgemia.inra.fr/stacomi/stacoshiny/issues -Remotes: - Remotes: gitlab::git@forgemia.inra.fr:stacomi/stacomirtools.git, - Remotes: gitlab::git@forgemia.inra.fr:stacomi/stacomir.git +Package: stacoshiny +Title: User interface for stacomi +Version: 0.0.0.9000 +Authors@R: person('AUTHOR_FIRST', 'AUTHOR_LAST', email = 'AUTHOR@MAIL.COM', role = c('cre', 'aut')) +Description: It is a part of the 'STACOMI' open source project developed in France by the French Agency for Biodiversity (OFB) institute, to centralize data obtained by fish pass monitoring. The objective of the stacomi project is to provide a common database for people monitoring ï¬sh migration, so that data from watershed are shared, and stocks exchanging between different basins are better managed. +License: MIT + file LICENSE +Imports: + config (>= 0.3.1), + golem (>= 0.3.1), + shiny (>= 1.6.0), + processx, + attempt, + DT, + glue, + htmltools, + stacomirtools (>= 0.5.4), + shinydashboard, + shinydashboardPlus, + shinyjs, + shinyBS, + shinyWidgets, + spsComps, + pool, + shinipsum, + stacomiR (>= 0.5.4.5) +Encoding: UTF-8 +LazyData: true +RoxygenNote: 7.1.1 +Suggests: + testthat, + spelling +Language: en-US +URL: https://forgemia.inra.fr/stacomi/stacoshiny +BugReports: https://forgemia.inra.fr/stacomi/stacoshiny/issues +Remotes: + Remotes: gitlab::git@forgemia.inra.fr:stacomi/stacomirtools.git \ No newline at end of file diff --git a/NAMESPACE b/NAMESPACE index ebce8738d9dea7b0b47fa409735ba49a15636bcc..dac7cc2702d6cac793ea2d814404ff1ee681a5ce 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -3,32 +3,52 @@ export(run_app) import(shiny) import(stacomirtools) +importFrom(DT,DTOutput) +importFrom(DT,renderDT) +importFrom(config,get) importFrom(golem,activate_js) importFrom(golem,add_resource_path) importFrom(golem,bundle_resources) importFrom(golem,favicon) importFrom(golem,with_golem_options) importFrom(pool,poolClose) +importFrom(shinipsum,random_DT) +importFrom(shinipsum,random_ggplot) importFrom(shiny,HTML) importFrom(shiny,NS) +importFrom(shiny,checkboxGroupInput) importFrom(shiny,column) +importFrom(shiny,dateRangeInput) importFrom(shiny,isolate) +importFrom(shiny,numericInput) importFrom(shiny,observeEvent) importFrom(shiny,passwordInput) +importFrom(shiny,radioButtons) +importFrom(shiny,reactiveValues) +importFrom(shiny,reactiveValuesToList) +importFrom(shiny,selectizeInput) importFrom(shiny,shinyApp) importFrom(shiny,tagAppendAttributes) importFrom(shiny,tagList) importFrom(shiny,tags) importFrom(shiny,textInput) importFrom(shinyWidgets,actionBttn) +importFrom(shinyWidgets,radioGroupButtons) +importFrom(shinydashboard,box) +importFrom(shinydashboard,dashboardBody) importFrom(shinydashboard,dropdownMenu) importFrom(shinydashboard,menuItem) importFrom(shinydashboard,sidebarMenu) +importFrom(shinydashboard,tabItem) +importFrom(shinydashboard,tabItems) importFrom(shinydashboardPlus,dashboardHeader) +importFrom(shinydashboardPlus,dashboardPage) importFrom(shinydashboardPlus,dashboardSidebar) importFrom(shinydashboardPlus,dashboardUser) importFrom(shinydashboardPlus,dashboardUserItem) importFrom(shinydashboardPlus,dropdownBlock) importFrom(shinydashboardPlus,notificationItem) +importFrom(shinydashboardPlus,renderUser) importFrom(shinydashboardPlus,userOutput) importFrom(spsComps,shinyCatch) +importFrom(spsComps,spsDepend) diff --git a/R/app_config.R b/R/app_config.R index 89e7461e7ea760aeac8a54e67dcb48d2e32c4719..1d9af866e2d5725aaa80a001e7826266b4df0d39 100644 --- a/R/app_config.R +++ b/R/app_config.R @@ -1,43 +1,44 @@ -#' Access files in the current app -#' -#' NOTE: If you manually change your package name in the DESCRIPTION, -#' don't forget to change it here too, and in the config file. -#' For a safer name change mechanism, use the `golem::set_golem_name()` function. -#' -#' @param ... character vectors, specifying subdirectory and file(s) -#' within your package. The default, none, returns the root of the app. -#' -#' @noRd -app_sys <- function(...){ - system.file(..., package = "stacoshiny") -} - - -#' Read App Config -#' -#' @param value Value to retrieve from the config file. -#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE. -#' If unset, "default". -#' @param use_parent Logical, scan the parent directory for config file. -#' -#' @noRd -get_golem_config <- function( - value, - config = Sys.getenv( - "GOLEM_CONFIG_ACTIVE", - Sys.getenv( - "R_CONFIG_ACTIVE", - "default" - ) - ), - use_parent = TRUE -){ - config::get( - value = value, - config = config, - # Modify this if your config file is somewhere else: - file = app_sys("golem-config.yml"), - use_parent = use_parent - ) -} - +#' Access files in the current app +#' +#' NOTE: If you manually change your package name in the DESCRIPTION, +#' don't forget to change it here too, and in the config file. +#' For a safer name change mechanism, use the `golem::set_golem_name()` function. +#' +#' @param ... character vectors, specifying subdirectory and file(s) +#' within your package. The default, none, returns the root of the app. +#' +#' @noRd +app_sys <- function(...){ + system.file(..., package = "stacoshiny") +} + + +#' Read App Config +#' +#' @param value Value to retrieve from the config file. +#' @param config GOLEM_CONFIG_ACTIVE value. If unset, R_CONFIG_ACTIVE. +#' If unset, "default". +#' @param use_parent Logical, scan the parent directory for config file. +#' +#' @importFrom config get +#' @noRd +get_golem_config <- function( + value, + config = Sys.getenv( + "GOLEM_CONFIG_ACTIVE", + Sys.getenv( + "R_CONFIG_ACTIVE", + "default" + ) + ), + use_parent = TRUE +){ + get( + value = value, + config = config, + # Modify this if your config file is somewhere else: + file = app_sys("golem-config.yml"), + use_parent = use_parent + ) +} + diff --git a/R/app_server.R b/R/app_server.R index ecfb2ea693280c77a5c51b7f18092fa1c916c2a0..1935e6f5004bd69f29691a240608bc392e372395 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -10,6 +10,20 @@ app_server <- function( input, output, session ) { ref_dc = NULL) mod_main_page_server("main_page_ui_1") mod_header_server("header_ui_1") - mod_main_page_login_server("main_page_login_ui_1") - mod_left_side_bar_server("left_side_bar_ui_1",DD) + mod_left_side_bar_server("left_side_bar_ui_1") + mod_migr_multi_server("migr_multi_ui_1") + mod_annuel_server("annuel_ui_1") + mod_interannuel_server("interannuel_ui_1") + mod_espece_server("espece_ui_1") + mod_car_lot_server("car_lot_ui_1") + mod_migr_car_server("migr_car_ui_1") + mod_migr_env_server("migr_env_ui_1") + mod_sat_age_server("sat_age_ui_1") + mod_ang_argentee_server("ang_argentee_ui_1") + mod_civ_poids_server("civ_poids_ui_1") + mod_bilan_df_server("bilan_df_ui_1") + mod_bilan_dc_server("bilan_dc_ui_1") + mod_env_server("env_ui_1") + + } diff --git a/R/app_ui.R b/R/app_ui.R index 03271dd8049c5e15257d485c03094e9849e68a28..01844015c68a348d77c6a2d5fae0e097c1e8f2f0 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -4,12 +4,13 @@ #' DO NOT REMOVE. #' @import shiny #' @noRd +#' @importFrom shinydashboardPlus dashboardPage app_ui <- function(request) { tagList( # Leave this function for adding external resources golem_add_external_resources(), # Your application UI logic - shinydashboardPlus::dashboardPage( + dashboardPage( header = mod_header_ui("header_ui_1"), sidebar = mod_left_side_bar_ui("left_side_bar_ui_1"), body = mod_main_page_ui("main_page_ui_1") @@ -32,7 +33,7 @@ golem_add_external_resources <- function(){ ) tags$head( - favicon(), + favicon(ext = 'png'), bundle_resources( path = app_sys('app/www'), app_title = 'stacoshiny' diff --git a/R/golem_utils_server.R b/R/golem_utils_server.R index 97bc2d1d9d06501d5977ab28d4f995c0b6b59356..4fe772d97e1c7b65195bf75daf33e36b914f5928 100644 --- a/R/golem_utils_server.R +++ b/R/golem_utils_server.R @@ -5,6 +5,7 @@ #' @examples #' 1 %not_in% 1:10 #' not_null(NULL) +#' @importFrom shiny reactiveValues reactiveValuesToList `%not_in%` <- Negate(`%in%`) not_null <- Negate(is.null) @@ -59,6 +60,6 @@ drop_nulls <- function(x){ #' @inheritParams reactiveValuesToList #' #' @noRd -rv <- shiny::reactiveValues -rvtl <- shiny::reactiveValuesToList +rv <- reactiveValues +rvtl <- reactiveValuesToList diff --git a/R/golem_utils_ui.R b/R/golem_utils_ui.R index 216d2303ce1bb20c0ad3604583fa744e25950157..3999934892695a7d73fa50cca51a078a755d8ea1 100644 --- a/R/golem_utils_ui.R +++ b/R/golem_utils_ui.R @@ -209,11 +209,11 @@ jq_hide <- function(id) { #' #' @importFrom shiny tags HTML with_red_star <- function(text) { - shiny::tags$span( + tags$span( HTML( paste0( text, - shiny::tags$span( + tags$span( style = "color:red", "*" ) ) diff --git a/R/mod_ang_argentee.R b/R/mod_ang_argentee.R new file mode 100644 index 0000000000000000000000000000000000000000..8b9eecad32614dd532c26301b9b62d3d795ffa53 --- /dev/null +++ b/R/mod_ang_argentee.R @@ -0,0 +1,84 @@ +#' ang_argentee UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_ang_argentee_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "ang_argentee", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + selectizeInput('ANG_DC', h5('Choisissez un DC :'), + selected="A", choices = c("A", "B"), + multiple = FALSE), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_angarg_1" = 1, "plot_angarg_2" = 2, "plot_angarg_3" = 3, "plot_angarg_4"= 4, "tab_angarg_data" = 5), + selected = 1), + actionBttn( + inputId = "bttn_angarg", + label = "OK", + style = "fill", + color = "primary" + ) + + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_angarg_1")), + plotOutput(ns("plot_angarg_2")), + plotOutput(ns("plot_angarg_3")), + plotOutput(ns("plot_angarg_4")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_angarg_data")) + ) + ) +} + +#' ang_argentee Server Functions +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +#' @noRd +mod_ang_argentee_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + output$plot_angarg_1 <- renderPlot({ + random_ggplot() + }) + + output$plot_angarg_2 <- renderPlot({ + random_ggplot() + }) + + output$plot_angarg_3 <- renderPlot({ + random_ggplot() + }) + + output$plot_angarg_4 <- renderPlot({ + random_ggplot() + }) + + output$tab_angarg_data <- renderDT({ + random_DT(5, 5) + }) + + }) +} + +## To be copied in the UI +# mod_ang_argentee_ui("ang_argentee_ui_1") + +## To be copied in the server +# mod_ang_argentee_server("ang_argentee_ui_1") diff --git a/R/mod_annuel.R b/R/mod_annuel.R new file mode 100644 index 0000000000000000000000000000000000000000..2461b1cfb37ad8192c5a70906df79e658f1e00ad --- /dev/null +++ b/R/mod_annuel.R @@ -0,0 +1,75 @@ +#' annuel UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_annuel_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "annuel", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + sliderInput("annuel_date", label = h5("Choisissez l'ann\u00e9e de d\u00e9but et de fin :"), min = 1980, + max = 2021, value = c(2011, 2021)), + selectizeInput("taxon_mult", h5('Choisissez un ou plusieurs taxon(s) :'), + selected=NULL, choices=list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + selectizeInput("stade_mult", h5('Choisissez un ou plusieurs stade(s) :'), + selected=NULL, choices=list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_barplot" = 1, "plot_point" = 2,"tab_annuel_data" = 3), + selected = 1), + actionBttn( + inputId = "bttn_annuel", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_annuel_barplot")), + plotOutput(ns("plot_annuel_point")) + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_annuel_data")) + + ) + + ) +} + +#' annuel Server Functions +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +#' @noRd +mod_annuel_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + output$plot_annuel_barplot <- renderPlot({ + random_ggplot() + }) + + output$plot_annuel_point <- renderPlot({ + random_ggplot() + }) + + output$tab_annuel_data <- renderDT({ + random_DT(5, 5) + }) + }) +} + +## To be copied in the UI +# mod_annuel_ui("annuel_ui_1") + +## To be copied in the server +# mod_annuel_server("annuel_ui_1") diff --git a/R/mod_bilan_dc.R b/R/mod_bilan_dc.R new file mode 100644 index 0000000000000000000000000000000000000000..cf3c189ac351097d23f0bf9feee4ab368dbc1853 --- /dev/null +++ b/R/mod_bilan_dc.R @@ -0,0 +1,80 @@ +#' bilan_dc UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_bilan_dc_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "bilan_dc", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_dc_barchar_fonct" = 1, "plot_dc_barchar_service" = 2, "plot_dc_box" = 3, "tab_dc_data" = 4), + selected = 1), + actionBttn( + inputId = "bttn_df", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_dc_barchar_fonct")), + plotOutput(ns("plot_dc_barchar_service")), + plotOutput(ns("plot_dc_box")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_dc_data")) + ) + ) + +} + +#' bilan_dc Server Functions +#' +#' @noRd +#' @importFrom DT renderDT +mod_bilan_dc_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + #Bilan DC + + output$plot_dc_barchar_fonct <- renderPlot({ + random_ggplot() + }) + + output$plot_dc_barchar_service <- renderPlot({ + random_ggplot() + }) + + + output$plot_dc_box <- renderPlot({ + random_ggplot() + }) + + output$tab_dc_data <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_bilan_dc_ui("bilan_dc_ui_1") + +## To be copied in the server +# mod_bilan_dc_server("bilan_dc_ui_1") diff --git a/R/mod_bilan_df.R b/R/mod_bilan_df.R new file mode 100644 index 0000000000000000000000000000000000000000..c01d4bb8a821269d3b9ea84698ed33833dddadd6 --- /dev/null +++ b/R/mod_bilan_df.R @@ -0,0 +1,81 @@ +#' bilan_df UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' @importFrom shinydashboard tabItem box +#' @importFrom shiny NS tagList +mod_bilan_df_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "bilan_df", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + selectizeInput('bilan_DF', h5('Choisissez un DF :'), + selected="A", choices = c("A", "B"), + multiple = FALSE), + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_df_barchar_fonct" = 1, "plot_df_barchar_service" = 2, "plot_df_box" = 3, "plot_df_chart" = 4, "tab_df_data" = 5), + selected = 1), + actionBttn( + inputId = "bttn_df", + label = "OK", + style = "fill", + color = "primary" + ) + + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_df_barchar_fonct")), + plotOutput(ns("plot_df_barchar_service")), + plotOutput(ns("plot_df_box")), + plotOutput(ns("plot_df_chart")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_df_data")) + ) + ) +} + +#' bilan_df Server Functions +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +#' @noRd +mod_bilan_df_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + output$plot_df_barchar_fonct <- renderPlot({ + random_ggplot() + }) + + output$plot_df_barchar_service <- renderPlot({ + random_ggplot() + }) + + output$plot_df_box <- renderPlot({ + random_ggplot() + }) + + output$plot_df_chart <- renderPlot({ + random_ggplot() + }) + + output$tab_df_data <- renderDT({ + random_DT(5, 5) + }) + + }) +} + +## To be copied in the UI +# mod_bilan_df_ui("bilan_df_ui_1") + +## To be copied in the server +# mod_bilan_df_server("bilan_df_ui_1") diff --git a/R/mod_car_lot.R b/R/mod_car_lot.R new file mode 100644 index 0000000000000000000000000000000000000000..91cac16782bf543d8a97d3103e5e2b361d4fd429 --- /dev/null +++ b/R/mod_car_lot.R @@ -0,0 +1,92 @@ +#' car_lot UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_car_lot_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "car_lot", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + p("La super m\u00e9thode choice_c de", strong("C\u00e9dric"),"accepte tous les formats caract\u00e8res date/heure ainsi que formats PosiXt"), + + selectizeInput('esp_taxon', h5('Choisissez un ou des taxon(s) :'), + choices = c("A","B"), + multiple = TRUE), + selectizeInput('esp_stade', h5('Choisissez un ou des stade(s) :'), + selected="A",choices = c("A","B"), + multiple = TRUE), + selectInput('esp_car_qual', h5('Choisissez une ou des caract\u00e9ristique(s) qualitative(s) de lot :'), + selected = NULL, choices = c("A","B","C"), + multiple = TRUE), + #voir comment gérer setasqualitative + selectizeInput('esp_car_quan', h5('Choisissez une ou des caract\u00e9ristique(s) quantitative(s) de lot :'), + choices = c("A","B","C"), + multiple = TRUE), + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_point" = 1, "plot_density" = 2, "plot_boxplot" = 3, "tab_data"= 4), + selected = 1), + actionBttn( + inputId = "bttn_carlot", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_carlot_point")), + plotOutput(ns("plot_carlot_density")), + plotOutput(ns("plot_carlot_boxplot")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_carlot_data")) + ) + + ) + +} + +#' car_lot Server Functions +#' @importFrom DT renderDT +#' @noRd +mod_car_lot_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + #Bilan caractéristique lot + + output$plot_carlot_point <- renderPlot({ + random_ggplot() + }) + + output$plot_carlot_density <- renderPlot({ + random_ggplot() + }) + + output$plot_carlot_boxplot <- renderPlot({ + random_ggplot() + }) + + output$tab_carlot_data <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_car_lot_ui("car_lot_ui_1") + +## To be copied in the server +# mod_car_lot_server("car_lot_ui_1") diff --git a/R/mod_civ_poids.R b/R/mod_civ_poids.R new file mode 100644 index 0000000000000000000000000000000000000000..b566c9953a819db3818369216c235e3d127c0d9d --- /dev/null +++ b/R/mod_civ_poids.R @@ -0,0 +1,86 @@ +#' civ_poids UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box + +mod_civ_poids_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "civ_poids", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + selectizeInput('ANG_eff', h5('Choisissez l\'effectif de l\'\u00e9chantillon :' ), + selected="=1", choices = c("=1", ">1","Tous"), + multiple = FALSE), + sliderInput("annuel_date", label = h5("Choisissez l'ann\u00e9e de d\u00e9but et de fin :"), min = 1980, + max = 2021, value = c(2011, 2021)), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_civpoids_1" = 1, "plot_civpoids_2" = 2, "plot_civpoids_3" = 3, + "tab_civpoids" = 4), + selected = 1), + actionBttn( + inputId = "bttn_civpoids", + label = "OK", + style = "fill", + color = "primary" + ) + + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_civpoids_1")), + plotOutput(ns("plot_civpoids_2")), + plotOutput(ns("plot_civpoids_3")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_civpoids")) + ) + + ) + +} + +#' civ_poids Server Functions +#' +#' @noRd +#' @importFrom DT renderDT +mod_civ_poids_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + # Bilan civelle + + output$plot_civpoids_1 <- renderPlot({ + random_ggplot() + }) + + output$plot_civpoids_2 <- renderPlot({ + random_ggplot() + }) + + output$plot_civpoids_3 <- renderPlot({ + random_ggplot() + }) + + output$tab_civpoids <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_civ_poids_ui("civ_poids_ui_1") + +## To be copied in the server +# mod_civ_poids_server("civ_poids_ui_1") diff --git a/R/mod_env.R b/R/mod_env.R new file mode 100644 index 0000000000000000000000000000000000000000..893f8fc9f79617c288ff5a23aab65724a791715d --- /dev/null +++ b/R/mod_env.R @@ -0,0 +1,73 @@ +#' env UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList dateRangeInput checkboxGroupInput +#' @importFrom shinydashboard tabItem box +mod_env_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "env", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_env_line" = 1, "plot_env2" = 2, "tab_env_data" = 3), + selected = 1), + actionBttn( + inputId = "bttn_df", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_env_line")), + plotOutput(ns("plot_env2")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_env_data")) + ) + + ) + +} + +#' env Server Functions +#' +#' @noRd +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +mod_env_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + + output$plot_env_line <- renderPlot({ + random_ggplot() + }) + + output$plot_env2 <- renderPlot({ + random_ggplot() + }) + + output$tab_env_data <- renderDT({ + random_DT(5, 5) + }) + + }) +} + +## To be copied in the UI +# mod_env_ui("env_ui_1") + +## To be copied in the server +# mod_env_server("env_ui_1") diff --git a/R/mod_espece.R b/R/mod_espece.R new file mode 100644 index 0000000000000000000000000000000000000000..85ddc8787a81d007ebde4e76b017f39dee0f2ba7 --- /dev/null +++ b/R/mod_espece.R @@ -0,0 +1,80 @@ +#' espece UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_espece_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "espece", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + sliderInput("ann\u00e9e", label = h5("Choisissez l\'ann\u00e9e"), min = 1980, + max = 2021, value = c(2011, 2021)), + #La checkbox n'a pas assez d'option - utiliser un slider pour limiter les trop gros effectifs + # checkboxGroupInput("choix_taxon", label = h5("Choisissez les sorties graphiques ou tableaux :"), + # choices = list("A" = 1, "B" = 2, "C" = 3,"D"=4,"E"=5,"F"=6,"G"=7,"H"=8), + # selected = c(A,B,C,D,E,F,G,H)), + + + selectizeInput('pas_temps', h5('Choisissez un d\u00e9coupage temporel :'), + selected="Aucun", choices = c("Aucun","Semaine","Mois","Ann\u00e9e"), + multiple = FALSE), + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_pie" = 1, "plot_barplot" = 2, "tab_summary"= 3), + selected = 1), + actionBttn( + inputId = "bttn_esp", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_esp_pie")), + plotOutput(ns("plot_esp_barplot")) + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_esp_summary")) + + ) + + ) + +} + +#' espece Server Functions +#' @importFrom DT renderDT +#' @noRd +mod_espece_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + output$plot_esp_pie <- renderPlot({ + random_ggplot() + }) + + output$plot_esp_barplot <- renderPlot({ + random_ggplot() + }) + + output$tab_esp_summary <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_espece_ui("espece_ui_1") + +## To be copied in the server +# mod_espece_server("espece_ui_1") diff --git a/R/mod_header.R b/R/mod_header.R index c789f0bb9b3749e1554205b031638fa2141db4e7..1f756ce0461360e6b779c213807762e3cf0e05ed 100644 --- a/R/mod_header.R +++ b/R/mod_header.R @@ -10,29 +10,23 @@ #' @importFrom shinydashboardPlus dashboardHeader notificationItem dropdownBlock userOutput #' @importFrom shinydashboard dropdownMenu #' @importFrom shinyWidgets actionBttn +#' @importFrom spsComps spsDepend mod_header_ui <- function(id){ ns <- NS(id) - dashboardHeader(title="STACOSHINY", - # dropdownMenu(type = "notifications", - # icon = icon("database"), - # badgeStatus="success", - # notificationItem( - # text = "Connexion", - # icon("check-circle"), - # status = "success" - # ), - # notificationItem( - # text = "Connexion", - # icon = icon("exclamation-circle"), - # status = "danger" - # ) - # ), - leftUi = tagList( + + dashboardHeader(title= tags$a(href="https://forgemia.inra.fr/stacomi/stacoshinY", target="_blank", + tags$img(height = "20px", alt="STACOSHINY", src="www/favicon.jpg", width = "100") ), + leftUi = tagList( + dropdownBlock( id = "base", title = "Options de connexion", icon = icon("database"), badgeStatus = NULL, + + # to have popup message on error + spsDepend("toastr"), + textInput( inputId = ns("host_login"), label= "host", value = "localhost", placeholder = "127.0.0.1" @@ -43,15 +37,15 @@ mod_header_ui <- function(id){ ), textInput( inputId = ns("dbname_login"), - label= "base de données", value = "bd_contmig_nat", placeholder = "bd_contmig_nat" + label= "base de donn\u00e9es", value = "bd_contmig_nat", placeholder = "bd_contmig_nat" ), textInput( inputId = ns("name_login"), - label= "utilisateur", value = NULL, placeholder = "Nom utilisateur utilisé pour l'accès à la base de données." + label= "utilisateur", value = NULL, placeholder = "Nom utilisateur utilis\u00e9 pour l'acc\u00e8s \u00e0 la base de donn\u00e9es." ), passwordInput( inputId = ns("pass_login"), - label= "mot de passe", value = NULL, placeholder = "Mot de passe utilisé pour l'accès à la base de données." + label= "mot de passe", value = NULL, placeholder = "Mot de passe utilis\u00e9 pour l'acc\u00e8s \u00e0 la base de donn\u00e9es." ), actionBttn( inputId = ns("login_button"), @@ -73,13 +67,14 @@ mod_header_ui <- function(id){ #' @importFrom shiny observeEvent isolate #' @importFrom spsComps shinyCatch #' @importFrom pool poolClose -#' @importFrom shinydashboardPlus dashboardUser dashboardUserItem +#' @importFrom shinydashboardPlus dashboardUser dashboardUserItem renderUser +#' @import stacomirtools mod_header_server <- function(id){ moduleServer( id, function(input, output, session){ ns <- session$ns # Action lorsque le bouton connection est pressé - observeEvent(input$login_button, { spsComps::shinyCatch({ + observeEvent(input$login_button, { shinyCatch({ # utilisateur et mot de passe sont isolés host <- isolate(input$host_login) @@ -104,52 +99,20 @@ mod_header_server <- function(id){ assign("db_connection", db_connection, envir = envir_stacomi ) #db_connection <<- db_connection # on met à jour la boite du statut de la connection - output$statut_connection <- shinydashboardPlus::renderUser({ + output$statut_connection <- renderUser({ dashboardUser( name = db_connection@base[1], image = "https://e7.pngegg.com/pngimages/165/79/png-clipart-database-server-computer-icons-database-connection-backup-database-miscellaneous-angle-thumbnail.png", #title = , subtitle = paste('Utilisateur :', db_connection@base[4], sep=' '), - footer = p(paste('Hôte :',db_connection@base[2], sep = ' '), class = "text-center") - # fluidRow( - # dashboardUserItem( - # width = 6, - # shinydashboardPlus::socialButton( - # href = "https://dropbox.com", - # icon = icon("dropbox") - # ) - # ), - # dashboardUserItem( - # width = 6, - # shinydashboardPlus::socialButton( - # href = "https://github.com", - # icon = icon("github") - # ) - # ) - # ) + footer = p(paste('H\u00f4te :',db_connection@base[2], sep = ' '), class = "text-center") + ) }) # fin output$statut_connection }# fin if - # on met à jour la boite du statut de la connection -# output$statut_connection <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Statut connection", -# ifelse(succeed, "Connecté", "Invalide"), -# icon = icon(ifelse(succeed, "check", "times")), -# color = ifelse(succeed, "green", "red") -# ) -# }) # fin output$statut_connection - - # et le nom de l'utilisateur -# output$statut_utilisateur <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Utilisateur", -# username, -# icon = icon("user", lib = "glyphicon") -# ) -# }) # fin output$statut_utilisateur + }, blocking_level = "error") }) # fin observeEvent connection diff --git a/R/mod_interannuel.R b/R/mod_interannuel.R new file mode 100644 index 0000000000000000000000000000000000000000..fb2193115a60a82a3756d859d810e9f7a73dd77c --- /dev/null +++ b/R/mod_interannuel.R @@ -0,0 +1,114 @@ +#' interannuel UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +#' @importFrom DT renderDT DTOutput +mod_interannuel_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "interannuel", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + sliderInput("annee", label = h5("Choisissez l\'ann\u00e9e"), min = 1980, + max = 2021, value = c(2011, 2021)), + + selectizeInput('taxon', h5('Choisissez un taxon :'), + selected="A", choices = c("A","B"), + multiple = FALSE), + + selectizeInput('stade', h5('Choisissez un stade :'), + selected="A", choices = c("A","B"), + multiple = FALSE), + + selectizeInput('pas_temps', h5('Choisissez un d\u00e9coupage :'), + selected="Jour", choices = c("Jour","Semaine","Mois","Quinzaine"), + multiple = FALSE), + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_line" = 1, "plot_standard" = 2, "plot_step" = 3,"plot_barchart"=4,"plot_pointRange"=5,"plot_density"=6,"plot_seasonnal"=7,"tab_summary"=8), + selected = 1), + actionBttn( + inputId = "bttn_interannuel", + label = "OK", + style = "fill", + color = "primary" + ) + + + ), + box(collapsible = TRUE, + width=9, + + plotOutput(ns("plot_interannuel_line")), + plotOutput(ns("plot_interannuel_standard")), + plotOutput(ns("plot_interannuel_step")), + plotOutput(ns("plot_interannuel_barchart")), + plotOutput(ns("plot_interannuel_pointRange")), + plotOutput(ns("plot_interannuel_density")), + plotOutput(ns("plot_interannuel_seasonnal")) + ), + box(collapsible = TRUE, + width=12, + + DTOutput(ns("tab_interannuel_summary")) + + ) + + ) + +} + +#' interannuel Server Functions +#' +#' @noRd +#' @importFrom shinipsum random_ggplot random_DT +mod_interannuel_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + #Bilan interannuel + output$plot_interannuel_line <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_standard <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_step <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_barchart <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_pointRange <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_density <- renderPlot({ + random_ggplot() + }) + + output$plot_interannuel_seasonnal <- renderPlot({ + random_ggplot() + }) + + output$tab_interannuel_summary <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_interannuel_ui("interannuel_ui_1") + +## To be copied in the server +# mod_interannuel_server("interannuel_ui_1") diff --git a/R/mod_left_side_bar.R b/R/mod_left_side_bar.R index 75516a1427ddd36752795876fa2904357ad030e8..6993ea534abc96e846bfcd3a935cfbc4c66a2f20 100644 --- a/R/mod_left_side_bar.R +++ b/R/mod_left_side_bar.R @@ -13,10 +13,11 @@ mod_left_side_bar_ui <- function(id){ ns <- NS(id) dashboardSidebar( sidebarMenu( - radioButtons("radio_station", label = h5("A quelle échelle voulez-vous faire le bilan ?"), + radioButtons("radio_station", label = h5("A quelle \u00e9chelle voulez-vous faire le bilan ?"), choices = list("DC" = 1, "Station" = 2), selected = 1,inline=T), - mod_ref_dc_ui("ref_dc_ui_sidebar"), + h3("En fonction du choix de l\'utilisateur DC ou station, ajouter une box de s\u00e9lection"), + # menuItem(tabName="migr","Migration" # ), menuItem(tabName = "migr_mult","Migrations multiples" @@ -25,16 +26,18 @@ mod_left_side_bar_ui <- function(id){ ), menuItem(tabName = "interannuel","Interannuel" ), - menuItem(tabName = "espece","Espèces" + menuItem(tabName = "espece","Esp\u00e8ces" ), - menuItem(tabName = "car_lot","Caractéristiques de lot" + menuItem(tabName = "car_lot","Caract\u00e9ristiques de lot" ), - menuItem(tabName = "env","Conditions environnementales" + menuItem(tabName = "migr_car","Migration / Param. quant. ou qual." + ), + menuItem(tabName = "migr_env","Migration vs conditions envir." + ), + h4("Bilans sp\u00e9cifiques :"), + menuItem(tabName = "sat_age","SAT - Taille/\u00c2ge" ), - h4("Bilans spécifiques :"), - menuItem(tabName = "sat_age","SAT - Taille/Âge" - ), - menuItem(tabName = "ang_argentee","ANG - Anguille argentée" + menuItem(tabName = "ang_argentee","ANG - Anguille argent\u00e9e" ), menuItem(tabName = "civ_poids","CIV - Poids moyen civelle" ), @@ -42,7 +45,9 @@ mod_left_side_bar_ui <- function(id){ menuItem(tabName = "bilan_df","Dispositif franchissement" ), menuItem(tabName = "bilan_dc","Dispositif comptage" - ) + ), + menuItem(tabName = "env","Station mesure env." + ) )) } diff --git a/R/mod_main_page.R b/R/mod_main_page.R index b93236475c4f6883d9a3fd95afc45e852acd9d10..4d39078c1788d992a8520c145c14849bd13bdf21 100644 --- a/R/mod_main_page.R +++ b/R/mod_main_page.R @@ -7,12 +7,27 @@ #' @noRd #' #' @importFrom shiny NS tagList +#' @importFrom shinydashboard dashboardBody tabItems + mod_main_page_ui <- function(id){ ns <- NS(id) - shinydashboard::dashboardBody( - shinydashboard::tabItems( -# mod_main_page_login_ui("main_page_login_ui_1") - ) + dashboardBody( + tabItems( + mod_migr_multi_ui("migr_multi_ui_1"), + mod_annuel_ui("annuel_ui_1"), + mod_interannuel_ui("interannuel_ui_1"), + mod_espece_ui("espece_ui_1"), + mod_car_lot_ui("car_lot_ui_1"), + mod_migr_car_ui("migr_car_ui_1"), + mod_migr_env_ui("migr_env_ui_1"), + mod_sat_age_ui("sat_age_ui_1"), + mod_ang_argentee_ui("ang_argentee_ui_1"), + mod_civ_poids_ui("civ_poids_ui_1"), + mod_bilan_df_ui("bilan_df_ui_1"), + mod_bilan_dc_ui("bilan_dc_ui_1"), + mod_env_ui("env_ui_1") + + ) ) } diff --git a/R/mod_main_page_login.R b/R/mod_main_page_login.R deleted file mode 100644 index 2a401a98662a084cc59032eedf2cd87369e83a6a..0000000000000000000000000000000000000000 --- a/R/mod_main_page_login.R +++ /dev/null @@ -1,165 +0,0 @@ -#' main_page_login UI Function -#' -#' @description A shiny Module. -#' -#' @param id,input,output,session Internal parameters for {shiny}. -#' -#' @noRd -#' -#' @importFrom shiny NS tagList -mod_main_page_login_ui <- function(id){ - ns <- NS(id) - - shinydashboard::tabItem( - tabName = "login", - # to have popup message on error - spsComps::spsDepend("toastr"), - - # première ligne de boite info - shiny::fluidRow( - - # Boite info sur la base - shinydashboard::infoBox( - title = "Base", - "locale", - icon = icon("database") - ), - shinydashboard::infoBoxOutput(ns("statut_connection")) - ), - # seconde ligne avec la boite d'auhtentification - shiny::fluidRow( - shinydashboardPlus::box( - # mise en forme de la box - id = ("box_authentification"), - title = "Authentification", - status = "primary", - solidHeader = TRUE, collapsible = TRUE, - - # ligne du host - shiny::textInput(ns("host_login"), label ="Host:", placeholder = "Nom de l'host ou IP du serveur de la base de données."), - - # ligne du port - shiny::textInput(ns("port_login"), label ="Port:", placeholder = "Numéro de port du serveur de la base de données."), - - # ligne du base - shiny::textInput(ns("dbname_login"), label ="Nom de la base:", placeholder = "Nom de la base de données."), - - # ligne du nom - shiny::textInput(ns("name_login"), label ="Identifiant:", placeholder = "Nom utilisateur utilisé pour l'accès à la base de données."), - - # ligne du mot de passe - shiny::passwordInput(ns("pass_login"), label = "Mot de passe:", placeholder = "Mot de passe utilisé pour l'accès à la base de données."), - - # bouton d'authentification / déconnection - shiny::br(), - shiny::actionButton(ns("login_button"), "S'authentifier", class = "btn btn-success"), - shiny::actionButton(ns("logout_button"), "Se déconnecter", class = "btn btn-danger", style="float:right") - ) - ) - ) -} - -#' main_page_login Server Functions -#' -#' @import stacomirtools -#' @noRd -mod_main_page_login_server <- function(id){ - moduleServer( id, function(input, output, session){ - ns <- session$ns - - # Action lorsque le bouton connection est pressé - shiny::observeEvent(input$login_button, { spsComps::shinyCatch({ - - # utilisateur et mot de passe sont isolés - host <- shiny::isolate(input$host_login) - port <- shiny::isolate(input$port_login) - dbname <- shiny::isolate(input$dbname_login) - user <- shiny::isolate(input$name_login) - password <- shiny::isolate(input$pass_login) - - - # on se connecte à la base - if (user != "") { - db_connection = new("ConnectionDB") - db_connection@base = c(dbname, host, port, user, password) - db_connection =connect(db_connection) - - } # fin if - - if (db_connection@status == "Connection OK") { - pool::poolClose(db_connection@connection) - - # on stocke l'utilisateur, la connection et les feuilles dans l'environnement global - assign("db_connection", db_connection, envir = envir_stacomi ) - #db_connection <<- db_connection - # on met à jour la boite du statut de la connection - output$statut_connection <- shinydashboard::renderInfoBox({ - shinydashboard::infoBox( - title = "Statut connection", - ifelse(TRUE, "Connecté", "Invalide"), - icon = icon(ifelse(TRUE, "check", "times")), - color = ifelse(TRUE, "green", "red") - ) - }) # fin output$statut_connection - - }# fin if - - # on met à jour la boite du statut de la connection -# output$statut_connection <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Statut connection", -# ifelse(succeed, "Connecté", "Invalide"), -# icon = icon(ifelse(succeed, "check", "times")), -# color = ifelse(succeed, "green", "red") -# ) -# }) # fin output$statut_connection - - # et le nom de l'utilisateur -# output$statut_utilisateur <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Utilisateur", -# username, -# icon = icon("user", lib = "glyphicon") -# ) -# }) # fin output$statut_utilisateur - }, blocking_level = "error") - }) # fin observeEvent connection - - # Action lorsque le bouton déconnection est pressé - shiny::observeEvent(input$logout_button, { -# if(is_logged()){ -# react_data$logged = FALSE -# if (!is.null(dbpool)) { -# try(pool::poolClose(dbpool)) -# } -# username <<- NULL -# dbpool <<- NULL -# } - # on met à jour la boite du statut de la connection -# output$statut_connection <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Statut connection", -# "déconnecté", -# icon = icon("times"), -# color = "red" -# ) -# }) # fin output$statut_connection - -# # et le nom de l'utilisateur -# output$statut_utilisateur <- shinydashboard::renderInfoBox({ -# shinydashboard::infoBox( -# title = "Utilisateur", -# username, -# icon = icon("user", lib = "glyphicon") -# ) -# }) # fin output$statut_utilisateur - }) # fin observeEvent déconnection - - }) -} - -## To be copied in the UI -# mod_main_page_login_ui("main_page_login_ui_1") - -## To be copied in the server -# mod_main_page_login_server("main_page_login_ui_1") diff --git a/R/mod_migr_car.R b/R/mod_migr_car.R new file mode 100644 index 0000000000000000000000000000000000000000..118b233dd8b6b937cfe373bc6c84858b8969c1d0 --- /dev/null +++ b/R/mod_migr_car.R @@ -0,0 +1,105 @@ +#' migr_car UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList dateRangeInput radioButtons selectizeInput +#' @importFrom shinydashboard tabItem box +#' @importFrom shinyWidgets radioGroupButtons +mod_migr_car_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "migr_car", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + radioButtons("radio_choix", label = h5("Souhaitez-vous inclure les \u00e9chantillons ?"), + choices = list("Oui" = 1, "Non" = 2), + selected = 1,inline=T), + selectizeInput('esp_taxon', h5('Choisissez un ou des taxon(s) :'), + selected="A", choices = c("A","B"), + multiple = TRUE), + selectizeInput('esp_stade', h5('Choisissez un ou des stade(s) :'), + selected="A", choices = c("A","B"), + multiple = TRUE), + selectizeInput('esp_car_qual', h5('Choisissez une ou des caract\u00e9ristique(s) qualitative(s) de lot :'), + choices = c("A","B","C"), + multiple = TRUE), + #voir comment gérer setasqualitative + selectizeInput('esp_car_quan', h5('Choisissez une ou des caract\u00e9ristique(s) quantitative(s) de lot :'), + choices = c("A","B","C"), + multiple = TRUE), +# radioButtons("radio_choix", label = h5("Choisissez les sorties graphiques ou tableaux :"), +# choices = list("plot_param_qualitatif" = 1, "plot_param_quantitatif" = 2, "plot_crossed" = 3, "tab_data"= 4), +# selected = 1, inline=F), + radioGroupButtons("choix_sorties", + label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = c(`qal <i class='fa fa-bar-chart'></i>` = "qual", + `quan <i class='fa fa-line-chart'></i>` = "quan", + `crossed <i class='fa fa-pie-chart'></i>` = "crossed", + `tab <i class='fa fa-table'></i>` = "tab"), + selected = 1, + status = "primary"), + actionBttn( + inputId = "bttn_migrcar", + label = "OK", + style = "fill", + color = "primary" + ) + + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_migrcar_paramqual")), + plotOutput(ns("plot_migrcar_paramquan")), + plotOutput(ns("plot_migrcar_crossed")) + + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_migrcar_data")) + ) + + ) + +} + +#' migr_car Server Functions +#' +#' @noRd +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +mod_migr_car_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + + output$plot_migrcar_paramqual <- renderPlot({ + random_ggplot() + }) + + output$plot_migrcar_paramquan <- renderPlot({ + random_ggplot() + }) + + output$plot_migrcar_crossed <- renderPlot({ + random_ggplot() + }) + + + output$tab_migrcar_data <- renderDT({ + random_DT(5, 5) + }) + + }) +} + +## To be copied in the UI +# mod_migr_car_ui("migr_car_ui_1") + +## To be copied in the server +# mod_migr_car_server("migr_car_ui_1") diff --git a/R/mod_migr_env.R b/R/mod_migr_env.R new file mode 100644 index 0000000000000000000000000000000000000000..c798011227d0bd7b1f191412c2c6e083e509a59d --- /dev/null +++ b/R/mod_migr_env.R @@ -0,0 +1,77 @@ +#' migr_env UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem box +mod_migr_env_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "migr_env", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + selectizeInput('station_mesure_mult', h5('Choisissez une ou plusieurs station(s) de mesure :'), + choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + selectizeInput('pas_temps', h5('Choisissez un pas de temps :'), + selected="1 jour", choices = c("1 sec","1 min","10 min","15 min","30 min","1 h","12 h","1 jour","1 sem","2 sem","1 mois","3 mois","6 mois","1 an"), + multiple = FALSE), + numericInput("num", label = h5("Nombre de pas de temps :"), value = 365), + + selectizeInput('taxon_mult', h5('Choisissez un ou plusieurs taxon(s) :'), + choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + selectizeInput('stade_mult', h5('Choisissez un ou plusieurs stade(s) :'), + choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_migr_env1" = 1, "plot_migr_env2" = 2), + selected = 1), + actionBttn( + inputId = "bttn_migrenv", + label = "OK", + style = "fill", + color = "primary" + ) + + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_migr_env1")), + plotOutput(ns("plot_migr_env2")) + + ) + + ) +} + +#' migr_env Server Functions +#' @importFrom shinipsum random_ggplot +#' @noRd +mod_migr_env_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + output$plot_migr_env1 <- renderPlot({ + random_ggplot() + }) + + output$plot_migr_env2 <- renderPlot({ + random_ggplot() + }) + + }) +} + +## To be copied in the UI +# mod_migr_env_ui("migr_env_ui_1") + +## To be copied in the server +# mod_migr_env_server("migr_env_ui_1") diff --git a/R/mod_migr_multi.R b/R/mod_migr_multi.R new file mode 100644 index 0000000000000000000000000000000000000000..c0bb697d309e99c40aa3f68cee1c394c5e78d514 --- /dev/null +++ b/R/mod_migr_multi.R @@ -0,0 +1,104 @@ +#' migr_multi UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList +#' @importFrom shinydashboard tabItem +#' @importFrom shinydashboard tabItem box +#' @importFrom DT renderDT DTOutput + +mod_migr_multi_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "migr_mult", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateInput("date", label = h5("Choisissez une date de d\u00e9but :"), value = "2014-01-01"), + + selectizeInput('pas_temps', h5('Choisissez un pas de temps : '), + selected="1 jour", choices = c("1 sec", "1 min", "10 min","15 min","30 min","1 h","1 jour","1 sem","2 sem","1 mois","3 mois","6 mois","1 an"), + multiple = FALSE), + + numericInput("num", label = h5("Nombre de pas de temps :"), value = 365), + + selectizeInput("dc_mult", h5('Choisissez le ou les DC :'), + selected=NULL, choices=list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + selectizeInput("taxon_mult", h5('Choisissez un ou plusieurs taxon(s) :'), + selected=NULL, choices=list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + selectizeInput("stade_mult", h5('Choisissez un ou plusieurs stade(s) :'), + selected=NULL, choices=list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3), + multiple = TRUE), + + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_standard" = 1, "plot_step" = 2,"plot_multiple" = 3,"tab_migration_mult_summary" = 4, "tab_migration_mult_data" = 5), + selected = 1), + actionBttn( + inputId = "bttn_migr_mult", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_migration_mult_standard")), + plotOutput(ns("plot_migration_mult_step")), + plotOutput(ns("plot_migration_multiple")) + ), + box(collapsible = TRUE, + width=12, + + DTOutput(ns("tab_migration_mult_summary")), + DTOutput(ns("tab_migration_mult_data")) + ) + + ) + +} + +#' migr_multi Server Functions +#' +#' @noRd +#' @importFrom shinipsum random_ggplot random_DT +mod_migr_multi_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + + #Bilan migration multiple + output$plot_migration_mult_standard <- renderPlot({ + random_ggplot() + }) + + output$plot_migration_mult_step <- renderPlot({ + random_ggplot() + }) + + output$plot_migration_multiple <- renderPlot({ + random_ggplot() + }) + + output$tab_migration_mult_summary <- renderDT({ + random_DT(5, 5) + }) + + output$tab_migration_mult_data <- renderDT({ + random_DT(5, 5) + }) + + + }) +} + +## To be copied in the UI +# mod_migr_multi_ui("migr_multi_ui_1") + +## To be copied in the server +# mod_migr_multi_server("migr_multi_ui_1") diff --git a/R/mod_sat_age.R b/R/mod_sat_age.R new file mode 100644 index 0000000000000000000000000000000000000000..470f32ad3c59826e59d453845b9b7a3c599ec3fc --- /dev/null +++ b/R/mod_sat_age.R @@ -0,0 +1,72 @@ +#' sat_age UI Function +#' +#' @description A shiny Module. +#' +#' @param id,input,output,session Internal parameters for {shiny}. +#' +#' @noRd +#' +#' @importFrom shiny NS tagList dateRangeInput numericInput checkboxGroupInput +#' @importFrom shinydashboard tabItem box +#' @importFrom shinyWidgets actionBttn +mod_sat_age_ui <- function(id){ + ns <- NS(id) + tabItem(tabName = "sat_age", + box(title = "S\u00e9lections :", + collapsible = TRUE, + width = 3, + dateRangeInput("dates", label = h5("S\u00e9lectionnez la date de d\u00e9but et de fin :")), + + numericInput("num", label = h5("Choisissez la taille max en mm des 1 an de mer :"), value = 650), + + numericInput("num", label = h5("Choisissez la taille max en mm des 2 ans de mer :"), value = 850), + + checkboxGroupInput("choix_sorties", label = h4("Choisissez les sorties graphiques ou tableaux :"), + choices = list("plot_satage" = 1, "tab_satage_data" = 3), + selected = 1), + + actionBttn( + inputId = "bttn_satage", + label = "OK", + style = "fill", + color = "primary" + ) + ), + + box(collapsible = TRUE, + width=9, + plotOutput(ns("plot_satage")) + ), + box(collapsible = TRUE, + width=12, + DTOutput(ns("tab_satage_data"))) + + ) + +} + +#' sat_age Server Functions +#' +#' @noRd +#' @importFrom shinipsum random_ggplot random_DT +#' @importFrom DT renderDT +mod_sat_age_server <- function(id){ + moduleServer( id, function(input, output, session){ + ns <- session$ns + + output$plot_satage <- renderPlot({ + random_ggplot() + }) + + output$tab_satage_data <- renderDT({ + random_DT(5, 5) + }) + + }) +} + +## To be copied in the UI +# mod_sat_age_ui("sat_age_ui_1") + +## To be copied in the server +# mod_sat_age_server("sat_age_ui_1") diff --git a/dev/01_start.R b/dev/01_start.R index 27a6c0abd3dd560b5d314155d12d15c0c003ef6f..87ff9fab61676730ecb4d542411528b8831c7a3a 100644 --- a/dev/01_start.R +++ b/dev/01_start.R @@ -53,7 +53,7 @@ golem::use_recommended_deps() ## Favicon ---- # If you want to change the favicon (default is golem's one) golem::use_favicon(path = "https://stacomir.r-forge.r-project.org/images/stacomi_logo.png") # path = "path/to/ico". Can be an online file. -golem::remove_favicon() +#golem::remove_favicon() ## Add helper functions ---- golem::use_utils_ui() diff --git a/dev/02_dev.R b/dev/02_dev.R index ebda876910b1ec87b5cc7043a31178896c3b7027..8983ad56272481eb7bdc965b1615106e9ed109ae 100644 --- a/dev/02_dev.R +++ b/dev/02_dev.R @@ -20,6 +20,9 @@ usethis::use_package("shinydashboardPlus") usethis::use_package("shinyjs") usethis::use_package("shinyWidgets") usethis::use_package("spsComps") +usethis::use_package("pool") +usethis::use_package("rlang") +usethis::use_package("shinipsum") #, "shinyWidgets" usethis::use_dev_package("stacomirtools", remote = "Remotes: gitlab::git@forgemia.inra.fr:stacomi/stacomirtools.git" ) usethis::use_dev_package("stacomiR", remote = "Remotes: gitlab::git@forgemia.inra.fr:stacomi/stacomir.git" ) @@ -30,7 +33,19 @@ golem::add_module( name = "main_page" ) # Main page for the shiny interface golem::add_module( name = "header" ) # Header for the shiny interface golem::add_module( name = "main_page_login" ) # login page golem::add_module( name = "left_side_bar") # left side bar -golem::add_module( name = "ref_dc") # left side bar +golem::add_module( name = "migr_multi") # migration multiple +golem::add_module( name = "espece") # module espece +golem::add_module( name = "annuel") # module annuel +golem::add_module( name = "interannuel") # mode interannuel +golem::add_module( name = "car_lot") # caractéristiques des lots +golem::add_module( name = "migr_car") #Bilan Migration - caractéristique lot +golem::add_module( name = "migr_env") #Bilan migration vs condition env +golem::add_module( name = "sat_age") # Bilan SAT_age +golem::add_module( name = "ang_argentee") # Bilan anguilles argentées +golem::add_module( name = "civ_poids") # Bilan poids civelles +golem::add_module( name = "bilan_df") # Bilan dispositif franchissement +golem::add_module( name = "bilan_dc") # Bilan dispositif comptage +golem::add_module( name = "env") # Bilan condition environnementales ## Add helper functions ---- ## Creates fct_* and utils_* diff --git a/inst/app/www/favicon.jpg b/inst/app/www/favicon.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d8ebb8259e0bf0592eb14ab64d79fcbcafc87004 Binary files /dev/null and b/inst/app/www/favicon.jpg differ