From fd0d7544286ab477eedb86f1c486a3b27d47e6f4 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:50:12 +0200
Subject: [PATCH] Use load_inputs for restoring configuration

* R/shiny-ui-config.R(input$restoreConfB):

Use load_inputs from the command line way of doing things to read all
the inputs. This way, we have the batteries included.
---
 R/shiny-ui-config.R | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/R/shiny-ui-config.R b/R/shiny-ui-config.R
index de8b129..c0e3332 100644
--- a/R/shiny-ui-config.R
+++ b/R/shiny-ui-config.R
@@ -184,14 +184,13 @@ server_conf <- function(input,output,session,rv,rf) {
     obsrv_e(input$restoreConfB,{
         fn <- shinyFiles::parseFilePaths(roots=volumes,input$restoreConfB)[["datapath"]]
         assert(file.exists(fn), msg="The file is unreadable.")
-        conf <- read_conf(fn)
-        rv$conf <- lst2rv_lst(conf)
-        for (nm in names(conf$compounds)) {
+        rv$conf <- lst2rv_lst(read_conf(fn))
+        rv <- load_inputs(rv)
+        for (nm in names(rv$conf$compounds)) {
             shiny::updateTextInput(session=session,
                                    inputId=nm,
-                                   value=conf$compounds[[nm]])
+                                   value=rv$conf$compounds[[nm]])
         }
-        
     })
     
 
-- 
GitLab