Skip to content
Snippets Groups Projects
Commit 27d30216 authored by LE DURAND Matteo's avatar LE DURAND Matteo
Browse files

Merge branch '25-les-noms-liens-cliquable' into 'dev'

ajout d'interface

See merge request !23
parents a33a7452 833f439e
Branches
No related tags found
2 merge requests!23ajout d'interface,!18MAJ de main de la branche dev
...@@ -17,7 +17,7 @@ library(jsonlite) ...@@ -17,7 +17,7 @@ library(jsonlite)
library(utils) library(utils)
library(lubridate) library(lubridate)
library(bizdays) library(bizdays)
library(shinyWidgets)
# chargement des données (résultat du script "dev/script_chargement_rdata.R") # chargement des données (résultat du script "dev/script_chargement_rdata.R")
load("github.RData") load("github.RData")
load("gitlab_forge.RData") load("gitlab_forge.RData")
...@@ -35,8 +35,8 @@ traduction <- c( ...@@ -35,8 +35,8 @@ traduction <- c(
"Note" = "Gestion de projet", "Note" = "Gestion de projet",
"WikiPage::Meta" = "Documentation", "WikiPage::Meta" = "Documentation",
"joined" = "Gestion de projet" , "joined" = "Gestion de projet" ,
"WorkItem" = "Code" , "WorkItem" = "Gestion de projet" ,
"MergeRequest" = "Gestion de projet" , "MergeRequest" = "Code" ,
"Milestone" = "Gestion de projet" "Milestone" = "Gestion de projet"
) )
all_data <- all_data %>% dplyr::mutate(type = dplyr::recode(type , !!!traduction)) all_data <- all_data %>% dplyr::mutate(type = dplyr::recode(type , !!!traduction))
server <- function(input, output) { server <- function(input, output) {
output$tablef <- # output$tablef <-
DT::renderDT({ # DT::renderDT({
DT::datatable(groupf, class = "display", options = list( # DT::datatable(groupf, class = "display", options = list(
pageLength = 10, # pageLength = 10,
order = list(6, "desc"), # order = list(6, "desc"),
scrollY = 1000, scrollX = 400, scroller = TRUE # scrollY = 1000, scrollX = 400, scroller = TRUE
), escape = FALSE) # ), escape = FALSE)
}) # })
#
output$issue_graph <- plotly::renderPlotly({ # output$issue_graph <- plotly::renderPlotly({
p <- ggplot2::ggplot(groupf) + # p <- ggplot2::ggplot(groupf) +
ggplot2::aes(x = reorder(name, -open_issues_count), y = open_issues_count) + # ggplot2::aes(x = reorder(name, -open_issues_count), y = open_issues_count) +
ggplot2::geom_col(fill = "#000091") + # ggplot2::geom_col(fill = "#000091") +
gouvdown::theme_gouv() + # gouvdown::theme_gouv() +
ggplot2::theme( # ggplot2::theme(
legend.position = "none", # legend.position = "none",
axis.title.x = element_blank(), # axis.title.x = element_blank(),
axis.text.x = element_blank(), # axis.text.x = element_blank(),
axis.ticks.x = element_blank(), # axis.ticks.x = element_blank(),
axis.title.y = element_blank() # axis.title.y = element_blank()
) # )
plotly::ggplotly(p) # plotly::ggplotly(p)
}) # })
#
# filtre les issues pour seulement garder ls variable interresante et celles encore ouverte pourl'exploration des données # # filtre les issues pour seulement garder ls variable interresante et celles encore ouverte pourl'exploration des données
groupid <- shiny::reactive({ # groupid <- shiny::reactive({
gitlabr::gl_list_issues(project = input$ID1) %>% # gitlabr::gl_list_issues(project = input$ID1) %>%
dplyr::select( # dplyr::select(
iid, # iid,
title, # title,
description, # description,
state, # state,
created_at, # created_at,
updated_at, # updated_at,
type, # type,
labels, # labels,
user_notes_count # user_notes_count
) # )
}) # })
groupidf <- shiny::reactive({ # groupidf <- shiny::reactive({
groupid() %>% dplyr::filter(state == "opened") # groupid() %>% dplyr::filter(state == "opened")
}) # })
#
nfermer <- shiny::reactive({ # nfermer <- shiny::reactive({
nrow(groupid() %>% dplyr::filter(state == "closed")) # nrow(groupid() %>% dplyr::filter(state == "closed"))
}) # })
output$issue_nbr <- shiny::renderText({ # output$issue_nbr <- shiny::renderText({
paste(nfermer(), "issues ont été fermées sur le projet", input$ID1) # paste(nfermer(), "issues ont été fermées sur le projet", input$ID1)
}) # })
#
output$issue <- # output$issue <-
DT::renderDT({ # DT::renderDT({
DT::datatable(groupidf(), # DT::datatable(groupidf(),
class = "display", # class = "display",
options = list( # options = list(
pageLength = 6, # pageLength = 6,
order = list(6, "desc"), # order = list(6, "desc"),
scrollY = 600, scrollX = 400, scroller = TRUE # scrollY = 600, scrollX = 400, scroller = TRUE
) # )
) # )
}) # })
output$dateinferieur <- shiny::renderText({ # output$dateinferieur <- shiny::renderText({
dateinf() # dateinf()
}) # })
#
#
output$activity <- # output$activity <-
DT::renderDT({ # DT::renderDT({
DT::datatable( # DT::datatable(
final_table, # final_table,
class = "display", # class = "display",
options = list( # options = list(
pageLength = 20, # pageLength = 20,
order = list(7, "desc"), # order = list(7, "desc"),
scrollY = 2500, # scrollY = 2500,
scrollX = 800, # scrollX = 800,
scroller = TRUE, # scroller = TRUE,
autoWidth = TRUE # autoWidth = TRUE
) # )
) # )
}) # })
# utilisation du jeu de donnée data_chronol qui se trouve dans le global # utilisation du jeu de donnée data_chronol qui se trouve dans le global
filteredData <- reactive({ filteredData <- reactive({
...@@ -87,7 +87,22 @@ server <- function(input, output) { ...@@ -87,7 +87,22 @@ server <- function(input, output) {
all_data %>% all_data %>%
filter(updated_at >= as.Date(input$daterange[[1]]) & updated_at <= as.Date(input$daterange[[2]])) 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({ output$filteredPlot <- plotly::renderPlotly({
p <- ggplot2::ggplot(filteredData(), ggplot2::aes(x = updated_at, y = as.factor(project_name))) + p <- ggplot2::ggplot(filteredData(), ggplot2::aes(x = updated_at, y = as.factor(project_name))) +
......
...@@ -35,14 +35,18 @@ ui <- shinygouv::navbarPage_dsfr( # header & footer ------ ...@@ -35,14 +35,18 @@ ui <- shinygouv::navbarPage_dsfr( # header & footer ------
shinygouv::navbarPanel_dsfr( shinygouv::navbarPanel_dsfr(
title = "Graphique des projets par durée", title = "Graphique des projets par durée",
shinygouv::fluidRow_dsfr( shinygouv::fluidRow_dsfr(
shinygouv::column_dsfr(12, shinygouv::dateRangeInput_dsfr( shinygouv::column_dsfr(6, shinygouv::dateRangeInput_dsfr(
inputId = "daterange", inputId = "daterange",
label = "Sélectionnez une période :", label = "Sélectionnez une période :",
start = format(Sys.Date() - 7, format = "%Y-%m-%d"), start = format(Sys.Date() - 7, format = "%Y-%m-%d"),
separator = "à" 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::fluidRow_dsfr(
shinygouv::column_dsfr(12, plotly::plotlyOutput("filteredPlot", height = "700px"), shinygouv::column_dsfr(12, plotly::plotlyOutput("filteredPlot", height = "700px"),
extra_class = "fr-my-1w" extra_class = "fr-my-1w"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment