From 7de763ca26dc9b2978f9d49564b0d11167e55f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu> Date: Sat, 2 May 2020 13:22:36 +0200 Subject: [PATCH] Adapt to previous changes R/shiny-ui-config.R(server_conf): conf is transformed using rv_lst2lst, file parsing is fixed and so on. --- R/shiny-ui-config.R | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/R/shiny-ui-config.R b/R/shiny-ui-config.R index a80dd19..de8b129 100644 --- a/R/shiny-ui-config.R +++ b/R/shiny-ui-config.R @@ -174,7 +174,7 @@ server_conf <- function(input,output,session,rv,rf) { shinyFiles::shinyDirChoose(input, 'switchProjB',roots=volumes) obsrv_e(input$saveConfB, { - conf<-rv_conf2conf(rv) + conf<-rv_lst2lst(rv) vol <- vol_f() fn <- shinyFiles::parseSavePath(roots=vol_f,input$saveConfB)[["datapath"]] validate1(fn,msg="Invalid file to save config to.") @@ -182,12 +182,15 @@ server_conf <- function(input,output,session,rv,rf) { }) obsrv_e(input$restoreConfB,{ - fn <- shinyFiles::parseSavePath(roots=vol_f,input$saveConfB)[["datapath"]] - validate(need()) - validate1(fn,msg="Something went wrong with the config file name.") - validate1(file.exists(fn),msg="The file is unreadable.") + fn <- shinyFiles::parseFilePaths(roots=volumes,input$restoreConfB)[["datapath"]] + assert(file.exists(fn), msg="The file is unreadable.") conf <- read_conf(fn) - rv <- conf2rv_conf(conf,rv) + rv$conf <- lst2rv_lst(conf) + for (nm in names(conf$compounds)) { + shiny::updateTextInput(session=session, + inputId=nm, + value=conf$compounds[[nm]]) + } }) @@ -197,21 +200,21 @@ server_conf <- function(input,output,session,rv,rf) { ## ***** Render ***** output$fnKnownLCtrl <- shiny::renderUI({ - txt_file_input(inputId = 'fnKnownL', + txt_file_input(inputId = 'known', input = input, label = html("The list of knowns. Required columns: <i>ID</i>, <i>SMILES</i>, <i>Name</i> and <i>RT</i> (the last two can be empty). Remember to quote <i>SMILES</i> and <i>Name</i> entries!"), fileB = 'impKnownListB', volumes=volumes) }) output$fnUnkLCtrl <- shiny::renderUI({ - txt_file_input(inputId = 'fnUnkL', + txt_file_input(inputId = 'unknown', input = input, label = html("The list of unknowns. Required columns: <i>ID</i>, <i>mz</i> and <i>RT</i> (<i>RT</i> can be empty)."), fileB = 'impUnkListB', volumes=volumes) }) output$fnSetIdCtrl <- shiny::renderUI({ - txt_file_input(inputId = 'fnSetId', + txt_file_input(inputId = 'sets', input = input, label = html("Set table. Required columns <i>ID</i> and <i>set</i>."), fileB = 'impSetIdB', -- GitLab