Skip to content

Commit

Permalink
Merge pull request #35 from earnaud/dev
Browse files Browse the repository at this point in the history
HOTFIX: attributes regular save
  • Loading branch information
earnaud authored Mar 17, 2020
2 parents b7a7105 + a43abb8 commit e176dd7
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 18 deletions.
Binary file modified .RData
Binary file not shown.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ importFrom(shiny,runApp)
importFrom(shiny,selectInput)
importFrom(shiny,shinyApp)
importFrom(shiny,showModal)
importFrom(shiny,showNotification)
importFrom(shiny,span)
importFrom(shiny,stopApp)
importFrom(shiny,tabPanel)
Expand Down
1 change: 1 addition & 0 deletions R/mod-emlal-EMLAL_Attributes.R
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ Attributes <- function(input, output, session, savevar, globals) {
else
isolate(rv$current_table[row_index, colname] <- input[[inputId]])

rv$tables[[rv$current_file]] <- rv$current_table
})
}

Expand Down
66 changes: 49 additions & 17 deletions R/mod-emlal-EMLAL_makeeml.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MakeEMLUI <- function(id, title, dev) {
ns <- NS(id)

return(
fluidPage(
# Features UI -----------------------------------------------------
Expand All @@ -11,12 +11,21 @@ MakeEMLUI <- function(id, title, dev) {
h2("We're almost there !"),
p("By clicking this button, you will process your metadata into
a EML-valid xml file."),
actionButton(ns("make_eml"), "Make EML"),
tags$p("(NOTE: you will be able to edit this data package furtherly)"),
actionButton(
ns("make_eml"),
"Make EML",
icon("edit"),
width = "50%"
),
textOutput(ns("warnings")),
tags$br(),
hidden(
div(
id = ns("process"),
"RUNNING"
actionButton(
ns("publish"),
"Publish",
icon("share-alt"),
width = "50%"
)
)
)
Expand All @@ -39,17 +48,19 @@ MakeEMLUI <- function(id, title, dev) {
#' @title MakeEML
#'
#' @description server part of the make EML module
#'
#'
#' @importFrom shiny showNotification renderText validate need req isTruthy observeEvent
#' @importFrom shinyjs show
#' @importFrom EMLassemblyline make_eml template_arguments
MakeEML <- function(input, output, session, savevar, globals) {
ns <- session$ns

if (globals$dev) {
observeEvent(input$check, {
browser()
})
}

# NSB -----------------------------------------------------
callModule(
onQuit, "nav",
Expand All @@ -69,19 +80,19 @@ MakeEML <- function(input, output, session, savevar, globals) {
prevTab, "nav",
globals
)

# Make eml -----------------------------------------------------
observeEvent(input$make_eml, {
req(input$make_eml)

. <- savevar$emlal

x <- template_arguments(
path = .$SelectDP$dp_metadata_path,
data.path = .$SelectDP$dp_data_path,
data.table = dir(.$SelectDP$dp_data_path)
)

x$path <- .$SelectDP$dp_metadata_path
x$data.path <- .$SelectDP$dp_data_path
x$eml.path <- .$SelectDP$dp_eml_path
Expand All @@ -91,29 +102,50 @@ MakeEML <- function(input, output, session, savevar, globals) {
x$dataset.title <- .$SelectDP$dp_title
x$maintenance.description <- "Ongoing"
# TODO package.id
x$package.id <- "Idontknowhowtogenerateproperid"
x$package.id <- "localid"
x$return.obj <- TRUE
x$temporal.coverage <- .$Misc$temporal_coverage
# TODO user domain (pndb?)
x$user.domain <- "UserDomain"
# TODO user id (orcid?)
x$user.id <- "UserID"
x$write.file <- TRUE

# Yet written in the files then used in make_eml
x$geographic.coordinates <- NULL
x$geographic.description <- NULL

try(
out <- do.call(
out <- try(
do.call(
make_eml,
x[names(x) %in% names(formals(make_eml))]
)
)

browser()
output$warnings <- renderText({
validate(
need(class(out) != "try-error", out[1])
)
showNotification("EML written !", type = "message")
return(NULL)
})

if(class(out) != "try-error")
show("publish", anim = TRUE, time = 0.25)

})

# Publish -----------------------------------------------------
if(isTruthy(dir(savevar$emlal$SelectDP$dp_eml_path)))
show("publish", anim = TRUE, time = 0.25)

observeEvent(input$publish, {
req(input$publish)

# updateTabItems(session, "side_menu", "upload")
globals$EMLAL$NAVIGATE <- 1
})

# Output -----------------------------------------------------
return(savevar)
}
1 change: 0 additions & 1 deletion R/mod-emlal-EMLAL_misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ Misc <- function(input, output, session, savevar, globals, server) {
observeEvent(input[["nav-nextTab"]],
{
savevar$emlal$Misc <- rv
browser()

message("Writing 'abstract.txt'.")
write.text(
Expand Down

0 comments on commit e176dd7

Please sign in to comment.