Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
earnaud committed Feb 11, 2022
1 parent af29dd0 commit c27b690
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 34 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ RUN aptitude install -y -f -o APT::Get::Fix-Missing=true \
libharfbuzz-dev \
libfribidi-dev \
mesa-common-dev \
libudunits2-dev \
libgdal-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -41,8 +43,8 @@ RUN dpkg -S /usr/include/GL/gl.h \
&& R -e 'install.packages("devtools")' \
&& R -e 'devtools::install_version("remotes", version = "2.3.0")'

RUN R -e 'remotes::install_github("EDIorg/EMLassemblyline@ad838f970ee259eda7f96d6a0bbe7f9fa509c66e")'
RUN Rscript -e 'remotes::install_github("LukasK13/SummeRnote@7c404e1578ab3567fdb331716ca831913ccf645a")'
RUN R -e 'remotes::install_github("EDIorg/EMLassemblyline@d3d2eb90a67370c1138e234c09dd96c529408f90")'
RUN Rscript -e 'remotes::install_github("earnaud/SummeRnote")'

RUN R -e 'remotes::install_version("RCurl",upgrade="never", version = "1.98-1.3")'\
&& R -e 'remotes::install_version("attempt",upgrade="never", version = "0.3.1")' \
Expand All @@ -66,7 +68,10 @@ RUN R -e 'remotes::install_version("RCurl",upgrade="never", version = "1.98-1.3
&& R -e 'remotes::install_version("golem",upgrade="never", version = "0.3.1")' \
&& R -e 'remotes::install_version("textutils",upgrade="never", version = "0.2-1")' \
&& R -e 'remotes::install_version("tippy",upgrade="never", version = "0.1.0")' \
&& R -e 'remotes::install_version("shinybusy",upgrade="never", version = "0.2.2")'
&& R -e 'remotes::install_version("shinybusy",upgrade="never", version = "0.2.2")' \
&& R -e 'remotes::install_version("units",upgrade="never", version = "0.7-2")'\
&& R -e 'remotes::install_version("sf",upgrade="never", version = "1.0-5")' \
&& R -e 'remotes::install_version("leaflet",upgrade="never", version = "2.0.4.1")'


RUN R -e 'remotes::install_local(dir(".", pattern = "MetaShARK_.*\\.tar.gz"), upgrade="never")'
Expand Down
Binary file modified MetaShARK_1.7.0.tar.gz
Binary file not shown.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export(isHTMLTruthy)
export(listReactiveValues)
export(makeReactiveTrigger)
export(optional)
export(reactiveDirReader)
export(readHTMLfromMD)
export(remove_shiny_inputs)
export(renderBibliography)
Expand Down
8 changes: 3 additions & 5 deletions R/eal_2_DataFiles_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
#'
#' @noRd
insertDataFileInput <- function(id, main.env){
# Add row
.id <- unns(id)
# create the UI -- no NS !!!
# create the UI
new.ui <- DataFileInputUI(id, main.env)
# insert the UI
insertUI(selector = "#inserthere_eal2", ui = new.ui, immediate = TRUE)
# create the server
DataFileInput(.id, main.env)
DataFileInput(unns(id), main.env)
}

#' @import shiny
Expand Down Expand Up @@ -44,7 +42,7 @@ DataFileInputUI <- function(id, main.env) {
shinyjs::hidden(
tags$div(
id = NS(id, "content"),
class = "contentRow",
# class = "contentRow",
tagList(
fluidRow(
column(
Expand Down
4 changes: 1 addition & 3 deletions R/eal_3_Attributes_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ setUnitList <- function(main.env, set = NULL) {
types <- unique(names(choices[sapply(choices, length) != 1]))
out <- choices[sapply(choices, length) == 1]
out <- c(custom = out$custom, out[names(out) != "custom"])
# browser()

sapply(types, function(type){
out[[type]] <<- unname(choices[which(names(choices) == type)])[[1]]
})

# Correct value set for updates
if(!is.null(set)) {
set <- set |>
Expand All @@ -83,8 +83,6 @@ setUnitList <- function(main.env, set = NULL) {
as.list()
}

# TODO rework unit listing

# Output
return(list(
unit.list = out,
Expand Down
58 changes: 35 additions & 23 deletions R/fill_module.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fillUI <- function(id) {
tags$h4("EML Assembly Line"),
fluidPage(
style = "padding-top:2.5%; background-color: #ffffff57",
# * Top row ----
## Top row ----
tags$table(
style="width: 100%",
HTML(
Expand All @@ -20,7 +20,10 @@ fillUI <- function(id) {
),
tags$tr(
tags$td(
style="width: 350px; min-width: 350px",
style="
width: 350px; min-width: 350px; max-width: 500px;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
",
h3(
textOutput(NS(id, "current_step"))
)
Expand Down Expand Up @@ -62,7 +65,7 @@ fillUI <- function(id) {
),

# uiOutput(NS(id, "chain")),
# * Pages ----
## Pages ----
pagesUI(
NS(id, "wizard"),
parent.id = id
Expand Down Expand Up @@ -130,7 +133,7 @@ fill <- function(id, main.env) {
)
})

# * Quit ----
## Quit ----
{
# show modal.state 'quit' button clicked
observeEvent(input$quit, {
Expand Down Expand Up @@ -187,13 +190,22 @@ fill <- function(id, main.env) {
)
} # quit management

# * Save ----
## Save ----
observeEvent(input$save, {
if(main.env$dev)
devmsg("saved: %s", main.env$EAL$page, timer.env = main.env)
saveReactive(main.env, main.env$EAL$page, do.template = FALSE)
})

## Autosave ----
observeEvent(main.env$EAL$page, {
req(main.env$EAL$page != 1)
if(main.env$dev)
devmsg("autosaved: %s", main.env$EAL$page, timer.env = main.env)
saveReactive(main.env, main.env$EAL$page, do.template = FALSE)
}, priority = -2, label = "EAL: autosave") # important priority

## Current step ----
output$current_step <- renderText({
req(main.env$EAL$current)

Expand All @@ -214,18 +226,18 @@ fill <- function(id, main.env) {

withProgress(
{
# * Save & Template ----
## Save & Template ----
devmsg(tag="fill_module.R", "save & template", timer.env = main.env)
if(main.env$EAL$old.page > 1)
saveReactive(
main.env,
main.env$EAL$old.page,
main.env$EAL$old.page,
# do not template on 'previous'
do.template = main.env$EAL$old.page < main.env$EAL$page
)
incProgress(1/7)

# * set EAL variables ----
## set EAL variables ----
devmsg(tag="fill_module.R", "set EAL variables", timer.env = main.env)
# left Data Files
if (main.env$EAL$old.page == 2)
Expand All @@ -239,29 +251,29 @@ fill <- function(id, main.env) {
main.env$EAL$tag.list <- tagList()
incProgress(1/7)

# * Reset local.rv ----
## Reset local.rv ----
devmsg(tag="fill_module.R", "set local rv", timer.env = main.env)
main.env <- setLocalRV(main.env)
incProgress(1/7)

# * Change page ----
## Change page ----
devmsg(tag="fill_module.R", "change pane", timer.env = main.env)
updateTabsetPanel(session, "wizard-wizard", selected = steps[main.env$EAL$page])
incProgress(1/7)

# * Update history ----
## Update history ----
if (!main.env$EAL$current %in% main.env$EAL$history) {
main.env$EAL$history <- c(main.env$EAL$history, main.env$EAL$current)
}
devmsg(tag="fill_module.R", "update history", timer.env = main.env)
incProgress(1/7)

# * Savevar changes ----
## Savevar changes ----
devmsg(tag="fill_module.R", "save variables change", timer.env = main.env)
main.env$save.variable$step <- main.env$EAL$page # save current location
main.env$save.variable$history <- main.env$EAL$history # erase old save

# * Accessory UI elements ----
## Accessory UI elements ----
devmsg(tag="fill_module.R", "display UI", timer.env = main.env)
if(main.env$EAL$page > 1) {
shinyjs::show("top_row")
Expand All @@ -280,13 +292,13 @@ fill <- function(id, main.env) {

devmsg(tag="fill_module.R", "ended", timer.env = main.env)

# * Helps ====
## Helps ====
{
main.env$EAL$help <- modalDialog(
title = paste0(main.env$EAL$current, " - Help"),
switch(
main.env$EAL$page,
# ** SelectDP ====
### SelectDP ====
tagList(
tags$p("This module allows you to manage your", tags$strong("data packages"), ".
A data package (aka DP) is a collection of a dataset and its associated metadata
Expand All @@ -308,7 +320,7 @@ fill <- function(id, main.env) {
fields in further steps. You still will be able to edit them at your
convenience.")
),
# ** Data Files ====
### Data Files ====
tagList(
tags$p("This module allows you to load data files from the dataset you want to
describe. Once uploaded, you can set:"),
Expand All @@ -323,7 +335,7 @@ fill <- function(id, main.env) {
tags$p("Recommended size per file is around 1 Gb. Such files and heavier ones might slow down the
app.")
),
# ** Attributes ====
### Attributes ====
tagList(
tags$p("This module allows you to describe precisely each attribute of each file. Some of these metadata
are guessed from the data files. Such fields are annoted with a star (*).
Expand Down Expand Up @@ -362,12 +374,12 @@ fill <- function(id, main.env) {
tags$li(tags$i("Unit description:"), "some additional notes about the unit, how to compute it.")
)
),
# ** Catvars ====
### Catvars ====
tagList(
tags$p("This module allows you to detail the categorical variables (class \"categorical\" in Attributes).
For each variable, you will be able to detail each of its value by a short description.")
),
# ** Geocov ====
### Geocov ====
tagList(
tags$p("This module allows you to define the geographic area in which the data have been produced.
You have the choice between two methods to define geographic coverage:"),
Expand All @@ -393,14 +405,14 @@ fill <- function(id, main.env) {
)
)
),
# ** Taxcov ====
### Taxcov ====
tagList(
tags$p("This module allows you to define the taxonomical coverage of the study. You will be asked to
select columns among your files containing the species name. Also, let the app know if the taxonomic
coverage shall be written with scientific, common or both names. At last, select at least one taxonomic
authority among the ones suggested."),
),
# ** Personnel ====
### Personnel ====
tagList(
tags$p("This module allows you to get a full list of the people who contributed to the creation of
this dataset. The recommended best practice is to", tags$b("use the ORCID"), "of a person. With
Expand All @@ -416,7 +428,7 @@ fill <- function(id, main.env) {
tags$li("Custom: as the list of roles is not exhaustive, feel free to add any role you consider important.")
)
),
# ** Misc ====
### Misc ====
tagList(
tags$p("This module allows you to define the last details of your data package. Note that you can write
some of these metadata using the markdown syntax. Here are brief descriptions of the fields:"),
Expand All @@ -434,7 +446,7 @@ fill <- function(id, main.env) {
from GBIF-EML).")
)
),
# ** Make EML ====
### Make EML ====
tagList(
tags$p("Here we are (well done) ! This is the final step to write EML. Just click the button and let the magic happen. If an
error occurs, this will be displayed to the screen. In this case, do not hesitate to get in touch with the dev team."),
Expand Down
28 changes: 28 additions & 0 deletions man/reactiveDirReader.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c27b690

Please sign in to comment.