diff --git a/global.R b/global.R index d1751313d9d7fe4aa397a42f23eb755314690164..83734fd28ae76127c41b1ebfd2efd9f4168e419e 100644 --- a/global.R +++ b/global.R @@ -17,7 +17,7 @@ library(jsonlite) library(utils) library(lubridate) library(bizdays) - +library(shinyWidgets) # chargement des données (résultat du script "dev/script_chargement_rdata.R") load("github.RData") load("gitlab_forge.RData") @@ -35,8 +35,8 @@ traduction <- c( "Note" = "Gestion de projet", "WikiPage::Meta" = "Documentation", "joined" = "Gestion de projet" , - "WorkItem" = "Code" , - "MergeRequest" = "Gestion de projet" , + "WorkItem" = "Gestion de projet" , + "MergeRequest" = "Code" , "Milestone" = "Gestion de projet" ) all_data <- all_data %>% dplyr::mutate(type = dplyr::recode(type , !!!traduction)) diff --git a/server.R b/server.R index 10a5b52960733f36e0c46a1c320875b47f05babc..5caca22a380b5fd53c6f60d1d51ade78e25bee8d 100644 --- a/server.R +++ b/server.R @@ -1,85 +1,85 @@ -server <- function(input, output) { - output$tablef <- - DT::renderDT({ - DT::datatable(groupf, class = "display", options = list( - pageLength = 10, - order = list(6, "desc"), - scrollY = 1000, scrollX = 400, scroller = TRUE - ), escape = FALSE) - }) - - output$issue_graph <- plotly::renderPlotly({ - p <- ggplot2::ggplot(groupf) + - ggplot2::aes(x = reorder(name, -open_issues_count), y = open_issues_count) + - ggplot2::geom_col(fill = "#000091") + - gouvdown::theme_gouv() + - ggplot2::theme( - legend.position = "none", - axis.title.x = element_blank(), - axis.text.x = element_blank(), - axis.ticks.x = element_blank(), - axis.title.y = element_blank() - ) - plotly::ggplotly(p) - }) - - # filtre les issues pour seulement garder ls variable interresante et celles encore ouverte pourl'exploration des données - groupid <- shiny::reactive({ - gitlabr::gl_list_issues(project = input$ID1) %>% - dplyr::select( - iid, - title, - description, - state, - created_at, - updated_at, - type, - labels, - user_notes_count - ) - }) - groupidf <- shiny::reactive({ - groupid() %>% dplyr::filter(state == "opened") - }) - - nfermer <- shiny::reactive({ - nrow(groupid() %>% dplyr::filter(state == "closed")) - }) - output$issue_nbr <- shiny::renderText({ - paste(nfermer(), "issues ont été fermées sur le projet", input$ID1) - }) - - output$issue <- - DT::renderDT({ - DT::datatable(groupidf(), - class = "display", - options = list( - pageLength = 6, - order = list(6, "desc"), - scrollY = 600, scrollX = 400, scroller = TRUE - ) - ) - }) - output$dateinferieur <- shiny::renderText({ - dateinf() - }) - - - output$activity <- - DT::renderDT({ - DT::datatable( - final_table, - class = "display", - options = list( - pageLength = 20, - order = list(7, "desc"), - scrollY = 2500, - scrollX = 800, - scroller = TRUE, - autoWidth = TRUE - ) - ) - }) + server <- function(input, output) { +# output$tablef <- +# DT::renderDT({ +# DT::datatable(groupf, class = "display", options = list( +# pageLength = 10, +# order = list(6, "desc"), +# scrollY = 1000, scrollX = 400, scroller = TRUE +# ), escape = FALSE) +# }) +# +# output$issue_graph <- plotly::renderPlotly({ +# p <- ggplot2::ggplot(groupf) + +# ggplot2::aes(x = reorder(name, -open_issues_count), y = open_issues_count) + +# ggplot2::geom_col(fill = "#000091") + +# gouvdown::theme_gouv() + +# ggplot2::theme( +# legend.position = "none", +# axis.title.x = element_blank(), +# axis.text.x = element_blank(), +# axis.ticks.x = element_blank(), +# axis.title.y = element_blank() +# ) +# plotly::ggplotly(p) +# }) +# +# # filtre les issues pour seulement garder ls variable interresante et celles encore ouverte pourl'exploration des données +# groupid <- shiny::reactive({ +# gitlabr::gl_list_issues(project = input$ID1) %>% +# dplyr::select( +# iid, +# title, +# description, +# state, +# created_at, +# updated_at, +# type, +# labels, +# user_notes_count +# ) +# }) +# groupidf <- shiny::reactive({ +# groupid() %>% dplyr::filter(state == "opened") +# }) +# +# nfermer <- shiny::reactive({ +# nrow(groupid() %>% dplyr::filter(state == "closed")) +# }) +# output$issue_nbr <- shiny::renderText({ +# paste(nfermer(), "issues ont été fermées sur le projet", input$ID1) +# }) +# +# output$issue <- +# DT::renderDT({ +# DT::datatable(groupidf(), +# class = "display", +# options = list( +# pageLength = 6, +# order = list(6, "desc"), +# scrollY = 600, scrollX = 400, scroller = TRUE +# ) +# ) +# }) +# output$dateinferieur <- shiny::renderText({ +# dateinf() +# }) +# +# +# output$activity <- +# DT::renderDT({ +# DT::datatable( +# final_table, +# class = "display", +# options = list( +# pageLength = 20, +# order = list(7, "desc"), +# scrollY = 2500, +# scrollX = 800, +# scroller = TRUE, +# autoWidth = TRUE +# ) +# ) +# }) # utilisation du jeu de donnée data_chronol qui se trouve dans le global filteredData <- reactive({ @@ -87,7 +87,22 @@ server <- function(input, output) { all_data %>% filter(updated_at >= as.Date(input$daterange[[1]]) & updated_at <= as.Date(input$daterange[[2]])) }) + observeEvent(input$daterange,{ + updateSelectizeInput(inputId = "idprojet",label = "Projet : ", + choices = unique(filteredData()$project_name)) + output$lien <- renderUI({ + # Générer une liste d'URLs basée sur input$idprojet + urls <- paste0("https://gitlab-forge.din.developpement-durable.gouv.fr/dreal-pdl/csd/", input$idprojet) + + # Créer une liste de balises <a> pour chaque lien + links <- lapply(seq_along(input$idprojet), function(i) { + a(href = urls[i], target = "_blank", input$idprojet[i]) + }) + # Retourner les liens avec un saut de ligne après chacun + do.call(tagList, c(links, list(br()))) + }) + }) output$filteredPlot <- plotly::renderPlotly({ p <- ggplot2::ggplot(filteredData(), ggplot2::aes(x = updated_at, y = as.factor(project_name))) + diff --git a/ui.R b/ui.R index b92de49132a00e069fe34d6e66ce3a20ebfa8fbc..f1c61b6c87cfdee6dfd7e09acd2d79b8ded001b1 100644 --- a/ui.R +++ b/ui.R @@ -35,14 +35,18 @@ ui <- shinygouv::navbarPage_dsfr( # header & footer ------ shinygouv::navbarPanel_dsfr( title = "Graphique des projets par durée", shinygouv::fluidRow_dsfr( - shinygouv::column_dsfr(12, shinygouv::dateRangeInput_dsfr( + shinygouv::column_dsfr(6, shinygouv::dateRangeInput_dsfr( inputId = "daterange", label = "Sélectionnez une période :", start = format(Sys.Date() - 7, format = "%Y-%m-%d"), separator = "à" ), - extra_class = "fr-my-6w" - )), + extra_class = "fr-my-6w"), + shinygouv::column_dsfr(6, + selectizeInput(inputId = "idprojet",label = "Projet : ", + choices = NULL, multiple = TRUE)), + shinygouv::column_dsfr(12,uiOutput("lien"),extra_class = "fr-my-6w") + ), shinygouv::fluidRow_dsfr( shinygouv::column_dsfr(12, plotly::plotlyOutput("filteredPlot", height = "700px"), extra_class = "fr-my-1w"