Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dataviz_gitlabr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DREAL Pays de la Loire
Centre de Services de la Donnée
dataviz_gitlabr
Commits
27d30216
Commit
27d30216
authored
10 months ago
by
LE DURAND Matteo
Browse files
Options
Downloads
Plain Diff
Merge branch '25-les-noms-liens-cliquable' into 'dev'
ajout d'interface See merge request
!23
parents
a33a7452
833f439e
Branches
Branches containing commit
No related tags found
2 merge requests
!23
ajout d'interface
,
!18
MAJ de main de la branche dev
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
global.R
+3
-3
3 additions, 3 deletions
global.R
server.R
+97
-82
97 additions, 82 deletions
server.R
ui.R
+7
-3
7 additions, 3 deletions
ui.R
with
107 additions
and
88 deletions
global.R
+
3
−
3
View file @
27d30216
...
@@ -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
))
This diff is collapsed.
Click to expand it.
server.R
+
97
−
82
View file @
27d30216
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
)))
+
...
...
This diff is collapsed.
Click to expand it.
ui.R
+
7
−
3
View file @
27d30216
...
@@ -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"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment